Skip to main content
This page contains examples demonstrating how to use Agenite for various use cases. Each example showcases different features and capabilities of the framework.

Example repository

All examples are available in our GitHub repository:

Agenite Examples

Browse the full collection of examples on GitHub

Basic agent with calculator tool

This example demonstrates a simple agent that uses a calculator tool to perform math operations.
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?' }],
    },
  ],
});

Multi-tool agent

This example shows an agent using multiple tools to provide a more comprehensive service.

Multi-tool Agent Example

View on GitHub

Custom steps implementation

Learn how to create custom steps for more complex agent workflows.

Custom Steps Example

View on GitHub

Streaming responses

This example demonstrates how to stream responses from an agent in real-time.

Streaming Example

View on GitHub

Categories

Browse examples by category:

Basic examples

Start with these simple examples to learn the basics of Agenite

Advanced examples

Complex examples showcasing advanced features

Provider examples

Examples using different LLM providers

Tool examples

Various tool implementations

Next steps

API reference

Explore the detailed API documentation

Core concepts

Learn about the fundamental concepts