max_steps caps the number of steps for one message.
Reaching the cap is not an error. The agent stops using tools, writes a
short recap, and asks whether it should continue. The message ends with
status set to success. You continue with a normal follow-up in the same
thread.
This guide works the same with the Python SDK and
the HTTP API.
max_steps is available through the API and the SDK. It is not yet exposed
in the Portal or in the Platform Playground.Set a cap
Sendmax_steps as an integer >= 1 with the start request or with a
follow-up. If you omit it, the server applies its default. Today the default is
60 for every agent (Hive, Chat, Planner, and custom agents), and it may change.
- Python SDK
- HTTP
999 effectively removes the cap, but see
the budget warning.
What counts as a step
One step is one tool round: the model is called, it asks for one or more tools, and those tools run. The final answer, written without tools, is not a step.- The limit is checked after each round, so an agent can run up to
max_steps + 1rounds. - One round can contain several tool calls.
max_stepsis an order of magnitude, not an exact count of tool calls. - It limits rounds, not tokens, cost, or duration. A single round can still be long or expensive.
Sub-agents have their own step counter
When an agent calls a sub-agent,max_steps applies to each agent
independently, not globally.
- The main agent pauses its counter while it waits for the sub-agent.
- The sub-agent gets its own full quota of steps, up to
max_steps(or the default). - When a sub-agent reaches its limit, it asks the main agent (or you) to continue. This does not consume the main agent’s steps.
max_steps=60: the main agent is at step 8 and calls Sub-agent A.
Sub-agent A can run up to 60 steps on its own. Once it finishes, control returns
to the main agent, which resumes at step 9.
Limits and gotchas
The cap is per message, not per thread
A follow-up that does not passmax_steps runs with the server default,
whatever the first message used. Pass an integer on every message to keep a
custom cap.
- Python SDK
- HTTP
Hitting the cap looks like a normal success
- The reply ends with
statusset tosuccessanderror_codeset tonull. - No field, event, or error code tells you the cap was reached.
- The recap is written by the model in the conversation language. Do not parse it.
A high cap does not protect your budget
The budget is checked once, when the agent starts. The cost of the run is computed and deducted at the end of its execution, not while it runs. An agent started on an expensive model with a very highmax_steps can spend well
beyond your intended budget before anything stops it. Choose a cap that matches
the cost you can accept.
The value is not readable afterwards
The value is neither stored nor returned for chats. Keep it on your side if you need to display it.Invalid values
Always send a JSON integer>= 1. Nothing is created when a request is
rejected.
Scope
max_stepsexists onPOST /chatandPOST /chat/{thread_id}, and onchat.startandchat.sendin the SDK.- Routines also accept
max_stepson the platform, but the SDK and the public API reference do not cover routines. - Agents have no
max_stepssetting. Each message carries its own value. - The default is a server setting. Pass an integer if your integration depends on an exact value.
Next steps
API reference
options.max_steps on the chat endpoints.Python SDK reference
The
max_steps argument, MaxSteps, and SERVER_DEFAULT.