max_steps caps the number of rounds 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="success". You continue with a normal follow-up in the same thread.
For the HTTP contract, see
Capping tool rounds in the API reference.
Quick start
Arguments
max_steps is a keyword-only argument of both methods:
MaxSteps is either an integer >= 1 or the SERVER_DEFAULT sentinel. Import
them from cominty_sdk:
Accepted values
There is no “unlimited” value, and the API has no upper bound. Choose a
sensible maximum in your own application.
Behavior to know
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 call to keep a custom
cap.
Hitting the cap looks like a normal success
- The reply ends with
status="success". - 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.
It is an order of magnitude, not an exact count
- The limit is checked after each round, so the agent can run up to
max_steps + 1rounds. - One round can contain several tool calls.
- Each sub-agent gets its own budget, so one message can exceed
max_stepswhen sub-agents are involved. - It limits rounds, not tokens, cost, or duration.
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.Errors
An invalid value raisesInvalidParams before any request is sent:
Scope
max_stepsexists onchat.startandchat.sendonly.- Routines also accept
max_stepson the platform, but the SDK does not expose routines. - Agents have no
max_stepssetting. Each message carries its own value. - The default (60 today) is a server setting. Pass an integer if your integration depends on an exact value.
examples/10_max_steps.py