Tools let your agents interact with the world—searching the web, querying databases, calling APIs, or executing code. The SDK makes tool definition declarative: a function becomes a tool with simple metadata telling the agent when and how to use it.
Define a tool with a function: what it does, what parameters it needs, and what it returns. Add a description—the agent uses this to decide when to call it. Tools can be synchronous (return immediately) or asynchronous (emit progress events).
Tools can call external services: a tool to query your D1 database for user data, another to send email, another to make API calls. The agent reasons about what tools help accomplish the user's request, then the SDK orchestrates calling them with the right parameters.