Sulat.com / Writing on AIMonday, November 30, 2026
Enter →
Agent Engineering/30 November 2026

GitHub’s Agent Host Protocol, explained

GitHub says Copilot sessions can move between devices because they run on an open protocol. Here is how the Agent Host Protocol works, what I ran, and how it compares with ACP, MCP and other tools.

3D GitHub logo on a glowing server linked to a laptop, a phone and a cloud that all show the same chat, illustrating one shared agent session
Illustration: Sulat, featuring the GitHub logo

At a glance

  • GitHub says Copilot sessions continue across devices because they run on the open, MIT-licensed Agent Host Protocol (AHP).
  • The agent session lives in a host process, and any number of clients subscribe to it over JSON-RPC, with the host deciding the order of actions.
  • In our own run against the sample host, a client that dropped mid-session reconnected, had the missed actions replayed, and ended with the same turns as a second client.
  • Reconnect is something each host must implement, since the smallest GitHub sample does not support it.
  • AHP sits above ACP and MCP rather than competing with them, and Claude Code and Cursor offer similar handoff without a documented open protocol.

GitHub says its Copilot sessions can start on one device and carry on from another because they run on an open standard called the Agent Host Protocol, or AHP. The agent session lives in a host process, and any number of clients subscribe to it. I read the spec, ran the sample host with two clients and a dropped connection, and compared it with how Claude Code and Cursor do the same job.

Four-step flow: laptop drops, phone sends a turn, laptop reconnects with its last seen number, host replays the missed actions, both screens match
A reconnecting client sends the last action it saw and gets the rest back. Illustration: Sulat. Source: our run against the AHP sample host.

What GitHub published

The post comes from Connor Peet and Rob Lourens, both principal engineers at GitHub. They write that models can now work for hours or days on their own, so an agent can’t live inside one application. You need to check in from wherever you are, and the work should carry on if you close a window or switch devices.

GitHub says Copilot session continuity runs on AHP, which it describes as an open standard built first in VS Code and adopted across GitHub. Sessions running locally in the Copilot app, in cloud sandboxes and in VS Code all share the protocol. The spec is MIT-licensed, and the post names SDKs in Rust, TypeScript, Kotlin, Swift, .NET and Go.

3

channels every host must implement: root, session and chat

6

client SDK languages

MIT

licence on the spec and the SDKs

Why one client per product stopped working

Copilot began as a VS Code extension that bundled its own agent harness. That tied the agent’s life to the editor. The post lists the consequences: close the window and the agent is gone, update VS Code and every agent stops as the app restarts, and connect to a remote machine and you get a new extension host locked to the version of VS Code you have.

Before and after comparison: an agent inside an editor window stops when the window closes, an agent in a host keeps going and any client can join
Moving the agent out of the editor window is what makes continuity possible. Illustration: Sulat. Source: GitHub engineering post.

At the same time the Copilot app and the GitHub mobile apps each had their own integration with cloud agents. GitHub’s argument is that a developer who wants an agent in an editor, a terminal, a phone or a tool they built can’t get that if every client needs a one-off integration. A shared, independently versioned protocol means every client sees the same agents, history and state.

The Copilot Chat extension had grown past 400,000 lines of TypeScript, which is why the agent logic moved out of it. VS Code’s own August write-up of the Agent Host says the new process owns sessions, can run locally or on a remote machine, and hosts different harnesses behind adapters. The Copilot harness runs on the Copilot SDK. The Claude harness loads Anthropic’s Claude Agent SDK, and its adapter maps sessions, tools, permissions and subagents into AHP while keeping features such as slash commands and hooks.

How the protocol works

Hand-drawn diagram: laptop, phone and browser clients all connect to one agent host, which drives any agent harness
The host keeps the session, so any screen can join it. Illustration: Sulat. Source: GitHub and VS Code engineering posts.

Everything in AHP lives on a channel, a URI-addressed resource a client subscribes to. The guide names the root catalogue, each session, each chat, each terminal and each changeset. Every host has to implement the root, session and chat channels. Terminals, MCP additions and telemetry are optional extras that a client and host negotiate when they connect.

Each channel holds a state tree that only changes through pure reducers. A client sends an action such as chat/turnStarted through dispatchAction. The host decides the order, applies it, and broadcasts it to every subscriber with a sequence number, so every screen converges on the same state. Because the host is the authority, a client whose action conflicts with another’s can be rejected, and the host’s version wins.

Clients apply their own actions straight away and fix things up when the host echoes them back, which the spec calls write-ahead reconciliation. So a phone on a bad connection keeps working, and the host sorts out the order when the link returns.

A few other details from the spec:

  • The wire format is JSON-RPC 2.0. The spec doesn’t prescribe a transport, and WebSocket is the common choice, including in VS Code.
  • The handshake is an initialize request. The client offers a list of protocol versions, the host picks one, and a host that shares none returns error -32005 with the versions it does speak.
  • On reconnect the client sends its last seen sequence number. The host replies with the missed actions, or fresh snapshots if the gap is too old to replay. Notifications such as a new session appearing are not replayed, so a client refetches the session list.
  • Access to the endpoint itself is left to the transport. For agents and the services behind them there is an authenticate command built on RFC 9728, and MCP servers that need OAuth are handled through it.
  • Extensions use an x- prefix and _meta fields.

The two hosts are separate code bases. VS Code’s is in TypeScript and ships inside the VS Code Server bundle. GitHub’s is in Rust and runs in the cloud across a wider range of environments. GitHub says that having two independent implementations has been a good acid test. It found real gaps, such as early versions being unable to represent shell output that wasn’t backed by a PTY, and a VS Code client assumption about the shape of session URIs.

What I ran

GitHub publishes a samples repository with a host written in Rust and a browser chat client. I ran the “advanced workspace host” in its demo mode, which uses a local stand-in for a model, so every reply is a deterministic echo of the prompt. That means I tested the protocol, not any agent’s quality. I also installed the TypeScript SDK (1.1.0) and GitHub’s ahp command-line client from npm. The sample host negotiates protocol 1.0.0, one step behind the 1.1.0 SDK.

Four things, in order:

  • Handshake. The command-line client connected, negotiated 1.0.0 and listed sessions. When I offered only version 9.0.0 with a raw WebSocket, the host answered error -32005 with the versions it supports, 1.0.0 and 0.9.0, as the spec says.
  • Two browsers, one session. I opened the sample chat app in two browser windows. One created a session and sent a message. The other opened the same session from its list and sent a second message, and it appeared in the first window without a refresh.
  • A dropped laptop. I wrote a short script with two raw clients, a “laptop” and a “phone”. The laptop starts a turn, the phone joins and reads the snapshot, the laptop’s socket is killed, the phone sends a second turn, and the laptop reconnects with the last sequence number it saw.
  • The result. The host replayed the missed actions in the reconnect response, and both clients ended with the same two completed turns.
Two browser windows showing the same chat; the second message was typed in browser 2 and appeared in browser 1 without a refresh
Two browsers, one session. The message typed in the second window showed up in the first. Source: Sulat’s own test.
Terminal output of the handoff script: laptop drops, phone sends a turn, laptop reconnects and receives a replay, both end with identical turns
Real output from the reconnect test against the sample host. Source: Sulat’s own test.

One thing the docs only hint at: GitHub’s smallest sample, the minimal chat host, doesn’t support reconnect at all and answers it with a method-not-found error. Replay is part of the protocol, but it’s the host that has to do the work of keeping a journal of actions. A host that skips it still speaks AHP and can’t carry a session across a dropped connection.

I didn’t run VS Code’s code agent host or the Copilot app’s direct connections, a real model, tool approvals, authentication, or the snapshot path for a gap older than the replay buffer. GitHub’s own cloud host isn’t public. The script is below, verbatim.

The handoff script
Code
import WebSocket from 'ws';
import { randomUUID } from 'node:crypto';
const URL='ws://127.0.0.1:8787/ahp';
function client(name){
  const c={name,id:'demo-'+name+'-'+randomUUID().slice(0,6),seq:0,last:0,pending:new Map(),n:0,log:[],actions:[],ws:null,cs:0};
  c.open=()=>new Promise(r=>{c.ws=new WebSocket(URL);c.ws.on('open',r);c.ws.on('message',m=>{const j=JSON.parse(m);
    if(j.id!==undefined&&c.pending.has(j.id)){c.pending.get(j.id)(j);c.pending.delete(j.id);return;}
    if(j.method==='action'){c.last=Math.max(c.last,j.params.serverSeq);c.actions.push(j.params);}
  });});
  c.req=(method,params)=>new Promise(r=>{const id=++c.n;c.pending.set(id,r);c.ws.send(JSON.stringify({jsonrpc:'2.0',id,method,params}));});
  c.dispatch=(channel,action)=>c.ws.send(JSON.stringify({jsonrpc:'2.0',method:'dispatchAction',params:{channel,clientSeq:++c.cs,action}}));
  return c;
}
const sleep=ms=>new Promise(r=>setTimeout(r,ms));
const text=(st)=>st.turns.map(t=>({id:t.id??t.turnId,msg:t.message?.text??t.userMessage?.text,state:t.state,reply:JSON.stringify(t.responseParts??t.response??'').slice(0,0)}));
const A=client('laptop'),B=client('phone');
await A.open();
let r=await A.req('initialize',{channel:'ahp-root://',clientId:A.id,protocolVersions:['1.0.0'],initialSubscriptions:['ahp-root://']});
console.log('[laptop] initialize ->',r.result.protocolVersion,r.result.serverInfo.name,'serverSeq',r.result.serverSeq);
const sess='ahp-session:/'+randomUUID();
await A.req('createSession',{channel:sess,provider:'openai'});
r=await A.req('subscribe',{channel:sess}); const chat=r.result.snapshot.state.chats[0].resource;
r=await A.req('subscribe',{channel:chat});
console.log('[laptop] created',sess.slice(-8),'chat',chat.slice(-8));
const t1='turn-1-'+randomUUID().slice(0,4);
A.dispatch(chat,{type:'chat/turnStarted',turnId:t1,startedAt:new Date().toISOString(),message:{text:'Fix the flaky login test',origin:{kind:'user'},model:{id:'fixture-model'}}});
await sleep(1500);
console.log('[laptop] turn 1 done; last serverSeq seen =',A.last);

// phone joins later
await B.open();
r=await B.req('initialize',{channel:'ahp-root://',clientId:B.id,protocolVersions:['1.0.0'],initialSubscriptions:['ahp-root://']});
r=await B.req('listSessions',{channel:'ahp-root://',limit:100});
console.log('[phone] listSessions sees laptop session:',r.result.items.some(s=>s.resource===sess));
r=await B.req('subscribe',{channel:chat});
const snap=r.result.snapshot;
console.log('[phone] subscribe snapshot fromSeq',snap.fromSeq,'turns in snapshot:',snap.state.turns.length,'first user message:',JSON.stringify(snap.state.turns[0]?.message?.text??snap.state.turns[0]?.userMessage?.text));

// laptop drops (lid closed)
const lastSeen=A.last; A.ws.terminate(); console.log('[laptop] connection dropped at serverSeq',lastSeen);
await sleep(300);
const t2='turn-2-'+randomUUID().slice(0,4);
B.dispatch(chat,{type:'chat/turnStarted',turnId:t2,startedAt:new Date().toISOString(),message:{text:'Also add a retry to the CI job',origin:{kind:'user'},model:{id:'fixture-model'}}});
await sleep(1500);
console.log('[phone] sent turn 2 while laptop offline; phone last serverSeq =',B.last);

// laptop reconnects
const A2=client('laptop-2'); A2.id=A.id; await A2.open();
r=await A2.req('reconnect',{channel:'ahp-root://',clientId:A.id,lastSeenServerSeq:lastSeen,subscriptions:['ahp-root://',sess,chat]});
const res=r.result||r.error; 
console.log('[laptop] reconnect ->',r.error?('ERROR '+JSON.stringify(r.error)):Object.keys(res).join(','));
const rr=r.result;
if(rr){const kind=rr.type||rr.kind||(rr.actions?'replay':rr.snapshots?'snapshot':'?');console.log('[laptop] reconnect kind:',kind,'| actions replayed:',rr.actions?.length,'| snapshots:',rr.snapshots?.length);}
await sleep(500);
// final state comparison
const sa=(await A2.req('subscribe',{channel:chat})).result.snapshot, sb=(await B.req('subscribe',{channel:chat})).result.snapshot;
const sum=s=>s.state.turns.map(t=>(t.message?.text??t.userMessage?.text)+' | '+(t.state??t.status??''));
console.log('[laptop] final turns:',JSON.stringify(sum(sa)));
console.log('[phone ] final turns:',JSON.stringify(sum(sb)));
console.log('identical turn count and prompts:',JSON.stringify(sum(sa))===JSON.stringify(sum(sb)));
process.exit(0);

Where it sits next to ACP, MCP and A2A

Layer diagram: clients talk AHP to an agent host, the host talks ACP or an SDK to the agent harness, and the harness talks MCP to tools and data
AHP sits above the agent, MCP sits below it. Illustration: Sulat. Source: AHP guide.

AHP isn’t competing with the protocols you already hear about. Each answers a different question.

ProtocolConnectsBuilt for
AHPMany clients to one agent hostKeeping a session in sync across screens
ACP (Agent Client Protocol)One editor to one coding agentPutting an agent inside an editor, by the people behind Zed and JetBrains
MCPAn agent to tools and dataGiving a model access to services
A2AOne agent to another agentDelegating work between independent agents
Compiled from each protocol’s own documentation.

The AHP guide is direct about ACP. It calls AHP a coordination layer and ACP a communication layer, and it lays out the layering: AHP above the host, ACP or an agent SDK below it. Its summary line:

A useful mental model: AHP is a mutex over ACP.

AHP guide, “AHP and the Agent Client Protocol”

ACP assumes one client, so it says nothing about two screens watching the same turn. AHP adds that and, in the guide’s words, nothing more. It doesn’t define how agents reason, what tools they have, or how they route models. It doesn’t do agent-to-agent communication either, which is A2A’s job. ACP’s own docs say full support for remote agents is still a work in progress, which is the gap AHP’s hosts fill from above.

MCP gets the lightest touch. AHP does not restate MCP. It shows an MCP server in session state with its name, status and sign-in needs, passes through a side channel so a client can draw an MCP App, and leaves connections and tool discovery to the harness. I covered the MCP side in the deep dives on MCP Server Cards and the MCP Events extension.

How other tools hand a session over

Handing a session between devices isn’t new. What AHP adds is a published protocol under it. These are the closest equivalents I could check in each vendor’s documentation.

ToolWhere the session runsHow another device joinsOpen protocol for other clients
GitHub CopilotIn a host: your machine, a remote machine or a cloud sandboxAny AHP client connects to the hostYes. MIT-licensed spec and six SDKs
Claude Code Remote ControlOn your own machineBrowser or phone through claude.ai, in sync with the terminalNone documented
Claude Code cloud sessionAnthropic-managed cloud or a self-hosted runner/teleport pulls it into a terminal as a separate copyNone documented
Cursor Remote ControlThe agent loop runs in Cursor’s cloud, tools run on your computerOpen it in the Cursor iOS app or at cursor.com/agentsNone documented
Compiled from GitHub, VS Code, Anthropic and Cursor documentation.

The designs differ in where the truth lives. Claude Code’s docs say a Remote Control session keeps running locally, so your filesystem and MCP servers stay available from the other device. A teleported cloud session is a copy: the docs say new work in the terminal stays local and doesn’t appear in the cloud session. Cursor splits the job, with the loop in its cloud and every tool call on your machine. AHP puts the session in a host and treats every screen as equal.

VS Code’s remote docs add a caveat that applies to any host design. Connecting to a host doesn’t transfer the session or copy the project to the client. The host machine has to stay awake and online, and VS Code has a setting that keeps it awake while an agent is working.

GitHub’s connected cloud changelog shows the user-facing result: start a task on github.com, GitHub Mobile, the CLI, the Copilot app, VS Code, Slack or Teams, and pick it up in another. Cloud sandboxes save a snapshot when they shut down so a session can resume later. A local device can register as an environment and be steered from the phone. The changelog doesn’t mention AHP. The engineering post is where GitHub says the protocol underneath is the same.

Who is building on it

The repository lists third-party work already. Servers include pi-ahp for the pi coding agent, ahpd (a plugin-driven host with users and permissions that can run Claude, pi and ACP agents), hydra-ahp and the AHP-ACP Gateway, which runs ACP agents behind an AHP host. Clients include VS Code, AHPX, a terminal client called ahpc, a web client called ahpw and a VS Code extension that connects WeChat to a local host. The GitHub authors mention a macropad showing an agent’s state, and say others have built smart watch apps and Kanban tools on it.

The list names no product from Anthropic, Cursor, Zed or JetBrains. The protocol is a Microsoft and GitHub project with a growing set of community adapters, and it is young: the repository was created in March 2026, the spec is at 1.1.0 and a 1.2.0 draft is up.

What it means if you build agents

  • If you build a client. You can show an agent session from any AHP host without writing a bespoke integration. The TypeScript, Rust, Go, Swift, Kotlin and .NET SDKs ship the types and reducers, and the repository carries language-independent test suites.
  • If you build an agent. Put an adapter between your harness and a host and you get multi-client sync, replay and reconnect. The guide says an ACP agent can sit behind a host, and the VS Code Claude harness shows an SDK-based one can too.
  • If you run a host. Replay is your job. So is gating the endpoint, since the protocol leaves transport access to you. GitHub’s samples README labels the minimal host educational and not production hardened.
  • If you use Copilot. In the Copilot app, switch on Experimental > Direct Connections, then use Environments > Add Agent Host Protocol Host. In VS Code, use Add Remote Agent Host in the Agents window. code agent host starts a standalone host and code agent endpoints shows where the one in your editor is listening.

My read is that the protocol is a sound answer to a real problem. Session state, action order and reconnect are things every agent UI is going to need, and a reducer model is an easy one to build on. What it hasn’t had yet is a second major vendor putting its own client or host behind it. Until that happens, AHP is the way GitHub and VS Code share sessions, with a standard open enough that others can join.


Sources: GitHub engineering post / Agent Host Protocol spec and guide / agent-host-protocol repository / samples repository / VS Code Agent Host docs / VS Code remote sessions docs / Agent Client Protocol / A2A specification

Disclosure: I’m an OpenAI, Firecrawl and Devin ambassador.