Back to Documentation
Tools & Functions
Extend your agents with custom tools and functions they can call during execution.
Define a Tool
const tool = await client.tools.create({
name: "search_products",
description: "Search the product catalog",
parameters: {
type: "object",
properties: {
query: { type: "string", description: "Search query" },
category: { type: "string", enum: ["electronics", "clothing"] }
},
required: ["query"]
},
handler: async (params) => {
return await searchProducts(params.query, params.category);
}
});Built-in Tools
Web Search
Search the web for real-time information.
Code Interpreter
Execute Python code in a sandboxed environment.
File Operations
Read and write files securely.
Attach Tools to Agent
await client.agents.update(agentId, {
tools: ["search_products", "web_search", "code_interpreter"]
});