Raw capture โ raw/agent-host-protocol.md
url: https://microsoft.github.io/agent-host-protocol/ title: Agent Host Protocol (AHP) author: Microsoft date_fetched: 2026-07-25 date_published: 2026
AHP is a portable, standalone server protocol that gives multiple clients a synchronized view of AI agent sessions. It achieves this through immutable state, pure reducers, and write-ahead reconciliation. Released under the MIT License, Copyright ยฉ 2026 Microsoft.
An agent session is traditionally bound to a single application. "The conversation, the turns, the pending tool approvals โ they're tied to a single app or harness." AHP transforms a session into a shared resource, allowing it to "live once and be driven from anywhere."
AHP follows the lineage of LSP (Language Server Protocol) and DAP (Debug Adapter Protocol). A single Agent Host sits between multiple clients and multiple agents. The host holds "authoritative session state ยท sequencing ยท reconciliation." Clients communicate via AHP; agent backends integrate directly.
Four client types (IDE, Web, CLI, Mobile) and four agent backends (Copilot, Claude, Codex, ACP).
origin field) back to its optimistic copy.params.channel: URI โ the central routing key| Channel | URI Pattern | Content |
|---|---|---|
| Root | ahp-root:// |
Agents catalog, terminals catalog, host config, session catalogue events |
| Session | ahp-session:/<uuid> |
Per-session state, chats catalog, active clients, customizations |
| Chat | ahp-chat:/<cid> |
Per-chat conversation, turns, streaming, tool calls |
| Terminal | per-terminal | PTY state, data flow, claims, command detection |
| Telemetry | ahp-otlp: |
OpenTelemetry logs, traces, metrics |
| Resource Watch | separate | File/resource change watching |
unsubscribe, dispatchActioninitialize, reconnect, subscribe, createSession, disposeSession, listSessions, fetchTurns, resourceRead/Write/List/Copy/Delete/Move/Resolve/Mkdir, createResourceWatch, authenticateresourceRequest, createResourceWatch (reverse direction)action, root/sessionAdded, root/sessionRemoved, root/sessionSummaryChanged, auth/requiredEach state-bearing channel maintains an immutable, Redux-style state tree changed only by actions flowing through pure reducers. Subscriptions return snapshots with resource, state, and fromSeq. Subsequent action envelopes incrementally update the state.
Actions โ "Discriminated union of typed mutations. The sole mechanism for state change." Delivered inside ActionEnvelopes with channel, action, serverSeq, origin.
Reducers โ "Pure functions: (state, action) โ newState. Run identically on server and client."
origin matching for reconciliationDRAFT โ "Breaking changes to wire types, actions, and state shapes are expected." No backward compatibility until production status.