code, not the message: the text can change.
Shape
A tool error carriesmessage (for a person), next (what to do) and retryable. It also carries Recovery:, one sentence telling the agent what to do, and Request id:. If retryable is false, fix what it says before calling again. Keep the request_id when asking for help.
The REST API returns this shape:
fixersays who fixes it:caller(fix the request),person(a person has to act, such as saying yes or reconnecting) orbrein(our failure; try again later).recoveryis the next step, in one sentence.- A
403may carryreason, the exact cause: for exampleapi_key_member_removed(whoever created the key is no longer a member) oroauth_workspace_mismatch(the token belongs to another workspace). ThecodestaysFORBIDDEN.
422 adds errors: one entry per question, with key or path and message.
Common codes
Tool cases
Without balance or on a plan that does not include it, Brein fails closed with
402. There is no automatic retry with another provider.