Overview
This guide walks you through building tools that work well with:- Schema-driven function calling
react_agent(...)- Tracing and debugging
- Deterministic where possible
- Easy to validate
- Easy to observe
Defining tool schemas
Define a Pydantic schema for tool arguments. This schema becomes the JSON schema that the LLM sees.Wrapping functions with tool_step
Tool functions typically read arguments from state (e.g. state["tool_args"]) and return a value.
For ReAct,
result_key="tool_result" is the simplest choice because it matches the default react_agent contract.Generating tool specs
Convert tool steps into tool specs and attach them to the planner’sLLMConfig: