pub struct UsageLimitConfig {
pub enabled: bool,
pub resume_message: String,
pub max_wait_secs: u64,
pub default_fallback_secs: u64,
pub jitter_secs: u64,
pub max_attempts: u32,
pub providers: HashMap<String, UsageLimitProviderOverride>,
}Expand description
Top-level [usage_limits] config block. Loaded from zag.toml.
Fields§
§enabled: boolMaster switch. Detection always runs; this gates auto-resume scheduling.
resume_message: StringMessage injected into the session when the timer fires. Default "Continue".
max_wait_secs: u64Hard cap on how long a single wait can be. Default 24h.
default_fallback_secs: u64Used when the provider didn’t tell us a reset time. Default 1h. On self-retrigger (resume failed because limit still active), the cycle just runs again — eventually the window passes.
jitter_secs: u64Jitter added on top of the computed reset time, to spread retries. Default 30s.
max_attempts: u32Maximum auto-resume attempts within a single foreground zag exec or
zag spawn invocation. Default 12 — with the default 1h fallback this
caps a stuck batch at ~12h. Set to 0 to disable the cap.
providers: HashMap<String, UsageLimitProviderOverride>Per-provider overrides keyed by provider name.
Implementations§
Source§impl UsageLimitConfig
impl UsageLimitConfig
Sourcepub fn enabled_for(&self, provider: &str) -> bool
pub fn enabled_for(&self, provider: &str) -> bool
True if auto-resume should be attempted for provider.
Sourcepub fn resume_message_for(&self, provider: &str) -> &str
pub fn resume_message_for(&self, provider: &str) -> &str
Effective resume message for provider, honoring overrides.
Sourcepub fn fallback_secs_for(&self, provider: &str) -> u64
pub fn fallback_secs_for(&self, provider: &str) -> u64
Effective fallback duration (seconds) for provider.
Sourcepub fn extra_patterns_for(&self, provider: &str) -> &[String]
pub fn extra_patterns_for(&self, provider: &str) -> &[String]
User-supplied additional patterns for provider, empty slice if none.
Trait Implementations§
Source§impl Clone for UsageLimitConfig
impl Clone for UsageLimitConfig
Source§fn clone(&self) -> UsageLimitConfig
fn clone(&self) -> UsageLimitConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more