#[non_exhaustive]pub struct RateLimit {
pub status: String,
pub window: Option<String>,
pub resets_at: Option<i64>,
pub overage_status: Option<String>,
pub is_using_overage: Option<bool>,
}Expand description
A quota signal the agent emitted mid-run.
Surfaced rather than acted on: this crate reports what the provider said and
leaves backing off to the caller. See docs/operating-limits.md.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.status: StringThe provider’s status word, e.g. allowed, rejected.
window: Option<String>Which window this refers to, e.g. five_hour.
resets_at: Option<i64>Unix epoch seconds at which the window resets.
overage_status: Option<String>The provider’s status for overage beyond the plan, e.g. rejected.
is_using_overage: Option<bool>Whether the run was already drawing on overage rather than the plan.
Implementations§
Source§impl RateLimit
impl RateLimit
Sourcepub fn is_blocking(&self) -> bool
pub fn is_blocking(&self) -> bool
Whether this signal means the request was actually refused, as opposed to an informational “still allowed” heartbeat.
Every status the provider prefixes with allowed is a heartbeat, not a
refusal. This was an exact match on allowed, which made
allowed_warning a block: Claude emits that once an account passes a
utilization threshold, which is the opposite of being refused, and
the account keeps working for the rest of the window. Observed on
claude 2.1.212, seven-day window, at 77% of quota:
{"status": "allowed_warning", "utilization": 0.77,
"surpassedThreshold": 0.75, "rateLimitType": "seven_day"}The consequence was that crossing 75% of a window turned every
finished, successful run into Error::RateLimited and discarded its
answer, for as long as the window stayed above the threshold.
Callers who want to show the warning read status and resets_at,
which carry it. This one method answers only whether the request was
refused.