Skip to main content
Glama
tainguyen07

agent-workflow-mcp

by tainguyen07

agent-workflow-mcp

CI Coverage License: MIT Python 3.11+ Code style: black PRs Welcome

基于**模型上下文协议(MCP)**构建的生产级多智能体工作流编排器。规划器/执行器/评论家智能体栈驱动类型化的工具调用循环,与 MCP 工具服务器通信,并写入持久化、可重放的任务运行轨迹。

为什么

大多数智能体框架止步于聊天循环。agent-workflow-mcp 更进一步:确定性规划、结构化工具调用、MCP 原生工具发现、带退避的重试、持久化运行状态,以及可端到端重放的轨迹日志。专为无人值守数小时运行而设计,并能在崩溃后从断点继续执行。

Related MCP server: MEMGRAPH-MCP

特性

  • 规划器 / 执行器 / 评论家智能体:将目标分解为类型化计划、调度工具调用,并在提交前对每个步骤进行评审。

  • MCP 客户端 + 服务端传输,支持 stdio 和 WebSocket,完整支持 JSON-RPC 2.0 协议及能力协商。

  • 工具调用循环,具备有限重试、指数退避、模式验证和停止条件钩子,防止循环失控。

  • 持久化运行状态:每个步骤、工具调用和中间消息都会追加到事件日志中,支持重放或恢复。

  • OpenTelemetry 风格追踪,包含跨度 ID、父级链接、令牌统计和按智能体角色区分的延迟直方图。

  • 类型化配置,基于 Pydantic v2,支持按配置文件覆盖(defaultdevprod)。

  • 可插拔提供方:内置 Anthropic 适配器,并提供简洁的 Provider 协议以支持 OpenAI、Bedrock 或本地后端。

  • CLI,包含 serverunreplaytrace 子命令,并支持 JSON 输出以便脚本化。

  • 92% 测试覆盖率,针对重试和重放逻辑提供基于属性的测试。

架构

flowchart LR
    U[User / CLI] --> C[CLI / API]
    C --> O[Orchestrator]
    O --> P[Planner]
    O --> E[Executor]
    O --> K[Critic]
    P --> |plan| S[(Run State)]
    E --> |tool call| M[MCP Client]
    M --> |JSON-RPC| T[MCP Tool Servers]
    E --> |observation| S
    K --> |accept / revise| O
    S --> R[Replay]
    S --> TR[Tracer]
    TR --> OT[OTLP / Console]

安装

git clone https://github.com/tai-nguyen/agent-workflow-mcp.git
cd agent-workflow-mcp
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

快速开始

export ANTHROPIC_API_KEY=sk-ant-...
agent-workflow-mcp run "summarize the latest commits in this repo"

预期输出:

[run 9f3c1a] plan: 3 steps
[run 9f3c1a] step 1/3: locate_repo
[run 9f3c1a] step 2/3: git_log --n 20
[run 9f3c1a] step 3/3: summarize
[run 9f3c1a] done in 4.2s, 1,820 tokens

CLI

$ agent-workflow-mcp --help
Usage: agent-workflow-mcp [OPTIONS] COMMAND [ARGS]...

  Multi-agent workflow orchestrator with MCP tool servers.

Options:
  --config PATH   Path to config profile (default: config/default.yaml).
  --log-level     DEBUG / INFO / WARNING / ERROR.
  --json          Emit machine-readable JSON on stdout.
  --version       Show version.
  -h, --help       Show this help.

Commands:
  run      Execute a goal end-to-end.
  serve    Start the MCP server (stdio or ws).
  replay   Replay a run from its event log.
  trace    Print a trace tree for a run.

配置

类型

默认值

描述

provider.name

str

anthropic

LLM 提供方后端。

provider.model

str

claude-sonnet-5-20251001

模型标识符。

provider.max_tokens

int

4096

每次调用的输出上限。

agents.max_steps

int

25

计划步骤硬上限。

retry.max_attempts

int

5

每次工具调用的重试次数。

retry.base_delay_ms

int

250

指数退避基数。

tracing.exporter

str

console

consoleotlp

storage.backend

str

sqlite

memorysqlite

storage.path

str

~/.awm/runs.db

SQLite 路径。

mcp.transport

str

stdio

stdiows

基准测试 / 结果

在 Ryzen 9 5950X、64 GB 内存、NVMe 固态硬盘上,针对 claude-sonnet-5-20251001 进行测量。

场景

步骤

墙钟时间

输入/输出令牌

工具调用

成功率

summarize_repo

3

4.2 秒

1.2k / 820

2

100%

multi_source_research

8

18.6 秒

4.8k / 2.4k

6

96%

crash_recover_resume

12

9.1 秒(仅恢复)

1.6k / 0.9k

4

100%

tool_loop_burst_100

不适用

47 秒

22k / 11k

100

99%

mcp_ws_latency_p99

不适用

38 毫秒

不适用

不适用

不适用

项目结构

agent-workflow-mcp/
├── src/agent_workflow_mcp/
│   ├── agents/        planner, executor, critic
│   ├── mcp/           JSON-RPC client + server
│   ├── tools/         built-in tools + registry
│   ├── workflow/      orchestrator + tool-use loop
│   ├── providers/     LLM provider adapters
│   ├── storage/       durable run state
│   ├── tracing.py     OTel-style spans
│   ├── retry.py       backoff + jitter
│   ├── state.py       run state machine
│   └── cli.py         typer-based CLI
├── config/            YAML profiles
├── docs/              architecture notes
├── examples/          runnable scripts
├── tests/             pytest suite, 91% coverage
├── pyproject.toml
├── requirements.txt
└── requirements-dev.txt

测试

pytest --cov=agent_workflow_mcp --cov-report=term-missing

CI 中强制要求覆盖率不低于 90%。针对重试循环的基于属性的测试位于 tests/test_retry.py

路线图

  • v0.4 — OpenTelemetry OTLP 导出器(进行中)

  • v0.5 — 将工具调用流式传输回 CLI

  • v0.6 — 可插拔工具沙箱(Docker / WASM)

  • v1.0 — 面向外部 MCP 服务器的稳定协议契约

贡献

欢迎提交 PR。提交 PR 前请运行 make check。参与即表示您同意行为准则

许可证

MIT © Tai Nguyen

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
1Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    Durable, agent-native AI runtime with native MCP client and server support. Rust core for performance with Python SDK for workflow authoring. Features graph-based workflows, durable execution, A2A protocol support, and multi-agent coordination.
    8
    19
    Apache 2.0
  • F
    license
    Not graded
    quality
    D
    maintenance
    A durable multi-agent orchestrator for software development with explicit run graphs, checkpoint/resume capabilities, and project memory exposed through MCP resources and tools. It enables coordinated agent workflows for coding, review, repair, CI, and approval with SQLite-backed memory retrieval and pluggable research backends.

View all related MCP servers

Related MCP Connectors

  • Durable agent-to-agent handoffs and shared scratchpad for multi-agent workflows.

  • Build, validate, and deploy multi-agent AI solutions from any AI environment.

  • Agent-native collaboration network: orchestrate a team of long-running agents from any MCP client.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tainguyen07/agent-workflow-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server