Clients
This repository ships official client libraries for five languages. Every client's wire types are generated from the canonical TypeScript sources in types/, so the same protocol shape is presented idiomatically in each ecosystem. Each library is versioned and released independently — see RELEASING.md for the per-language tag scheme.
Pick the language you want to integrate against and install from the package registry it normally ships through.
| Language | Package | Registry |
|---|---|---|
| Rust | ahp-types, ahp, ahp-ws | crates.io |
| TypeScript | @microsoft/agent-host-protocol | npm |
| Kotlin / JVM | com.microsoft.agenthostprotocol:agent-host-protocol | Maven Central |
| Swift | AgentHostProtocol, AgentHostProtocolClient | Swift Package Manager |
| Go | github.com/microsoft/agent-host-protocol/clients/go | Go module proxy |
Rust
Three crates on crates.io, mirroring the split between wire types, transport-agnostic client, and a WebSocket adapter:
ahp-types— generated wire types, no I/O.ahp— asyncClientwith pure reducers, a pluggableTransporttrait, and the multi-host registry underahp::hosts.ahp-ws— WebSocket transport built ontokio-tungstenite.
cargo add ahp ahp-ws
# add `ahp-types` directly only if you need the wire types without
# the client runtime.See the Rust client README for the quick start, custom transports, and multi-host details.
TypeScript
A single browser- and Node-friendly package on npm with four subpath entry points (wire types, client, multi-host orchestration, WebSocket transport):
npm install @microsoft/agent-host-protocolimport { AhpClient } from '@microsoft/agent-host-protocol/client';
import { WebSocketTransport } from '@microsoft/agent-host-protocol/ws';See the TypeScript client README for the full subpath table and a complete quick start.
Kotlin
Pure Kotlin/JVM artifact on Maven Central. Targets Java 8 bytecode, so it can be consumed unchanged from Android, server-side JVM services, and KMP/JVM targets.
Gradle (Kotlin DSL)
dependencies {
implementation("com.microsoft.agenthostprotocol:agent-host-protocol:0.2.0")
}Gradle (Groovy DSL)
dependencies {
implementation 'com.microsoft.agenthostprotocol:agent-host-protocol:0.2.0'
}Maven
<dependency>
<groupId>com.microsoft.agenthostprotocol</groupId>
<artifactId>agent-host-protocol</artifactId>
<version>0.2.0</version>
</dependency>The library transitively depends on org.jetbrains.kotlinx:kotlinx-serialization-json. See the Kotlin client README for usage, the Ahp.json serializer instance, and what is/isn't included in the box (no transport yet — bring your own OkHttp/Ktor).
Swift
Distributed via Swift Package Manager. The Package.swift manifest lives at the repository root because SwiftPM only resolves manifests at the root of a remote git repo; the Swift sources themselves live under clients/swift/AgentHostProtocol/.
Package.swift dependency
.package(url: "https://github.com/microsoft/agent-host-protocol.git", from: "0.1.0")Target dependencies
.target(
name: "MyApp",
dependencies: [
.product(name: "AgentHostProtocol", package: "agent-host-protocol"),
.product(name: "AgentHostProtocolClient", package: "agent-host-protocol"),
]
)AgentHostProtocol— generated wire types, commands, notifications, actions, and pure reducers.AgentHostProtocolClient— single-hostAHPClient,MultiHostClient, state mirrors, and theURLSessionWebSocketTransport/NWConnectionWebSocketTransporttransports.
See the Swift client README for the minimal single-host and multi-host examples, transport choices, and reconnect layering guidance.
Go
Single Go module resolved through the public Go module proxy. Three packages mirror the Rust three-crate split:
ahptypes— wire protocol types only.ahp— asyncClientover a pluggableTransport, pure reducers, and the multi-host runtime underahp/hosts.ahpws— WebSocket transport built ongithub.com/coder/websocket.
go get github.com/microsoft/agent-host-protocol/clients/go@latestimport (
"github.com/microsoft/agent-host-protocol/clients/go/ahp"
"github.com/microsoft/agent-host-protocol/clients/go/ahptypes"
"github.com/microsoft/agent-host-protocol/clients/go/ahpws"
)See the Go client README for the WebSocket quick start.
Picking a protocol version
Every client exposes two protocol-version constants:
PROTOCOL_VERSION— the SemVer string for the version that client's current release implements.SUPPORTED_PROTOCOL_VERSIONS— every version the client is willing to negotiate, most-preferred-first. Pass it (or a derived list/array) asprotocolVersionsonInitializeParamsduring the handshake.
Client package versions track the spec version, but they are not required to match exactly — a client released after a patch-only client fix may sit at a higher patch than the matching spec release. The two version constants above always reflect the protocol versions that build of the client can speak. See Versioning for the full negotiation model.