Retry failed model requests
0. Each step records how many attempts it took in its model attempts field (modelAttempts, model_attempts or ModelAttempts). Only model requests are retried: tool errors follow the tool’s own error policy, so put retries for side-effecting tools inside the tool and make them idempotent.
The wait between attempts and which errors are retried differ by language:
With a linear wait and a 500 ms backoff, three retries wait 0.5 s, 1 s, then 1.5 s.
Validate the final output
When the model answers without calling a tool, a parser turns the final text into your value and a schema checks it. If either fails, the run fails with anInvalid agent output: ... error, so bad output stops at the agent boundary. Keep validators deterministic and free of side effects.
For stricter model behaviour, also ask the gateway for structured output. Set a JSON Schema response format (and optionally the response-healing plugin) on the gateway agent client:
response_format/responseFormat and plugins options. Go, C# and Java have no response format option; set the field through the client’s escape hatch for other request fields (next section).
Keep routing defaults in a preset
Setpreset on the agent (Preset in Go and C#) when routing, prompt, or parameter defaults should stay in the dashboard:
preset option.
Set gateway defaults on the client
The gateway agent client (createGatewayAgentClient(), create_gateway_agent_client(), CreateGatewayAgentClient) carries request defaults for every model turn, so you don’t rebuild them on each run. The agent still owns model, input, instructions and its function tools; the model default applies only when the agent sets none.
Java and Rust take fewer options:
The Responses parameters page explains each field. To read usage, cost and status from the result, see Observability.