stop_when:
has_tool_call(...) and finish_reason_is(...). Keep a step or duration bound even when using cost or token limits because those depend on reported usage.
Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
Bound Python agent work by steps, tokens, cost, duration, tools, or finish reason.
stop_when:
stop_when = [
step_count_is(12),
max_tokens_used(40_000),
max_cost(2),
max_duration(60_000),
]
has_tool_call(...) and finish_reason_is(...). Keep a step or duration bound even when using cost or token limits because those depend on reported usage.
Was this page helpful?