mcpField
S
Saiki

Saiki

github.com/truffle-ai框架与 SDK6575 天前更新

关于 Saiki

Dexto 是一个开源的 Agent 框架(agent harness),负责编排 LLM 的工具调用、会话状态与错误恢复。它面向开发者与高级用户,既可直接使用内置编码 Agent,也可通过 YAML 配置或 SDK 构建自定义 Agent。

主要功能

  1. 01基于 YAML 配置定义 Agent 并切换模型
  2. 02支持 50 多个 LLM 的运行中切换
  3. 03持久化会话与记忆管理
  4. 04人工审批控制工具调用权限
  5. 05提供 CLI、Web UI、REST 与 SSE 接口

适用场景

  1. 01使用内置编码 Agent 在命令行中修改代码
  2. 02通过 SDK 将 Agent 嵌入自有应用
  3. 03将 Dexto Agent 作为 MCP 服务接入 Claude Code 或 Cursor

MCP 相关

Dexto 既是 MCP 客户端,可通过 stdio 配置连接 MCP 服务并管理其工具;也可通过 --mode mcp 或 /mcp 路径将 Agent 作为 MCP 服务暴露给其他客户端。

详细介绍

Dexto

README 配图 README 配图 README 配图 README 配图

Deutsch | English | Español | français | 日本語 | 한국어 | Português | Русский | 中文

一款适用于 AI 应用的开源 Agent 框架,内置强大的编码 Agent。

Dexto 演示

Dexto 是什么?

Dexto 是一个 Agent 框架——负责编排的层,可将大模型转化为可靠、有状态的 Agent,使其能够采取行动、记住上下文并从错误中恢复。

可以把它看作 AI Agent 的操作系统:

组件类比作用
LLMCPU原始处理能力
上下文窗口RAM工作记忆
Dexto操作系统编排、状态、工具、恢复
你的 Agent应用程序特定领域的逻辑和客户端
为什么选择 Dexto?
  • 配置驱动:在 YAML 中定义 Agent。无需修改代码即可更换模型和工具。
  • 开箱即用:会话管理、工具编排、记忆、多模态支持和可观测性,均可直接使用。
  • 随处运行:本地、云端或混合环境均可。支持 CLI、Web UI、REST API、Discord、Telegram,也可嵌入你的应用。
你可以构建什么
  • 编码 Agent – 自主构建、调试和重构代码
  • 自主 Agent – 规划、执行并根据用户目标进行调整
  • 数字伴侣 – 能记住上下文并预判需求的助手
  • MCP 客户端和服务 – 通过 Model Context Protocol 连接工具、文件和 API
  • 多 Agent 系统 – 能够协作、委派并共同解决复杂任务的 Agent

编码 Agent

Dexto 内置了一个可用于生产环境的编码 Agent,你可以立即通过 CLI 或 Web UI 使用。

# Launch the coding agent (default)
dexto

# Or explicitly
dexto --agent coding-agent

它可以做到:

  • 从零构建新应用
  • 在整个代码库中读取、编写和重构代码
  • 执行 Shell 命令并运行测试
  • 启动专用子 Agent 进行探索和规划
  • 通过持久化记忆,在不同会话间记住上下文
  • 使用 50 多种大模型(可在对话中途更换模型)

可直接使用的界面:

  • Web UI – 聊天界面支持文件上传、语法高亮和 MCP 工具浏览器
  • CLI – 原生终端体验,支持 /commands、流式输出和会话管理

编码 Agent 只是你可以构建的一种示例。通过定义 YAML 配置创建自己的 Agent,架构相同,领域由你决定。


快速开始

安装
# macOS / Linux / WSL (native installer, recommended)
curl -fsSL https://dexto.ai/install | bash

# Windows PowerShell
irm https://dexto.ai/install.ps1 | iex

# Or build from source
git clone https://github.com/truffle-ai/dexto.git
cd dexto && pnpm install && pnpm install-cli

升级、卸载和迁移故障排除说明请参阅文档:

运行
# Start Dexto (launches setup wizard on first run)
dexto

更多选项:

dexto --mode cli                                   # Terminal mode
dexto -p "create a landing page for a coffee shop" # One-shot task
dexto --auto-approve "refactor this codebase"      # Skip confirmations
dexto -m claude-sonnet-4-5-20250929                # Switch models
dexto --help                                       # Explore all options

在交互式 CLI 中,输入 / 可浏览命令——切换模型、管理会话、配置工具等。

管理设置
# Configure defaults like LLM provider/model, API keys, or download local models
dexto setup

日志存储在 ~/.dexto/logs/ 中。使用 DEXTO_LOG_LEVEL=debug 可输出详细日志。


核心功能

50+ 个大模型,即时切换

在对话中途切换模型——无需更改代码或重启。

提供商模型
OpenAIgpt-5.2, gpt-5.2-pro, gpt-5.2-codex, o4-mini
AnthropicClaude Sonnet, Opus, Haiku(支持扩展思考)
GoogleGemini 3 Pro, 2.5 Pro/Flash
GroqLlama 4, Qwen, DeepSeek
xAIGrok 4, Grok 3
本地Ollama、通过 node-llama-cpp 使用 GGUF(Llama、Qwen、Mistral 等)
+ 网关OpenRouter、AWS Bedrock、Vertex AI、LiteLLM

在本地运行,保护隐私:本地模型会将数据保留在你的设备上,并自动检测 GPU(Metal、CUDA、Vulkan)。

MCP 集成(30+ 个工具)

连接到 Model Context Protocol 服务——Puppeteer、Linear、ElevenLabs、Firecrawl、Sora 等。

# agents/my-agent.yml
mcpServers:
  filesystem:
    type: stdio
    command: npx
    args: ['-y', '@modelcontextprotocol/server-filesystem', '.']
  browser:
    type: stdio
    command: npx
    args: ['-y', '@anthropics/mcp-server-puppeteer']

你可以在 Web UI 中通过 MCP Store 浏览并添加服务,也可以在 CLI 中使用 /mcp 命令。

人工参与控制

精细控制 Agent 可以执行的操作:

permissions:
  mode: manual           # Require approval for each tool
  # mode: auto-approve   # Trust mode for local development
  toolPolicies:
    alwaysAllow:
      - mcp--filesystem--read_file
      - mcp--filesystem--list_directory

Agent 会记住你在每个会话中批准过哪些工具。

持久会话与记忆

对话会在重启后保留。创建记忆来塑造 Agent 的行为。

# Continue last conversation
dexto -c

# Resume specific session
dexto -r session-abc123

# Search across all conversations
dexto search "database schema"
多 Agent 系统

Agent 可以启动专用子 Agent 来处理复杂子任务。编码 Agent 会使用此功能委派探索工作:

# In your agent config
tools:
  - type: agent-spawner
    allowedAgents: ["explore-agent"]
    maxConcurrentAgents: 5
    defaultTimeout: 300000  # 5 minutes

内置子 Agent:

  • explore-agent – 快速、只读地探索代码库

Agent Registry 中的任何 Agent 都可以作为子 Agent 启动,包括你创建并注册的自定义 Agent。

子 Agent 会临时运行,完成后自动清理,并将工具审批请求转发给父 Agent——因此用户只需经过统一的审批流程。


运行模式

模式命令使用场景
Web UIdexto支持文件上传的聊天界面(默认)
CLIdexto --mode cli终端交互
Web 服务dexto --mode serverREST 和 SSE API
MCP 服务dexto --mode mcp通过 stdio 将 Agent 作为 MCP 服务公开

平台集成:Discord、Telegram

将 Dexto 用作 MCP 服务

传输方式:stdio

在 Claude Code 或 Cursor 中将 Dexto Agent 连接为 MCP 服务:

dexto --mode mcp --auto-approve --no-elicitation                # Default agent
dexto --mode mcp --agent coding-agent --auto-approve --no-elicitation
npx dexto --mode mcp --agent coding-agent --auto-approve --no-elicitation

Claude Code 或 Cursor 的 MCP 配置示例:

{
  "command": "npx",
  "args": ["-y", "dexto", "--mode", "mcp", "--agent", "coding-agent", "--auto-approve", "--no-elicitation"]
}

MCP 模式以非交互方式运行,因此必须使用 --auto-approve 和 --no-elicitation。

传输方式:http/sse

dexto --mode server 会在 /mcp 上将你的 Agent 作为 MCP 服务公开,供远程客户端使用:

dexto --mode server --port 3001
ngrok http 3001  # Optional: expose publicly

Dexto Agents SDK

以编程方式构建 AI Agent。CLI 能做的一切,你也可以通过代码实现。

npm install @dexto/core
import { DextoAgent } from '@dexto/core';

const agent = new DextoAgent({
  llm: { provider: 'openai', model: 'gpt-5.2', apiKey: process.env.OPENAI_API_KEY }
});
await agent.start();

const session = await agent.createSession();
const response = await agent.generate('What is TypeScript?', session.id);
console.log(response.content);

// Streaming
for await (const event of await agent.stream('Write a story', session.id)) {
  if (event.name === 'llm:chunk') process.stdout.write(event.content);
}

// Multimodal
await agent.generate([
  { type: 'text', text: 'Describe this image' },
  { type: 'image', image: base64Data, mimeType: 'image/png' }
], session.id);

// Switch models mid-conversation
await agent.switchLLM({ model: 'claude-sonnet-4-5-20250929' });

以编程方式启动服务:

以编程方式启动 Dexto 服务,公开 REST 和 SSE 流式 API,以便与 Agent 后端交互并对其进行管理。

import { DextoAgent } from '@dexto/core';
import { loadAgentConfig, startHonoApiServer } from 'dexto';

const config = await loadAgentConfig('./agents/my-agent.yml');
const agent = new DextoAgent(config);
const { server } = await startHonoApiServer(agent, 3001);
// POST /api/message, GET /api/sessions, etc.

这会启动一个具备完整 REST 和 SSE API 的 HTTP 服务,可与 Web 前端、Webhook 和其他服务集成。有关可用端点,请参阅 REST API 文档。

SDK 高级用法
会话管理

创建并管理多个具有持久化存储的对话会话。

const agent = new DextoAgent(config);
await agent.start();

// Create and manage sessions
const session = await agent.createSession('user-123');
await agent.generate('Hello, how can you help me?', session.id);

// List and manage sessions
const sessions = await agent.listSessions();
const history = await agent.getSessionHistory('user-123');
await agent.deleteSession('user-123');

// Search across conversations
const results = await agent.searchMessages('bug fix', { limit: 10 });
大模型管理

动态切换模型和提供商。

// Get current configuration
const currentLLM = agent.getCurrentLLMConfig();

// Switch models (provider inferred automatically)
await agent.switchLLM({ model: 'gpt-5.2' });
await agent.switchLLM({ model: 'claude-sonnet-4-5-20250929' });

// Switch model for a specific session
await agent.switchLLM({ model: 'gpt-5.2' }, 'session-123');

// Get supported providers and models
const providers = agent.getSupportedProviders();
const models = agent.getSupportedModels();
MCP 管理器

如需高级 MCP 服务管理,请直接使用 MCPManager。

import { MCPManager } from '@dexto/core';

const manager = new MCPManager();

// Connect to MCP servers
await manager.connectServer('filesystem', {
  type: 'stdio',
  command: 'npx',
  args: ['-y', '@modelcontextprotocol/server-filesystem', '.']
});

// Access tools, prompts, and resources
const tools = await manager.getAllTools();
const prompts = await manager.getAllPrompts();
const resources = await manager.getAllResources();

// Execute tools
const result = await manager.executeTool('readFile', { path: './README.md' });

await manager.disconnectAll();
### 存储与持久化

配置生产环境使用的存储后端。

# agents/production-agent.yml
storage:
  cache:
    type: redis
    url: $REDIS_URL
  database:
    type: postgres
    connectionString: $POSTGRES_CONNECTION_STRING

sessions:
  maxSessions: 1000
  sessionTTL: 86400000  # 24 hours

支持的后端:

  • 缓存:Redis、内存
  • 数据库:PostgreSQL、SQLite、内存

详情请参阅存储配置指南。


Agent 注册表

适用于常见用例的预构建 Agent:

# List available agents
dexto agents list

# Install and run
dexto agents install coding-agent podcast-agent
dexto --agent coding-agent

**可用项:**编码、播客、图像编辑器、视频(Sora)、数据库、GitHub、分流(多 Agent)等。

请参阅完整的 Agent 注册表。


Agent 配置

Dexto 会将每项配置视为唯一的 Agent,让你根据需求定义并保存 LLM、服务、存储选项等组合,以便轻松迁移。通过受版本控制的 YAML 定义 Agent。修改文件、重新加载并开始聊天——状态、记忆和工具都会自动更新。

# agents/production-agent.yml
llm:
  provider: anthropic
  model: claude-sonnet-4-5-20250929
  apiKey: $ANTHROPIC_API_KEY

mcpServers:
  filesystem:
    type: stdio
    command: npx
    args: ['-y', '@modelcontextprotocol/server-filesystem', '.']

systemPrompt: |
  You are a helpful assistant with filesystem access.

storage:
  cache:
    type: redis
    url: $REDIS_URL
  database:
    type: postgres
    connectionString: $POSTGRES_CONNECTION_STRING

permissions:
  mode: manual
LLM 提供商

即时切换提供商,无需修改代码。

内置提供商
提供商模型设置
OpenAIgpt-5.2、gpt-5.2-pro、gpt-5.2-codex、o4-miniAPI 密钥
Anthropicclaude-sonnet-4-5-20250929、claude-opus-4-5-20250929、扩展思考API 密钥
Googlegemini-3-pro、gemini-2.5-pro、gemini-2.5-flashAPI 密钥
Groqllama-4-scout、qwen-qwq、deepseek-r1-distillAPI 密钥
xAIgrok-4、grok-3、grok-3-fastAPI 密钥
Coherecommand-r-plus、command-rAPI 密钥
本地模型(隐私优先)
提供商模型设置
OllamaLlama、Qwen、Mistral、DeepSeek 等本地安装
node-llama-cpp任意 GGUF 模型已打包(自动检测 GPU:Metal、CUDA、Vulkan)
云平台
提供商模型设置
AWS BedrockClaude、Llama、MistralAWS 凭据
Google Vertex AIGemini、ClaudeGCP 凭据
网关提供商
提供商访问权限设置
OpenRouter来自多个提供商的 100 多个模型API 密钥
LiteLLM适用于任意提供商的统一 API可自托管或使用 API 密钥
Glama多提供商网关API 密钥
# Switch models via CLI
dexto -m claude-sonnet-4-5-20250929
dexto -m gemini-2.5-pro
dexto -m llama-4-scout

可在交互式 CLI(/model)或 Web UI 中切换,无需修改配置。

请参阅配置指南。


演示与示例

图像编辑器MCP 商店可移植 Agent
图像编辑器MCP 商店可移植 Agent
使用 OpenCV 进行人脸检测与标注浏览并添加 MCP通过 MCP 在 Cursor、Claude Code 中使用 Agent
更多示例
编码 Agent

通过自然语言构建应用:

dexto --agent coding-agent
# "Create a snake game and open it in the browser"
编码 Agent 演示
播客 Agent

生成多说话人的音频内容:

dexto --agent podcast-agent
播客 Agent 演示
多 Agent 分流

协调专用 Agent:

dexto --agent triage-agent
分流 Agent 演示
记忆系统

塑造行为的持久上下文: 记忆演示

动态表单

Agent 生成用于结构化输入的表单: 用户表单演示

浏览器自动化
亚马逊购物演示 ### MCP Playground 部署前测试工具: Playground 演示

命令行参考
Usage: dexto [options] [command] [prompt...]

Basic Usage:
  dexto                    Start web UI (default)
  dexto "query"            Run one-shot query
  dexto --mode cli         Interactive CLI

Session Management:
  dexto -c                 Continue last conversation
  dexto -r <id>            Resume specific session

Options:
  -a, --agent <path>       Agent config file or ID
  -m, --model <model>      LLM model to use
  --auto-approve           Skip tool confirmations
  --no-elicitation         Disable elicitation prompts
  --mode <mode>            web | cli | server | mcp
  --port <port>            Server port

Commands:
  setup                    Configure global preferences
  deploy                   Deploy current workspace to cloud
  agents install <agents...>  Install agents from registry
  agents list              List available agents
  session list|history     Manage sessions
  search <query>           Search conversation history

完整参考:dexto --help


文档


遥测

我们会收集匿名使用数据(不含个人或敏感信息),以帮助改进 Dexto。数据包括:

  • 使用的命令
  • 命令执行时间
  • 错误发生情况
  • 系统信息(操作系统、Node 版本)
  • 使用的大模型

如需选择退出:

设置环境变量 DEXTO_ANALYTICS_DISABLED=1


贡献

请参阅 CONTRIBUTING.md。


社区

由 Truffle AI 构建。加入 Discord 获取支持。

如果你觉得 Dexto 很有用,请在 GitHub 上给我们一个 ⭐——这对我们帮助很大!

Twitter 关注 Twitter 关注 Twitter 关注


贡献者

贡献者


许可证

Elastic License 2.0。请参阅 LICENSE。

评论

支持 Markdown

第一次接触 MCP?

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

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