将智能决策与执行分离,让大模型任务只需一次思考就能高效重复执行。
Separating Intelligence from Execution: A Workflow Engine for the Model Context Protocol

- 用声明式工作流蓝图替代每次推理,减少重复计算。
- 单次执行仅消耗1次调用令牌,成本降低99%以上。
- 适合需要频繁重复执行复杂任务的生产系统场景。
大型语言模型(LLM)代理通过工具调用协议(如模型上下文协议,MCP)与外部系统交互。现有架构中,代理需在每个会话中为每次工具调用重新推理,消耗与操作次数成比例的令牌——即使任务已解决过。我们提出MCP工作流引擎,一种原生支持MCP的编排层,将智能决策(决定做什么)与执行(如何执行)解耦。代理仅需一次推理生成声明式工作流蓝图——一个包含参数化模板、循环、并行分支和数据传递的JSON文档。后续执行仅需调用single run_workflow工具,无论蓝图复杂度如何,均只消耗一次调用的令牌。我们形式化了MCP中介者架构模式——一个同时作为下游MCP服务器客户端的MCP服务器,并使用TypeScript基于MCP SDK实现。在涵盖67个协调步骤、2个MCP服务器、38个命名空间、13个工作节点和22种资源类型的生产级Kubernetes CMDB同步任务上评估,引擎将每次执行的令牌成本降低超过99%,在45秒内完成包含1,200+节点和2,800+关系(跨20种关系类型)的完整集群图谱,且实现确定性、幂等性执行,运行时无需代理参与。
原文摘要 · Abstract (English)
Large Language Model (LLM) agents increasingly interact with external systems through tool-calling protocols such as the Model Context Protocol (MCP). In prevailing architectures, the agent must reason about every tool invocation in every session, consuming tokens proportional to the number of actions performed--even when the task has been solved before. We present the MCP Workflow Engine, a novel MCP-native orchestration layer that decouples intelligence (deciding what to do) from execution (carrying it out). An agent reasons once to produce a declarative workflow blueprint--a JSON document specifying a directed sequence of MCP tool calls with parameterized templates, loops, parallel branches, and data piping. Subsequent executions are triggered by a single run_workflow tool call, consuming one invocation's worth of tokens regardless of the blueprint's internal complexity. We formalize the MCP Mediator architectural pattern--an MCP server that simultaneously acts as a client to downstream MCP servers--and implement it in TypeScript against the MCP SDK. We evaluate the engine on a production-scale Kubernetes CMDB synchronization task spanning 67 orchestrated steps across 2 MCP servers, 38 namespaces, 13 worker nodes, and 22 distinct resource types. The engine reduces per-execution token cost by over 99%, completes the full cluster graph--comprising 1,200+ nodes and 2,800+ relationships across 20 relationship types--in under 45 seconds, and achieves deterministic, idempotent execution with zero agent involvement at run time.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。