Skip to main content
An agent works in tool rounds, also called steps. The model picks one or more tools (web search, file write, and so on), the tools run, and the cycle repeats until the agent can answer. Long tasks can chain many steps, which costs time and money. 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

Send max_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.
There is no “unlimited” value, and there is no upper bound. A very high value such as 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 + 1 rounds.
  • One round can contain several tool calls. max_steps is 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.
Example with 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.
Because each sub-agent has its own counter, one message can run far more than max_steps steps in total. Set a lower max_steps when your agents delegate a lot.

Limits and gotchas

The cap is per message, not per thread

A follow-up that does not pass max_steps runs with the server default, whatever the first message used. Pass an integer on every message to keep a custom cap.

Hitting the cap looks like a normal success

  • The reply ends with status set to success and error_code set to null.
  • 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 high max_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_steps exists on POST /chat and POST /chat/{thread_id}, and on chat.start and chat.send in the SDK.
  • Routines also accept max_steps on the platform, but the SDK and the public API reference do not cover routines.
  • Agents have no max_steps setting. 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.