GitHub 详解支持跨设备延续代理会话的 Agent Host Protocol
GitHub 发布了一篇工程实践文章,详细介绍 Agent Host Protocol (AHP) 这一开放标准。它让 Copilot 代理会话可以在一处开始、在另一处继续,目前已在 VS Code、GitHub Copilot 应用和移动端应用中共用。
AHP 围绕以 URI 标识的通道组织:root、session、chat 为必选通道,terminal、MCP、OTel 等为可选通道,每个通道内是基于 reducer 的状态对象。服务器是状态的仲裁者,客户端发送动作序列,这使得弱网下的重连和回放变得简单,并与 React 等 UI 框架天然契合。该协议刻意不规定代理的工作方式,只关注客户端如何与代理交互。
实际落地中存在两个独立的宿主实现:VS Code 的 TypeScript 实现,基于 Copilot SDK 重建了此前超过 40 万行代码的 Copilot Chat 扩展;以及 GitHub 用 Rust 编写的云端宿主。团队表示,两个实现的差异暴露了早期协议版本的真实缺口,例如无法准确表示非 PTY 的 shell 输出。目前协议库覆盖 Rust、TypeScript、Kotlin、Swift、.NET 和 Go,可在 Copilot 应用和 VS Code 中接入自定义宿主,也可通过 `code agent host` 命令独立启动。
GitHub details the Agent Host Protocol for agent sessions that continue across devices
GitHub has published an engineering deep-dive into the Agent Host Protocol (AHP), the open standard that lets Copilot agent sessions start in one place and resume on another, now shared across VS Code, the GitHub Copilot app, and mobile apps.
AHP is organized around URI-identified channels (root, session, and chat are mandatory; terminal, MCP, and OTel are optional) with a reducer-based state object per channel. The server arbitrates state while clients send action sequences, which makes reconnection and replay on poor networks simple and works well with UI frameworks like React. The protocol deliberately avoids encoding how agents behave, focusing only on how clients interact with them.
In practice there are two independent hosts: VS Code's, written in TypeScript and built on the Copilot SDK after replacing the 400,000-line Copilot Chat extension, and GitHub's cloud host, written in Rust. The team says the divergence between the two exposed real gaps in early protocol versions, such as representing non-PTY shell output. Libraries exist for Rust, TypeScript, Kotlin, Swift, .NET, and Go, and the protocol can be connected to from the Copilot app and VS Code, or spawned standalone via the `code agent host` command.
猎鹰不保存原文正文。标题与摘要用于快速发现信息,事实细节请以来源原文为准。