react_agent
react_agent(...) builds a ReAct loop as a Step.
Key parameters:
planner: an LLM step created withllm_step(...)tools: mapping from names to tool steps created withtool_step(...)max_steps/policy.max_iterations: maximum iterations- Key overrides for where data is stored in state (
llm_response_key,tool_result_key, etc.)
State keys and defaults
Default keys:llm_response:LLMResponsereturned by the plannertool_name: name of the tool to runtool_args: dict of tool argumentstool_result: tool outputtool_call_id: tool call identifier (if present)final: final assistant text (stop condition)
Tool validation and dispatch
Validation rules:- Every entry in
toolsmust be aStep - Each tool step must have
annotations["kind"] == "tool" - Tool step names must be unique
- ReAct executes only the first tool call in
LLMResponse.tool_callsper iteration - If the tool name cannot be resolved, a
KeyErroris raised - If the tool does not set the configured result key, an error is raised