Agent sessions now run long enough that users expect to start work in one place and resume it somewhere else. That continuity is hard to deliver while the agent lives inside a single application: close a window and the session ends, restart the editor and every agent stops with it. The Agent Host Protocol (AHP) is an open standard created in VS Code and adopted across GitHub to make sessions portable between clients.
The limits of per-client integrations
Copilot began as a VS Code extension bundling its own harness, which made agents easy to reach but tied them to the editor's lifecycle. Extensions belong to a single window, so closing that window discards the agent; a VS Code update restarts every agent with the application; and a remote connection produces a new extension host locked to the installed workbench version. Meanwhile the Copilot app and the existing GitHub mobile apps for iOS and Android each built their own integration with cloud-based agents.
Those integrations each solved one product's problem, but developers wanting agents inside their own editors, terminals, phones or custom tools would otherwise need a bespoke integration per client. A shared, independently versioned protocol lets every client see the same agents, history and state, instead of inheriting one application's definition of a session.
Protocol design
AHP targets several clients interacting with the same agents at once — a session started from a phone in the cloud and continued on a laptop — and must survive network interruptions, reconnections and concurrent mutations from different clients, while remaining capable enough for real work on any client.
Deliberately, it stays out of agent behavior. The domains behind the Language Server Protocol and the Debug Adapter Protocol were comparatively settled; agent implementations are evolving quickly, so AHP encodes how users want to interact with agents rather than how agents inside work. The full feature set is extensive, but the core is kept minimal so it can be implemented in a custom client or server.
Functionality is organized around URI-identified channels, the protocol's coarsest unit. Servers must implement the root, session and chat channels, and may add further channels for terminal support, MCP additions or OTel reporting. Each channel contains a reducer-based state object that drives most client logic: the server arbitrates state, and clients send sequences of actions that either mutate that state or trigger side effects such as sending a chat message. This design makes reconnection straightforward — a client replays queued actions, shows the correct loading state, and waits for the server to reconcile and acknowledge before confirming — makes both sides easy to debug, and suits UI frameworks such as React.

Two implementations as an acid test
Bringing AHP to VS Code required a new harness and agentic stack. The Copilot Chat extension had grown past 400,000 lines of TypeScript excluding tests over more than three years and was built around the lifecycle of a VS Code window and the extension API — neither available to a standalone agent host process. When work on AHP began in early 2026, the Copilot SDK was also in development and became the foundation for the new stack. Building a harness that says hello and edits files came quickly; covering the long tail of expected Copilot Chat features was the harder part.

GitHub had offered cloud agents for a couple of years and wanted to extend that to coordinating sessions on users' own devices through the Copilot app, as well as in cloud sandboxes. That is the N:M problem AHP exists to solve, so GitHub adopted the same technology. Its requirements differed from VS Code's: VS Code runs the host locally, can place it on other compute over SSH, containers, WSL or Dev Tunnels, and ships it in the VS Code Server bundle, whereas the GitHub host runs in the cloud across far more infrastructure and tighter security constraints. Hence two implementations: TypeScript in VS Code, Rust on the GitHub side.
The split has served as a test of whether the protocol holds up when two independent teams and agent sets implement it separately. Both sides used escape hatches similar to MCP's — custom methods and _metadata for out-of-band signaling — and when unification began, the first job was inventorying each implementation's extensions. Some, such as the GitHub host linking to project boards through metadata, stay GitHub-specific. Some exposed protocol gaps: early versions could not accurately represent shell-type tool output not backed by a PTY. Others were simply bad assumptions, such as VS Code's client presuming a particular structure for session URIs received from the host. Teaching the clients and servers to interoperate is what turned AHP from a portable protocol in theory into one in practice.

Availability and use
Agent sessions in the GitHub Copilot app locally, in cloud sandboxes and in VS Code now share the same underlying protocol. Libraries are published for Rust, TypeScript, Kotlin, Swift, .NET and Go, and agents can write clients and servers with little prompting; the protocol has been used for everything from a desk macropad reflecting agent state in real time to smart watch apps and Kanban-style task tools.
To try it, connect to a host you implement: in the Copilot app enable Experimental > Direct Connections, then use Environments > Add Agent Host Protocol Host; in VS Code use Add Remote Agent Host in the Agents window. A standalone instance of VS Code's agent host can be started with code agent host, and endpoints for the host inside the editor are listed by code agent endpoints. Samples are provided to help developers and their agents get started, and the project accepts questions and suggestions on GitHub.



