Start with next_action
Every error listed in Errors says what to do next in next_action,
and in words in agent_instruction.
Follow it first. The rules below cover what it does not say, such as how to back off.
See What to do next for every field.
The rules
- Honour
Retry-After. It is a number of seconds. Wait at least that long. Always use the value from the latest response, not an earlier one. - No
Retry-After, butretryableistrue? Back off exponentially with jitter, and cap the wait. For example: 1 s, 2 s, 4 s, up to 60 s, each multiplied by a random factor. - Never retry
retryable: falseor any402. The same request fails the same way. Fix the input, or ask the account owner to resolve the account. - Retry paid requests with the same
Idempotency-Key. A retry with the same key is never charged twice. A new key is new work, billed separately. - Send the key on the first attempt. A paid request without one is new work every
time. If the first attempt finished, a resend can be charged as well. Without a
key, don’t resend an error that names an
operation_id. The exception is a429withretryable: true: nothing started. - Branch on
retryable, not on the HTTP status alone. A paid operation can end with a retryable-looking status andretryable: false.
409 operation_in_progress while the work is still running.
Which errors to retry
Retry after Retry-After
Send the same request, with the same Idempotency-Key, once Retry-After has passed.
Retry with backoff
These have no fixedRetry-After. Back off with jitter, as in the rules above.
Retry only when retryable is true
A paid operation can fail after its work started. It then has
operation_status: "failed", retryable: false and no Retry-After. That key is
finished: the same key returns the same failure. Once the cause is resolved, send the
request with a new key.
Permits works the same way. See Permits errors.
Don’t retry
The same request fails the same way. Change something first.Repeated refusals
Retrying a refusal early does not help: it keeps returning the same refusal. See the “Repeated refusals” notes under Dollar billing and rate limits.Example
A retry loop in Python. It readsRetry-After, adds jitter, stops on
retryable: false or a 402, and reuses one key for every attempt.
For agents
If you are an agent calling Mireye in a loop, follownext_action and
agent_instruction. Where they say to wait, wait the full Retry-After, then send
the request again unchanged, with the same idempotency key. If a paid call had no key
and its error names an operation_id, don’t resend unless it is a 429 with
retryable: true: tell the user. On a 402, stop
and tell the user. On retryable: false, don’t resend: fix the request or tell the user.
Hosted MCP follows the same rules:
- A tool error carries
code,retryable,next_action,agent_instructionand, where there is one,retry_after_seconds. A value of0means no fixed delay: back off instead. - The idempotency key is the tool’s
idempotency_keyinput. Send one on every paid call.