Explore real-world examples of Agenite in action
import { Agent } from '@agenite/agent'; import { Tool } from '@agenite/tool'; import { BedrockProvider } from '@agenite/bedrock'; // Create a calculator tool const calculatorTool = new Tool<{ expression: string }>({ name: 'calculator', description: 'Perform basic math operations', inputSchema: { type: 'object', properties: { expression: { type: 'string' }, }, required: ['expression'], }, execute: async ({ input }) => { try { const result = new Function('return ' + input.expression)(); return { isError: false, data: result.toString() }; } catch (error) { return { isError: true, data: 'Error calculating expression' }; } }, }); // Create an agent const agent = new Agent({ name: 'math-buddy', provider: new BedrockProvider({ model: 'anthropic.claude-3-5-sonnet-20240620-v1:0', }), tools: [calculatorTool], instructions: 'You are a helpful math assistant.', }); // Example usage const result = await agent.execute({ messages: [ { role: 'user', content: [{ type: 'text', text: 'What is 1234 * 5678?' }], }, ], });