Building an AI agent? Start with /llms.txt for the full site index.
Docs
Building a consistent approach to API exceptions and diagnosis.
The goal of error handling is a system that stays predictable when things go wrong: retryable, observable, traceable.
Separate authentication errors, parameter errors, rate limiting and server errors first. The strategy follows from that distinction.
Batch jobs, live strategies and agent workflows all need the same error model.
Without one, the usual outcomes are silent failure or a retry storm.
For 4xx, correct the input and check permissions. Controlled retries belong to 5xx.
Record the request id, trace_id, endpoint, a summary of the parameters and a timestamp on every error.
Do not retry every error the same way. Retrying a 401, 403 or 422 is usually pointless.
Recoverable errors need a circuit breaker and an alert, so one failure does not propagate downstream.