mcpField
🤖
🤖 Agenite

🤖 Agenite

本地服务
docs.agenite.comAI 与智能体6781 周前更新

关于 🤖 Agenite

Agenite 是一个 TypeScript 框架,用于构建、组合和控制 AI Agent,支持工具调用、流式输出与多 Agent 架构。它面向希望以类型安全方式开发 Agent 的开发者,并可在 OpenAI、Anthropic、AWS Bedrock 与 Ollama 等提供方之间切换。

主要功能

  1. 01基于 TypeScript 的类型安全工具定义
  2. 02基于 JSON Schema 的输入校验
  3. 03统一接口支持多家 LLM 提供方
  4. 04基于生成器的分步执行与流式输出
  5. 05内置 MCP 客户端,用于连接 MCP 服务

适用场景

  1. 01开发带工具调用的 TypeScript Agent
  2. 02构建由多个专用 Agent 组成的系统
  3. 03在不同 LLM 提供方之间切换或在本地运行 Ollama 模型

MCP 相关

提供 @agenite/mcp 包,作为 MCP 客户端连接 MCP 服务,以访问网页内容、文件系统、数据库等数据源与工具。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

暂未收录安装方式

我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。

代码仓库

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

🤖 Agenite

Agenite 标志

一个现代化、模块化且类型安全的框架,使用 TypeScript 构建 AI Agent

GitHub license npm version TypeScript PRs Welcome

Agenite 是什么?

Agenite 是一个功能强大的 TypeScript 框架,专为构建复杂的 AI Agent 而设计。它提供模块化、类型安全且灵活的架构,让你可以轻松创建、组合和控制具备高级能力的 AI Agent。

✨ 主要功能

  • 类型安全与开发体验

    • 从头开始使用 TypeScript 构建
    • 对工具和 Agent 配置进行可靠的类型检查
    • 出色的 IDE 支持和自动补全
  • 工具集成

    • 一流的函数调用支持
    • 内置 JSON Schema 验证
    • 结构化错误处理
    • 轻松集成 API
  • 不依赖特定提供商

    • 支持 OpenAI、Anthropic、AWS Bedrock 和 Ollama
    • 各提供商使用一致的接口
    • 轻松扩展以支持新提供商
  • 高级架构

    • 使用 JavaScript 生成器实现双向流程
    • 基于步骤的执行模型
    • 使用 reducer 实现内置状态管理
    • 灵活的中间件系统
  • 模型上下文协议(MCP)

    • 用于将大模型连接到数据源的标准化协议
    • 用于与 MCP 服务交互的客户端实现
    • 可访问 Web 内容、文件系统、数据库等

📦 可用的软件包

软件包描述安装
核心软件包
@agenite/agent核心 Agent 编排框架,用于管理大模型交互、工具执行和状态管理npm install @agenite/agent
@agenite/tool工具定义框架,提供类型安全、模式验证和错误处理npm install @agenite/tool
@agenite/llm基础提供商接口层,可抽象不同的大模型提供商npm install @agenite/llm
提供商软件包
@agenite/openai集成 OpenAI API,为 GPT 模型提供函数调用支持npm install @agenite/openai
@agenite/anthropic集成 Anthropic API,以使用 Claude 模型npm install @agenite/anthropic
@agenite/bedrockAWS Bedrock 集成,支持 Claude 和其他模型npm install @agenite/bedrock
@agenite/ollama集成 Ollama,以便在本地运行模型npm install @agenite/ollama
MCP 软件包
@agenite/mcpModel Context Protocol 客户端,用于连接标准化的数据源和工具npm install @agenite/mcp
中间件软件包
@agenite/pretty-logger彩色控制台日志中间件,用于调试 Agent 执行过程npm install @agenite/pretty-logger

对于典型配置,你需要核心软件包和至少一个提供商:

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

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

🚀 快速开始

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?' }],
    },
  ],
});

🏗️ 核心概念

Agent

Agent 是 Agenite 的核心构建模块。一个 Agent:

  • 编排大模型与工具之间的交互
  • 管理对话状态和上下文
  • 处理工具执行及其结果
  • 支持复杂工作流的嵌套执行
  • 提供实时交互所需的流式处理能力
工具

工具通过提供特定功能来扩展 Agent 的能力:

  • 使用 TypeScript 实现强类型安全
  • 对输入进行 JSON Schema 验证
  • 灵活的错误处理
  • 轻松集成 API
提供商

目前支持的 LLM 提供商:

  • OpenAI API(GPT 模型)
  • Anthropic API(Claude 模型)
  • AWS Bedrock(Claude、Titan 模型)
  • 通过 Ollama 使用本地模型
模型上下文协议(MCP)

MCP 是一种用于将 LLM 连接到数据源的标准化协议:

  • 用于与 MCP 服务交互的客户端实现
  • 可访问网页内容、文件系统、数据库等
  • 类似于 USB-C 提供通用硬件连接

🔄 高级功能

多 Agent 系统
// 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.',
});
分步执行
// 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;
  }
}

📚 文档

如需完整文档,请访问 docs.agenite.com:

🤝 社区

🛠️ 开发

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

📄 许可证

MIT

🌟 Star 历史

Star 历史图表

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。