跳转到内容

ACP 协议

Agent Client Protocol (ACP) 适配器通过官方 agent-client-protocol Rust SDK, 把 Awaken runtime 暴露为 stdio 进程集成。和 HTTP 协议不同,ACP 由宿主启动 Awaken-backed 进程,然后通过 stdin/stdout 交换 ACP JSON-RPC 消息。

Feature gateserver

API用途
awaken_server::protocols::acp::stdio::serve_stdio(runtime)在进程 stdin/stdout 上提供 ACP。
awaken_server::protocols::acp::stdio::serve_stdio_io(runtime, input, output)使用调用方提供的 async I/O 提供 ACP;测试和嵌入场景使用。
awaken_server::protocols::acp::encoder::AcpEncoderAgentEvent 转码为 ACP session update。
  • initialize 返回请求的协议版本、awaken-acp agent info,以及 text、image、audio、embedded-context prompt capability。
  • newSession 要求 cwd 是绝对路径。请求里的 mcpServers 会被拒绝;MCP server 应通过 Awaken 配置注册。
  • 如果存在 default agent,适配器会选择它;否则 runtime 必须只注册一个 agent。
  • 每个 ACP session 映射到一个新的 Awaken thread id。prompt 会把用户内容追加到该 thread,并通过 AgentRuntime 执行选中的 agent。
  • 工具权限请求会转发给 ACP client,并转换回 Awaken HITL resume decision。

ACP 背后仍是与其它协议适配器共用的 AgentRuntimeAgentEvent 流。 每个适配器会按自己的 wire 语义投影或收集这些事件;ACP 不引入新的 agent 执行路径。