Patterns
Tools
Write a typed Python function for an agent to call
A tool is an ordinary Python function. Its signature and docstring describe the arguments and purpose to the model.
Sync and async tools are supported. Exceptions are converted to retry feedback so the model can try again; use errors that explain what input was invalid.
See tools and context for task-level tools and supplied data, or MCP for external tool servers.
