How microsoft/agent-host-protocol works
Agent Host Protocol is a family of client SDKs and shared protocol definitions for synchronizing AI-agent session state between portable servers and multiple clients. The principal workflow is a client connecting to a host, sending protocol commands, and receiving channel state and events; SDKs also support subscriptions, reconnection, and—in several languages—multi-host coordination. The graph highlights the TypeScript and .NET client flows shown in source, plus major protocol-state domains and other documented SDKs. Some language implementations and domain modules are represented from the README or file tree rather than inspected source.
Main entry points: common/state.ts Common state · channels-session/state.ts Session state · client.ts TypeScript client · channels-root/state.ts Root state
Components 22
Protocol Model
- Common commands
types/common/commands.ts - Common state
types/common/state.ts - Common actions
types/common/actions.ts
Client SDKs
- TypeScript client
clients/typescript/src/client/client.ts - TypeScript transport
clients/typescript/src/client/transport.ts - .NET client
clients/dotnet/src/AgentHostProtocol/AhpClient.cs - .NET transport
clients/dotnet/src/AgentHostProtocol.Abstractions/Transport/ITransport.cs - Rust client
clients/rust/crates/ahp/src/client.rs - Go client
clients/go/ahp/client.go - Swift client
clients/swift/AgentHostProtocol/Sources/AgentHostProtocolClient/AHPClient.swift - Kotlin client
clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/Ahp.kt
Host Coordination
- .NET multi-host
clients/dotnet/src/AgentHostProtocol/Hosts/MultiHostClient.cs - Swift multi-host
clients/swift/AgentHostProtocol/Sources/AgentHostProtocolClient/Hosts/MultiHostClient.swift
State Domains
- Root state
types/channels-root/state.ts - Session state
types/channels-session/state.ts - Chat state
types/channels-chat/state.ts - Changeset state
types/channels-changeset/state.ts - Automation state
types/channels-automation/state.ts - Automation runs
types/channels-automation-run/state.ts - Terminal state
types/channels-terminal/state.ts
Other components
- Client application
- AHP server
Connections 32
- Client application → TypeScript client: uses SDK
README.md - TypeScript client → AHP server: sends commands
README.md - AHP server → TypeScript client: sends updates
README.md - TypeScript client → TypeScript transport: decodes frames
clients/typescript/src/client/client.ts - TypeScript client → Common commands: implements protocol
README.md - .NET client → .NET transport: sends frames
clients/dotnet/src/AgentHostProtocol/AhpClient.cs - .NET client → AHP server: communicates with
README.md - Rust client → AHP server: communicates with
README.md - Go client → AHP server: communicates with
README.md - Swift client → AHP server: communicates with
README.md - Kotlin client → AHP server: communicates with
README.md - Common commands → Common state: references types
types/common/commands.ts - Common actions → Common state: references types
- Root state → Common state: uses types
types/channels-root/state.ts - Root state → Session state: uses types
types/channels-root/state.ts - Root state → Terminal state: uses types
types/channels-root/state.ts - Session state → Common state: uses types
types/channels-session/state.ts - Session state → Chat state: uses types
types/channels-session/state.ts - Session state → Changeset state: uses types
types/channels-session/state.ts - Session state → Automation state: uses types
types/channels-session/state.ts - Session state → Automation runs: uses types
types/channels-session/state.ts - Chat state → Common state: uses types
types/channels-chat/state.ts - Chat state → Changeset state: uses types
types/channels-chat/state.ts - Changeset state → Common state: uses types
types/channels-changeset/state.ts - Automation state → Common state: uses types
types/channels-automation/state.ts - Automation state → Automation runs: uses types
types/channels-automation/state.ts - Automation runs → Common state: uses types
types/channels-automation-run/state.ts - Terminal state → Common state: uses types
types/channels-terminal/state.ts - Client application → .NET multi-host: uses SDK
README.md - Client application → Swift multi-host: uses SDK
README.md - .NET multi-host → .NET client: manages clients
clients/dotnet/src/AgentHostProtocol/Hosts/MultiHostClient.cs - Swift multi-host → Swift client: manages clients
clients/swift/AgentHostProtocol/Sources/AgentHostProtocolClient/Hosts/MultiHostClient.swift