Standardize usage / rate-limit error code and optional reset time #3012
caopulan
started this conversation in
Protocol Suggestions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Motivation
When an ACP agent hits a provider rate limit or subscription usage quota (e.g., HTTP 429 or a rolling 5-hour / weekly / billing-cycle cap), ACP currently has no standard way to signal that a turn failed specifically because of a usage/rate limit—or when the limit resets.
In
agent-client-protocol-schema/src/v2/error.rs, the predefined ACP server error codes are currently:-32000(AuthRequired)-32002(ResourceNotFound, with typedSessionNotFoundErrorData)-32022(UnsupportedProtocolVersion, with typedUnsupportedProtocolVersionErrorData)Because there is no usage/rate-limit code, agents fall back to
-32603(InternalError) with free-form error text (for example, Kimi Code CLI returning"403 You've reached your usage limit..."). Generic ACP clients—such as T3 Code (see pingdotgg/t3code#45401)—cannot reliably distinguish quota exhaustion from an ordinary turn failure without brittle per-agent string matching, and therefore cannot:Proposal
Add a standard ACP error code in the
-32000..-32099range (e.g.,UsageLimitExceededorRateLimitExceeded), usable both:session/promptin v1, anderrorpayload onstate_updatewithstopReason: "error"in v2 (introduced in feat(unstable): report failures after prompt insertion with an error stop reason #2281).Define an optional typed
dataobject following the existingUnsupportedProtocolVersionErrorData/SessionNotFoundErrorDatapattern:{ "code": -320xx, "message": "5-hour usage limit reached", "data": { "resetsAt": "2026-11-29T19:00:00Z", "retryAfterSeconds": 3600, "limitType": "quota" } }Suggested optional fields on
data:resetsAt(string, RFC 3339 timestamp, optional): when the exhausted window or rate limit is expected to reset.retryAfterSeconds(integer, optional): relative delay for short-lived rate limits where a wall-clock reset timestamp is unavailable.limitTypeorscope("rate" | "quota", optional): lets clients distinguish transient per-minute throttling from rolling subscription windows (e.g., 5h / weekly caps)._meta(Meta, optional): standard ACP extensibility bag.Compatibility
ErrorCode::Other(i32)).data(or omitresetsAt) and still let clients classify the failure accurately.Happy to draft an RFD if there is interest in this direction.
All reactions