Vibeleaderboard
← All Intel
Intel / blog

Building the Agent Host Protocol for sessions that continue across devices

Source
github.blog
Date

Context

GitHub Copilot sessions can now move between devices because the no longer lives inside the app you are looking at. In a GitHub engineering post, Connor Peet and Rob Lourens explain that Copilot began as a VS Code extension, which tied each agent to one editor window: closing the window ended the agent, and updating VS Code stopped every agent when the app restarted. Meanwhile the Copilot app and GitHub's mobile apps each built their own integration with cloud agents. The fix is the Agent Host Protocol (AHP), an open standard built first in VS Code. The agent runs in a separate host, locally or in the cloud, and any client that speaks the protocol sees the same agents, history and state. Sessions in the Copilot app, in cloud sandboxes and in VS Code now share that protocol, which underlies handoffs such as opening a Copilot app session in VS Code to carry on with it.

The protocol keeps the session's state on the server and has clients send changes to it. Its functionality is grouped into channels identified by URIs, and every server must implement three: root, session and chat. Optional channels can add terminals, tool connections or OpenTelemetry reporting. Each channel holds a state object updated by a reducer, a function that applies each incoming action to produce the next state. The server is the arbiter of that state, and clients send a sequence of actions that either change it or trigger something, such as sending a chat message. On a poor connection, a client resends its queued actions, shows a loading state and waits for the server to acknowledge them before treating them as done. The authors also kept the protocol out of agent behavior. Unlike the Language Server Protocol and Debug Adapter Protocol, which came from more settled domains, AHP describes how people interact with agents, not how agents work, because agents are changing quickly.

Two independent implementations tested whether the protocol is genuinely portable. VS Code's host is written in TypeScript and runs locally or on other machines over SSH, containers, WSL or Dev Tunnels, while GitHub's, built to run in the cloud across many environments, is in Rust. When the teams compared the extensions each had added, some stayed GitHub-specific, some exposed gaps (early versions could not represent shell output not backed by a pseudo-terminal, or PTY), and some revealed bad assumptions, such as VS Code's client expecting a particular structure in session URIs. Adopting the protocol in VS Code also meant replacing the Copilot Chat extension, which had grown past 400,000 lines of TypeScript, with a new agent stack built on the Copilot SDK.

Developers outside GitHub can build on it too. AHP libraries exist in Rust, TypeScript, Kotlin, Swift, .NET and Go, and a custom host can be added in the Copilot app behind an experimental setting or in VS Code through Add Remote Agent Host. The authors mention people building smart watch apps and Kanban-style task boards against it, which shows the intended use: a third-party app showing or steering the same agent session that Copilot's own apps use.

Key takeaways · AI-distilled
  • GitHub says the old design tied agents to the editor: Copilot ran as a VS Code extension bound to one window, so closing the window or updating VS Code stopped every agent, and remote connections got a separate extension host locked to the workbench version.
  • AHP is built from URI-identified channels, with root, session and chat required and extras such as terminal, MCP or OTel optional; each channel holds reducer-based state that the server arbitrates while clients send actions, which makes reconnection and replay straightforward.
  • Unlike the Language Server and Debug Adapter protocols, AHP deliberately avoids encoding how agents behave and only standardizes how users interact with them, because GitHub judges the agent domain to be changing too quickly to pin down.
  • GitHub kept two independent hosts, VS Code's in TypeScript and GitHub's cloud host in Rust, and comparing their protocol extensions exposed real gaps, such as no accurate way to represent shell output not backed by a PTY, plus bad client assumptions about session URI structure.
  • Moving off the Copilot Chat extension, which had grown past 400,000 lines of TypeScript, meant rebuilding the agent stack on the Copilot SDK; the team notes a basic file-editing came quickly, but matching the long tail of existing features was the hard part.
Terms in this piece · Glossary
  • AI agent — An AI system that doesn't just answer once but works toward a goal in a loop — taking actions, reading the results, and deciding what to do next.
  • MCP — The Model Context Protocol — an open standard that lets any AI assistant plug into any tool or data source without custom integration code.
  • agent harness — The scaffolding around a model that turns it into a working agent — the loop, the tools it can call, and the rules for when to stop.
Read the source github.blog
Recommended reads
Comments

Checking sign-in…

Loading comments…