ahp_sdk

A Dart implementation of the Agent Host Protocol: synchronized, multi-client state for AI agent sessions over JSON-RPC 2.0.

Point it at a running agent host:

code agent host

Status

Early. The protocol specification is itself a DRAFT and upstream expects breaking changes to wire types, actions, and state shapes.

Area State Validated against
Generated wire types done 39 round-trip fixtures
Reducers done 246 reducer fixtures
Write-ahead reconciliation done convergence property suite
WebSocket transport + JSON-RPC peer done scripted host, live host
Channel identification done
Subscription refcounting + reconnect not started

Verified end to end against VS Code 1.131.0's agent host: negotiates protocol 0.7.0, mirrors root state, and answers the host's resource* requests.

Layout

lib/
  ahp.dart              public surface
  src/
    channel/            channel URI classification
    generated/          emitted by `npm run generate:dart` — do not edit

Contributor documentation is in docs/. User documentation is at mosesgameli.github.io/ahp, built from website/.

Flutter

This package is pure Dart and has no Flutter dependency. Flutter bindings — InheritedWidget scopes, refcounted channel subscriptions, and rebuild narrowing for token streams — live in a separate ahp_flutter package.

Development

dart pub get && dart analyze --fatal-infos && dart test

Smoke-test against a real host:

code agent host --port 51234 --without-connection-token
dart run ahp_sdk:ahp --url ws://localhost:51234 --watch

Regenerate the wire types after changing anything under types/:

npm run generate:dart

Generated sources are committed, so the package is consumable without a Node toolchain. CI fails if they drift from types/.

Libraries

ahp_sdk
A Dart client for the Agent Host Protocol.