# GitHub's Agent Host Protocol: one agent session that follows you across devices


GitHub published the engineering write-up for the Agent Host Protocol (AHP) yesterday, and if you build agents or agent tooling, this is the piece of infrastructure thinking worth stealing. The problem it solves is concrete: your coding agent runs for hours, but it lives inside one editor window, and closing that window kills it. AHP is the open standard that lets a session start on your phone, get a tool approval from your watch, and land a pull request from a cloud agent, all as one continuous session. The protocol spec and client libraries are MIT-licensed on GitHub, and GitHub runs two independent host implementations in production today. This is a vendor engineering blog, so adoption claims are theirs; the design lessons below are the durable part.

## The problem: one integration per client stopped scaling

Copilot was born as a VS Code extension that bundled its own harness. That architecture tied the agent's lifetime to the editor window: close the window and the agent dies, update VS Code and every agent stops with the restart, connect to a remote machine and you get a separate extension host. Meanwhile the Copilot app, the iOS and Android apps, and GitHub's cloud agents each built their own distinct integration toward the same goal of session continuity.

That is the classic N:M problem: N clients times M agent runtimes means bespoke plumbing everywhere, and third parties cannot join at all. If every client needs its own integration, nobody can pull agents into their own terminal, phone app, or internal tool. GitHub's answer is the same answer LSP gave to language servers and DAP gave to debuggers: a standard, independently versioned protocol between clients and the thing that hosts the work.

## How AHP works: channels, reducers, and a server that arbitrates

The design has three ideas worth understanding.

#### Channels are the coarsest unit

The protocol is oriented around URI-identified channels. Every server must implement the root, session, and chat channels; optional channels add terminal support, MCP additions, or OpenTelemetry reporting. A minimal implementation is genuinely minimal, and richer hosts advertise more channels.

#### Reducer-based state makes sync boring

Within each channel, a reducer-based state object drives most client logic. The server is the arbiter of state. Each client sends a sequence of actions that either mutate state or trigger side effects like sending a chat message. This gives you the hard parts for free: reconnection and replay on bad networks means the client sends its queued actions, shows a loading state, and waits for the server to reconcile and acknowledge before confirming. It also makes clients and servers straightforward to debug, and it maps naturally onto React-style UI frameworks.

#### The protocol stays out of agent behavior

Unlike languages and debuggers, agent internals are evolving weekly. AHP deliberately avoids encoding how agents work and focuses only on how clients interact with them. Like MCP, it provides escape hatches through custom methods and _meta fields on objects for out-of-band signaling, which is where implementation-specific features live.

## Two hosts in two languages as the acid test

The most credible part of the story is what happened when two teams implemented the protocol independently. VS Code's agent host is written in TypeScript (about 369,000 lines), GitHub's cloud agent host in Rust (about 305,000 lines). The old Copilot Chat extension they are replacing had grown to roughly 415,000 lines of TypeScript over three years, structured entirely around the VS Code window lifecycle.

When the two teams came to unify, they inventoried how each implementation had extended the protocol. Some extensions were legitimately product-specific (GitHub's host links sessions to project boards through metadata). Some exposed real gaps: early protocol versions could not represent shell-type tool output that was not backed by a PTY. And some were bad assumptions, like VS Code's client assuming a particular structure for session URIs. Their conclusion is the one every protocol designer learns the hard way: a protocol with one implementation is not portable, it is just an API.

## Using AHP yourself

Client libraries ship in six languages: Rust (ahp crates), TypeScript (@microsoft/agent-host-protocol on npm), Kotlin (Maven Central), Go, Swift (SwiftPM), and .NET (NuGet). The Rust, Swift, Go, and .NET SDKs include a MultiHostClient for talking to several hosts at once. The spec repo (microsoft/agent-host-protocol) is MIT-licensed, about 460 stars, created in March 2026, with the spec under docs/specification.

Connection points today: the Copilot app (enable Experimental, Direct Connections, then Environments, Add Agent Host Protocol Host) and VS Code (Add Remote Agent Host in the Agents window). You can spawn VS Code's agent host standalone with `code agent host` and inspect your editor's endpoints with `code agent endpoints`. A CLI client called AHPX exists as well.

The authors mention what people have built against it internally: a macropad that reflects agent state in real time, smart watch apps, Kanban-style task boards. Those are employee projects, not an ecosystem, but they show the intended shape: small clients that render and steer sessions, with the host doing the heavy lifting.

## Why this matters if you build agents

Session continuity is quietly becoming the default expectation for coding agents, the same way LSP made language support table stakes for editors. If your agent runs for hours, your users will expect to approve a tool call from their phone. You can build that continuity yourself per client, or you can adopt a protocol that already solved reconnection, replay, and concurrent mutation. The honest caveat: today AHP's production hosts are both Microsoft properties, the spec is young (versioned separately, still finding gaps like the PTY case), and building on it ties your roadmap to a protocol governed by one company's two teams. Watch whether a third-party host appears; that is the moment AHP becomes a real standard rather than a shared internal API with a docs site.

## What I could not verify

All production claims come from GitHub's own engineering post: the line counts, the five clients and two hosts, the internal tools built against AHP, and the framing that session continuity works seamlessly across surfaces today. I did not connect a client to a host myself. The repo numbers (stars, issues, creation date, license) I verified directly on GitHub. Whether AHP's abstractions hold up for non-Copilot agents with very different tool models is an open question the blog does not address.

## Frequently asked questions

### Is the Agent Host Protocol open source?

Yes. The specification and all six client libraries live at microsoft/agent-host-protocol under the MIT license. GitHub explicitly invites questions and suggestions on the repo.

### Does AHP only work with GitHub Copilot?

Today the production hosts are VS Code's agent host and GitHub's cloud agent host, both Copilot surfaces. The protocol itself is agent-agnostic by design: it defines channels, state, and actions, not agent behavior, so in principle any agent runtime can sit behind an AHP host.

### How is AHP different from MCP?

They solve different layers. MCP connects an agent to tools and data sources. AHP connects clients to the agent host that runs sessions, covering state sync, history, reconnection, and multi-client access. AHP even offers an optional channel for MCP additions, and it borrows MCP's _meta escape-hatch pattern.

### What happens when a client disconnects?

The session keeps running on the host. When the client reconnects, it replays its queued actions, the server reconciles them against the authoritative state, acknowledges them, and the client renders the result. Concurrent edits from multiple clients are arbitrated by the server the same way.

### Which languages have AHP client libraries?

Rust, TypeScript, Kotlin, Swift, .NET, and Go. The Rust, Swift, Go, and .NET SDKs also ship a MultiHostClient for connecting to two or more hosts simultaneously.

### Can I run an agent host without VS Code?

Yes. Running `code agent host` in a terminal spawns VS Code's agent host as a standalone process, and GitHub's host runs in the cloud. You can also implement your own host against the spec; the required surface is just the root, session, and chat channels.

### Should I build on AHP now?

If you build agent tooling in the Microsoft ecosystem or want multi-device sessions without inventing sync, yes, the libraries are stable enough to prototype with. If you need a vendor-neutral standard, wait: adoption beyond GitHub's own hosts is the missing proof, and the spec is still young enough to have gaps found by its own second implementation.

## Sources

- [Building the Agent Host Protocol (GitHub Blog)](https://github.blog/engineering/engineering-principles/building-the-agent-host-protocol-for-sessions-that-continue-across-devices/)
- [microsoft/agent-host-protocol on GitHub](https://github.com/microsoft/agent-host-protocol/)
- [AHP specification overview](https://github.com/microsoft/agent-host-protocol/blob/main/docs/specification/overview.md)
