Sponsored by Deepsite.site

🤖 Agenite

Created By
subeshb18 months ago
🤖 Build powerful AI agents with TypeScript. Agenite makes it easy to create, compose, and control AI agents with first-class support for tools, streaming, and multi-agent architectures. Switch seamlessly between providers like OpenAI, Anthropic, AWS Bedrock, and Ollama.
Content

🤖 Agenite

Agenite Logo

A modern, modular, and type-safe framework for building AI agents using typescript

GitHub license npm version TypeScript PRs Welcome

What is Agenite?

Agenite is a powerful TypeScript framework designed for building sophisticated AI agents. It provides a modular, type-safe, and flexible architecture that makes it easy to create, compose, and control AI agents with advanced capabilities.

✨ Key features

  • Type safety and developer experience

    • Built from the ground up with TypeScript
    • Robust type checking for tools and agent configurations
    • Excellent IDE support and autocompletion
  • Tool integration

    • First-class support for function calling
    • Built-in JSON Schema validation
    • Structured error handling
    • Easy API integration
  • Provider agnostic

    • Support for OpenAI, Anthropic, AWS Bedrock, and Ollama
    • Consistent interface across providers
    • Easy extension for new providers
  • Advanced architecture

    • Bidirectional flow using JavaScript generators
    • Step-based execution model
    • Built-in state management with reducers
    • Flexible middleware system
  • Model context protocol (MCP)

    • Standardized protocol for connecting LLMs to data sources
    • Client implementation for interacting with MCP servers
    • Access to web content, filesystem, databases, and more

📦 Available packages

PackageDescriptionInstallation
Core packages
@agenite/agentCore agent orchestration framework for managing LLM interactions, tool execution, and state managementnpm install @agenite/agent
@agenite/toolTool definition framework with type safety, schema validation, and error handlingnpm install @agenite/tool
@agenite/llmBase provider interface layer that enables abstraction across different LLM providersnpm install @agenite/llm
Provider packages
@agenite/openaiIntegration with OpenAI's API for GPT models with function calling supportnpm install @agenite/openai
@agenite/anthropicIntegration with Anthropic's API for Claude modelsnpm install @agenite/anthropic
@agenite/bedrockAWS Bedrock integration supporting Claude and other modelsnpm install @agenite/bedrock
@agenite/ollamaIntegration with Ollama for running models locallynpm install @agenite/ollama
MCP package
@agenite/mcpModel Context Protocol client for connecting to standardized data sources and toolsnpm install @agenite/mcp
Middleware packages
@agenite/pretty-loggerColorful console logging middleware for debugging agent executionnpm install @agenite/pretty-logger

For a typical setup, you'll need the core packages and at least one provider:

# Install core packages
npm install @agenite/agent @agenite/tool @agenite/llm

# Install your preferred provider
npm install @agenite/openai
# OR
npm install @agenite/bedrock

🚀 Quick start

import { Agent } from '@agenite/agent';
import { Tool } from '@agenite/tool';
import { BedrockProvider } from '@agenite/bedrock';
import { prettyLogger } from '@agenite/pretty-logger';

// 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) {
      if (error instanceof Error) {
        return { isError: true, data: error.message };
      }
      return { isError: true, data: 'Unknown error' };
    }
  },
});

// 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.',
  middlewares: [prettyLogger()],
});

// Example usage
const result = await agent.execute({
  messages: [
    {
      role: 'user',
      content: [{ type: 'text', text: 'What is 1234 * 5678?' }],
    },
  ],
});

🏗️ Core concepts

Agents

Agents are the central building blocks in Agenite. An agent:

  • Orchestrates interactions between LLMs and tools
  • Manages conversation state and context
  • Handles tool execution and results
  • Supports nested execution for complex workflows
  • Provides streaming capabilities for real-time interactions

Tools

Tools extend agent capabilities by providing specific functionalities:

  • Strong type safety with TypeScript
  • JSON Schema validation for inputs
  • Flexible error handling
  • Easy API integration

Providers

Currently supported LLM providers:

  • OpenAI API (GPT models)
  • Anthropic API (Claude models)
  • AWS Bedrock (Claude, Titan models)
  • Local models via Ollama

Model Context Protocol (MCP)

MCP is a standardized protocol for connecting LLMs to data sources:

  • Client implementation for interacting with MCP servers
  • Access to web content, filesystem, databases, and more
  • Similar to how USB-C provides universal hardware connections

🔄 Advanced features

Multi-agent systems

// Create specialist agents
const calculatorAgent = new Agent({
  name: 'calculator-specialist',
  provider,
  tools: [calculatorTool],
  description: 'Specializes in mathematical calculations',
});

const weatherAgent = new Agent({
  name: 'weather-specialist',
  provider,
  tools: [weatherTool],
  description: 'Provides weather information',
});

// Create a coordinator agent
const coordinatorAgent = new Agent({
  name: 'coordinator',
  provider,
  agents: [calculatorAgent, weatherAgent],
  instructions: 'Coordinate between specialist agents to solve complex problems.',
});

Step-based execution

// Create an iterator for fine-grained control
const iterator = agent.iterate({
  messages: [{ role: 'user', content: [{ type: 'text', text: 'Calculate 25 divided by 5, then multiply by 3' }] }],
  stream: true,
});

// Process the stream with custom handling
for await (const chunk of iterator) {
  switch (chunk.type) {
    case 'agenite.llm-call.streaming':
      console.log(chunk.content);
      break;
    case 'agenite.tool-call.params':
      console.log('Using tool:', chunk.toolUseBlocks);
      break;
    case 'agenite.tool-result':
      console.log('Tool result:', chunk.result);
      break;
  }
}

📚 Documentation

For comprehensive documentation, visit docs.agenite.com:

🤝 Community

🛠️ Development

git clone https://github.com/subeshb1/agenite.git
cd agenite
pnpm install
pnpm build

📄 License

MIT

🌟 Star history

Star History Chart

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
WindsurfThe new purpose-built IDE to harness magic
Tavily Mcp
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Serper MCP ServerA Serper MCP Server
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Playwright McpPlaywright MCP server
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
ChatWiseThe second fastest AI chatbot™
Amap Maps高德地图官方 MCP Server
DeepChatYour AI Partner on Desktop
CursorThe AI Code Editor