A tool is where the agent touches the real world, so most production issues live here. This topic covers the whole tool lifecycle: typed definitions with Zod, input/output hooks, repairing malformed tool calls, generating tools at runtime, and gating destructive actions behind human approval. Then the capabilities themselves — neural web search with Exa, scraping with Cheerio and Firecrawl, and PDF ingestion — each wired into a working chat you can test.
Create dynamic tools with runtime-generated schemas using dynamicTool. Demonstrates unit conversion tools where schema adapts based on conversion type (temperature, length, weight, currency) and supports dynamic model selection.
Create tools at runtime with dynamicTool
Adapt tool name, description, and Zod schema from user selection
Support unit conversion schemas that change by conversion type
Explore tool input lifecycle hooks: onInputStart, onInputDelta, and onInputAvailable. See how to track tool input generation in real-time during streaming.
Observe tool input generation with onInputStart
Stream partial tool arguments via onInputDelta
React when full tool input becomes available with onInputAvailable