Tool System Overview
Applies to:
v4.0.8.2
In v4.0.8.2, the tool system is a standardized loop of plan -> execute -> inject evidence:
- the canonical planning schema is
next_action + execution_commands[] - the default Tool Loop is implemented on top of
TriggerFlow - tool results are injected into
prompt.action_resultsandextra.tool_logs Browseis now the only built-in browsing tool, with internalpyautogui -> playwright -> bs4fallback
1. Four-layer architecture
How to read this diagram
- Read it from left to right: the system is not “the model directly calling functions”.
generate_tool_command()stops at the planning layer;agent.use_tools(...)activates the full loop.
Design rationale
Putting the Tool Loop on top of TriggerFlow instead of hiding it inside a black-box while loop gives two direct benefits:
- each round has explicit state:
done_plans,last_round_records,round_index - planning, execution, and evidence injection are naturally separated for replacement and auditing
2. How to think about the tool system
There are four layers:
- registration:
register_tool(),@agent.tool_func, BuiltInTool - planning:
plan_analysis_handlerreturns aToolPlanDecision - execution:
tool_execution_handlerrunsToolCommand - injection:
ToolExecutionRecord[]becomesaction_resultsandtool_logs
Canonical public shape:
python
ToolPlanDecision = {
"next_action": "execute" | "response",
"execution_commands": [
{
"purpose": str,
"tool_name": str,
"tool_kwargs": dict,
"todo_suggestion": str,
}
],
}Compatibility notes:
tool_commandsandtool_commandare still normalized if returnedmust_call()andasync_must_call()still exist, but only as soft-compat entry points- new code should use
execution_commandsandgenerate_tool_command()
3. Built-in tools in v4.0.8.2
The built-in tool set exposed by source code is:
Important:
PlaywrightandPyAutoGUIare no longer exposed as standalone built-in tools- they now live behind
Browseas internal backends
4. Tool Loop at a glance
How to read this diagram
- This is a runtime loop, not a static configuration chart.
- The planner can always read the previous round, so
todo_suggestionand failures can shape the next decision.
The internal round state is always:
done_planslast_round_recordsround_index
5. Recommended reading order
- Tool Quickstart
- Tool Runtime (Tool Loop)
- Tool Handlers (Default & Replace)
- Browse Tool
- Tool Notes & Best Practices
6. Real project reference
AgentEra/Agently-Daily-News-Collector already runs on v4.0.8.2.
It uses:
Search.search_news()Browsewithenable_playwrightTriggerFlow.for_each(concurrency=...)runtime_resourcesto injectlogger/search_tool/browse_tool
See: Daily News Collector