Tools in Agenite are specialized components that extend an agent’s capabilities beyond simple text generation. They allow agents to perform specific actions, access external systems, process data, and interact with the real world.Think of tools as the “hands” of an agent - they enable it to reach out and interact with systems and data outside of its language model, giving it practical abilities to accomplish real tasks.
Tools validate inputs based on the provided schema, ensuring that they receive the correct data structure before execution. Validation happens automatically before the execute function is called.
To use tools with an agent, pass them in the tools array when creating an agent:
Copy
import { Agent } from '@agenite/agent';import { BedrockProvider } from '@agenite/bedrock';import { calculatorTool } from './tools/calculator';import { createWeatherTool } from './tools/weather';const weatherTool = createWeatherTool('your-api-key');const agent = new Agent({ name: 'helpful-assistant', provider: new BedrockProvider(), tools: [calculatorTool, weatherTool], instructions: 'You are a helpful assistant. Use the calculator for math operations and the weather tool for weather information.',});// Example usageconst result = await agent.execute({ messages: [ { role: 'user', content: 'What is 42 * 123 and what\'s the weather in Paris?' } ]});
When the agent encounters a task that requires one of these tools, it will:
Tools are a powerful way to extend an agent’s capabilities. By providing specialized functions through tools, you can create agents that can interact with external systems, process data, and perform complex tasks that would be impossible with text generation alone.In the next section, we’ll explore how providers connect agents to different language models.