Tool Runtime (Tool Loop)
Applies to: 4.0.8.1+
This page covers the full runtime process of tool calling.
1) End-to-end flow
2) Planning stage (PLAN)
Default planner builds a standalone ModelRequest with:
.input({ user_input, user_extra_requirement, available_tools }).info({ done_plans, last_round_result, round_index, max_rounds }).instruct([...]).output({ next_action, execution_commands[] })
Each execution_commands[] item contains:
purposetool_nametool_kwargstodo_suggestion
3) instant short-circuit
Default planner listens on instant:
So next_action=response can end planning early.
4) Execution stage (EXECUTE)
Default executor:
- reads
execution_commands - creates semaphore from
tool.loop.concurrency - calls
async_call_tool(tool_name, tool_kwargs) - emits normalized records:
purpose/tool_name/kwargs/todo_suggestion/success/result/error
5) Convergence and injection
After loop ends:
- with records:
to_action_results(records)->prompt.action_resultsprompt.extra_instructionfor evidence quotingextra.tool_logsappended to final result
- without records:
- no tool result injection
6) Runtime controls
tool.loop.enabledtool.loop.max_roundstool.loop.concurrencytool.loop.timeout