Skip to content

Error Handling ​

On failure, AgentResult contains a structured error. The UI may show message, but server logs should use code, retryable, a request id, and sanitized metadata; never echo the raw Provider body.

Categories ​

CategoryRepresentative codesRetry by defaultGuidance
Provider network/rate limitMODEL_NETWORK_ERROR, MODEL_RATE_LIMITNetwork errors and 429 may retryUse backoff, concurrency limits, and a user retry action
Provider auth/requestMODEL_AUTH_ERROR, MODEL_PROVIDER_ERRORNoCheck server credentials, model allowlists, and upstream status
Provider responseMODEL_INVALID_RESPONSENoKeep safe metadata and verify protocol compatibility
Tool input/executionTOOL_INVALID_INPUT, TOOL_EXECUTION_ERRORNoValidate input, re-authorize, and check idempotency
Tool versionTOOL_CHANGED, TOOL_NOT_FOUNDNoUse the latest tool snapshot and let the model decide again
Runtime boundaryMAX_STEPS_EXCEEDED, TIMEOUT, ABORTEDNoEnd the run; do not commit incomplete messages
ContextTOOL_RESULT_TOO_LARGE, CONTEXT_LIMIT_EXCEEDED, CONTEXT_ESTIMATION_ERROR, CONTEXT_COMPACTION_ERRORNoShorten input, limit tool output, or adjust the budget

MODEL_ERROR, INSTRUCTION_RESOLUTION_ERROR, INSTRUCTIONS_TOO_LARGE, and INTERNAL_ERROR also end the run. Do not automatically replay a complete Agent run unless the error is explicitly marked retryable.

Cancellation and late results ​

After cancellation or timeout, Runtime converges promptly and isolates late model/tool results. It cannot undo a side effect already sent to an external system; payment, write, and delete tools need idempotency keys and server-side compensation.

Gateway mapping ​

A gateway may map upstream HTTP statuses to consistent 4xx, 429, or 5xx responses, but must not send keys, full requests, response bodies, or internal stacks to the browser. Generate a correlation id and keep public errors separate from internal logs.