我按“核心架构”与“Agent 编排逻辑”分层解读两库,并在最后给出异同点对照与可继续深入的方向。
agentgateway 核心架构
- 配置分三层:静态/本地/xDS,最终都映射到同一内部表示(IR)供运行时使用,强调“用户 API ↔ xDS ↔ IR”一一对应与运行时合并策略(
repos/agentgateway/architecture/configuration.md)。 - 启动入口把控制面/数据面拆开:state manager 负责 xDS/本地配置注入 stores,网关与管理面(admin/metrics/readiness)在独立任务池运行(
repos/agentgateway/crates/agentgateway/src/app.rs)。 - 状态管理器既支持 xDS 订阅,也支持本地配置文件热更新并同步到 binds/discovery stores(
repos/agentgateway/crates/agentgateway/src/state_manager.rs)。 - 数据面网关监听 binds,动态创建 listener/bind 的网络端点并驱动代理链路(
repos/agentgateway/crates/agentgateway/src/proxy/gateway.rs)。 - 核心是“代理+策略+多协议接入”的数据平面:MCP/A2A/HTTP/OpenAPI 等以统一代理能力连接与治理。
agentgateway 的 Agent 编排逻辑(偏“协议层编排/路由/聚合”)
- MCP 入口按后端策略构建上下文、执行认证(JWT)、并在 SSE/Streamable HTTP 之间选择分发路径(
repos/agentgateway/crates/agentgateway/src/mcp/router.rs)。 - Relay 把多个 MCP 目标组织为 UpstreamGroup,负责 fan‑out 与结果合并(tools/prompts/resources 合并、资源名前缀多路复用、RBAC 过滤)(
repos/agentgateway/crates/agentgateway/src/mcp/handler.rs)。 - Session 层负责“状态化/无状态”会话编排:请求 fan‑out、响应 merge、会话恢复与编码、以及在多目标场景下的路由限制(
repos/agentgateway/crates/agentgateway/src/mcp/session.rs)。 - UpstreamGroup 按 target spec 建立具体传输:MCP streamable、SSE、stdio、OpenAPI‑to‑MCP 转换(
repos/agentgateway/crates/agentgateway/src/mcp/upstream/mod.rs)。 - 关键特征是“协议级编排”:不是推理/规划,而是多 MCP 服务的聚合、授权过滤、命名空间路由与会话管理。
omni-dev-fusion 核心架构
- 微内核(Kernel)统一生命周期、组件注册、技能发现/加载、路由与热更新(
repos/omni-dev-fusion/packages/python/core/src/omni/core/kernel/engine.py)。 - 技能体系是“Zero‑Code + 脚本加载 + SKILL 元数据”,技能目录结构与执行流定义在架构文档中(
repos/omni-dev-fusion/docs/architecture/skills.md)。 - MCP Server 是轻量适配层:把 Kernel 的 skill context 暴露成 MCP tools list/call(
repos/omni-dev-fusion/packages/python/agent/src/omni/agent/server.py)。 - “Cortex Router” 提供语义路由能力(向量检索/显式指令/上下文嗅探),用于把自然语言映射到 skill.command(
repos/omni-dev-fusion/docs/architecture/router.md)。
omni-dev-fusion 的 Agent 编排逻辑(偏“意图路由/技能调度”)
- OmniRouter 作为统一入口,HiveRouter 做显式匹配→语义路由→上下文兜底的决策链(
repos/omni-dev-fusion/packages/python/core/src/omni/core/router/main.py,repos/omni-dev-fusion/packages/python/core/src/omni/core/router/hive.py)。 - SemanticRouter 通过 SkillIndexer 的向量检索将自然语言映射为 skill.command(
repos/omni-dev-fusion/packages/python/core/src/omni/core/router/router.py)。 - Kernel 提供统一的执行入口与权限门控(execute_tool),是技能间/代理到技能调用的中心(
repos/omni-dev-fusion/packages/python/core/src/omni/core/kernel/engine.py)。 - MCP handler 只做工具暴露与调用转发,没有多后端聚合逻辑(
repos/omni-dev-fusion/packages/python/agent/src/omni/agent/server.py)。
相同点
- 都围绕 MCP 做工具暴露与调用:agentgateway 作为 MCP gateway,omni-dev-fusion 作为 MCP server(
repos/agentgateway/crates/agentgateway/src/mcp/router.rs,repos/omni-dev-fusion/packages/python/agent/src/omni/agent/server.py)。 - 都支持 SSE/stdio 等 MCP 传输形态(
repos/agentgateway/crates/agentgateway/src/mcp/upstream/mod.rs,repos/omni-dev-fusion/packages/python/agent/src/omni/agent/mcp_server/server.py)。 - 都内建安全/治理:agentgateway 用 JWT+RBAC 做 MCP 级别授权,omni-dev-fusion 用 Kernel 安全门控执行工具(
repos/agentgateway/crates/agentgateway/src/mcp/router.rs,repos/omni-dev-fusion/packages/python/core/src/omni/core/kernel/engine.py)。 - 都支持动态变化:agentgateway 的配置热更新与 xDS,omni-dev-fusion 的技能热加载(
repos/agentgateway/crates/agentgateway/src/state_manager.rs,repos/omni-dev-fusion/packages/python/core/src/omni/core/kernel/engine.py)。
关键差异
- 角色定位不同:agentgateway 是数据平面网关/代理,面向“跨 agent/工具的连接与治理”;omni-dev-fusion 是“单体 agent 框架”,面向技能调度与任务执行。
- 编排层次不同:agentgateway 是协议层编排(fan‑out/merge/多目标命名空间路由),omni-dev-fusion 是语义层编排(意图→技能→命令)。
- 配置源不同:agentgateway 依赖 xDS/本地配置生成 binds/routes/policies;omni-dev-fusion 依赖 skill 目录与扫描索引驱动能力图谱。
- 会话语义不同:agentgateway 维护跨后端 MCP 会话状态与恢复;omni-dev-fusion 主要维护对话上下文与技能运行态。
- 扩展策略不同:agentgateway 能把 OpenAPI 转成 MCP 资源并统一聚合;omni-dev-fusion 通过技能扩展功能而非协议级代理。
如果你想更深入,我可以继续:
- 画一条“请求从客户端→agentgateway→多 MCP 后端→合并响应”的时序图;
- 选定 omni-dev-fusion 的某条“语义路由→Kernel 执行→MCP 返回”的完整调用链;
- 对比两者在认证/授权策略上的具体差异与边界条件。