acdp-playground

Scenario runner that generates real ACDP protocol traffic end-to-end

The ACDP playground generates real protocol traffic so the SDK (acdp-rs), the registry (acdp-registry-rs), and the control plane (acdp-control-plane) can be exercised end-to-end. It spins agents, calls real LLMs (in 10 of the 34 scenarios), publishes signed context, streams events over SSE, and forwards registry webhooks.

Documentation

Full docs live in docs/ and are published as the /playground section of agentcontextdistributionprotocol.io:

DocCovers
Getting startedInstall, smoke-test, run the stack, first run
ArchitectureComponents, request flow, the run lifecycle, the SSE bus
ScenariosThe S1–S34 catalog and how to author one
HTTP APIEvery route on the playground service
Client libraryacdp_client — the async wrapper the playground drives the SDK through
AgentsBasePlaygroundAgent + LangChain / CrewAI / LangGraph
ConfigurationThe playground's own environment variables
DeploymentDocker Compose, the full stack, Railway
Testing & conformanceSmoke test, unit suite, live probes, opt-in real-LLM suite, CI

These docs cover only what is unique to the playground. Anything owned by another project is referenced, not re-explained:

ProjectWhat it owns
Spec / RFCsThe protocol: context body, publish, retrieval, discovery, cross-registry, capabilities, security
acdp-rsThe SDK — signing, JCS canonicalization, the SSRF policy, error taxonomy, the Python/Node bindings
acdp-registry-rsRegistry HTTP API, authentication, multi-tenancy, webhooks, configuration
acdp-control-planeToken issuance, introspection, revocation, policy, ingest, federation

Layout

acdp_client/                  # async httpx + Pydantic aliases over the acdp-py SDK
playground/
  agents/                     # BasePlaygroundAgent + LangChain/CrewAI/LangGraph
  scenarios/
    catalog/                  # S1–S34 — auto-discovered, runnable end-to-end
  api/                        # FastAPI routers: health, scenarios, runs, contexts, webhooks
  config.py                   # pydantic-settings (.env)
  events.py                   # in-process SSE bus
  control_plane.py            # no-op when CONTROL_PLANE_URL unset
scripts/
  smoke_test.py               # offline wiring checks (P-256, JCS vectors, SSRF guard, CP stub); --live adds real-stack conformance
  gen_keys.py                 # deterministic agent identity material (ed25519 / p256)
  pinned_keys_diff.py         # translate registry [[playground.pinned_keys]] → CONTROL_PLANE_PINNED_KEYS env
config/                       # registry-a.toml, registry-b.toml
docker-compose.yml            # playground + two registries
docker-compose.full.yml       # overlay adding db (Postgres) + control plane + ui-console (make up-full)
tests/                        # offline unit suite; tests/live/ = opt-in live-stack suites
a2a/                          # RFC-ACDP-0022 demo: two a2a-sdk agents (own uv project, not in the app image)

Quickstart

# 1) Install (uses uv; resolves the acdp SDK wheel from PyPI)
make dev

# 2) Sanity check (no LLM, no registry needed)
make smoke

# 3) Run the playground + both registries
cp .env.example .env
# edit .env: set OPENAI_API_KEY=... (or LLM_PROVIDER=mock for offline runs)
# or skip .env and use Doppler: doppler setup --project acdp-playground --config dev,
# then prefix commands with `doppler run --` (see docs/configuration.md)
make up

# 4) List scenarios
curl localhost:8000/scenarios | jq

# 5) Start a run
curl -X POST localhost:8000/runs \
    -H 'content-type: application/json' \
    -d '{"scenario_id":"s4_chain","inputs":{"topic":"GPU supply chains"}}'

# 6) Stream events (replace RUN_ID with the returned id)
curl -N localhost:8000/runs/RUN_ID/events

Scenarios

IDNameWhat it showsIdentityLLMCPDegrades
s1_single_publishSingle PublishSmallest publish round-tripdid:keyyes—no
s2_producer_consumerProducer → ConsumerOne derivation edgedid:keyyes—no
s3_fanoutFan-out (1 → N)One source, parallel facet analysesdid:keyyes—no
s4_chainLinear Chain A → B → CC derives from both A and Bdid:keyyes—no
s5_cross_registryCross-Registry ChainEdge crosses registry-a → registry-bdid:keyyes—no
s6_restrictedRestricted Visibility (V2 auth)Audience-gated reads by three authenticated agentsdid:keyyes—yes
s7_supersessionSupersession (v1 → v2)Same lineage, two versionsdid:keyyes—no
s8_cross_orgCross-Org IsolationTwo orgs, no cross-referencesdid:keyyes—no
s9_p256_publishECDSA-P256 PublishP-256 signer + verifier paritydid:key (P-256)no—no
s10_tenant_isolationTenant IsolationJWT-bound tenancy; cross-tenant denieddid:web (per run)yes—yes
s11_revocationToken RevocationMint → use → revoke (RFC 7009)did:keyyesoptionalyes
s12_key_rotationKey Rotation + Admin ReloadOverlapping pinned-key validity windowsdid:web (pinned)nooptionalno
s13_policy_denyPolicy / Authz EnforcementGuarded CP endpoint denies/admitsnonenorequiredyes
s14_domain_packDomain-Pack GatingContext-type gating on ingestnonenorequiredyes
s15_supersession_lineageSupersession w/ expected_lineage_idexpected_lineage_id concurrency guarddid:keyno—no
s16_dataref_ssrfConsumer SSRF guard (data_refs)data_refs[].location fetch screened (offline)noneno—no
s17_supersession_authzSupersession authorizationNon-owner lineage takeover rejecteddid:keyno—yes
s18_idempotencyIdempotent publishRepeated Idempotency-Key replays one contextdid:keyno—yes
s19_cp_did_web_p256CP did:web P-256 conformanceP-256 verification method the CP now resolves (offline)did:web (P-256)no—no
s20_reserved_tenantReserved-tenant rejectionAsserting the default tenant is rejected (offline)noneno—no
s21_capabilities_p256CP capability P-256 declarationecdsa-p256 capability declaration accepted (offline)did:web (P-256)no—no
s22_receiptsRegistry Receipts (happy path)Registry-signed receipt verified under a Require policydid:keyno—yes
s23_receipt_tamperReceipt Tamper (fail-closed)Every missing/mutated/mismatched receipt fails closed (offline)did:web (per run)no—only with no receipt seed
s24_historical_keyHistorical Key VerificationPre-rotation context is HistoricallyAuthorized via receipt + retained keydid:web (pinned)no—yes
s25_did_keydid:key Ephemeral AgentsEphemeral agents self-verify offline; rotation is a new identitydid:keyno—yes
s26_divergenceDivergence Diagnosticsexplain_hash_mismatch names the JCS divergence causedid:keyno—yes
s27_receipt_key_rotationRegistry Receipt-Key RotationRegistry rotates its receipt key; a historical receipt still verifiesdid:keyno—yes
s28_lifecycle_retractionLifecycle Events & RetractionSigned retract/republish (mark-not-delete); 409 on conflicting transitionsdid:keyno—yes
s29_transparency_logTransparency Log ProofsSigned checkpoint + inclusion + consistency proofs; tamper fails closeddid:keyno—yes
s30_head_receipt_freshnessLineage-Head Receipt Freshness/current answers are registry-signed; as_of freshness/stale policydid:keyno—yes
s31_witness_cosigningTransparency-Log Witness CosigningIndependent witness cosigns a checkpoint; consumer verifies quorumdid:keyno—yes
s32_key_revocationProducer Key-Revocation SignalTime-scoped key-compromise signal; pre/post-compromise classificationdid:key live, did:web offline coreno—yes
s33_anchorsExternal AnchorsAnchors are signed like any field and never dereferenceddid:keyno—yes
s34_embedded_contentEmbedded Content Integrityembedded.content_hash verified over the decoded bytesdid:keyno—yes

Identity is the signing agents' DID method (did:web per run comes from the factory default; pinned keys live in the registry config). LLM marks the 10 scenarios that call the configured LLM. CP required means the run degrades without a control plane; optional means a best-effort extra. Degrades means the run completes with degraded: true in its summary when its infrastructure is missing. docs/scenarios.md has the full table, including the infrastructure each scenario needs.

V2 scenarios (S9–S15) exercise the features that landed across the sibling repos: P-256 signing, multi-tenancy, token revocation, key-rotation windows, policy, and domain packs. S9 verifies its P-256 crypto offline and skips the registry round-trip when registry-a is absent; S15 runs against registry-a in the default stack. S10 and S11 need live token issuance; S10's per-run did:web agents degrade against a stock registry, while S11's did:key agent completes live. S12 runs offline and only reloads pinned keys when a control plane is configured. S13 and S14 need the control plane and degrade gracefully (marked complete-but-degraded via a degraded: true summary flag) without it; see Running the full stack.

Round-2 scenarios (S16–S17) cover the latest security-remediation wave. S16 runs fully offline (injected DNS resolver) and proves the consumer SSRF guard blocks IMDS / mixed-answer / cross-port-redirect / non-https data_refs fetches. S17 drives the live registry's producer-ownership check on supersession and degrades gracefully without it; the cross-tenant variant is asserted in the unit suite.

Round-3 scenarios (S18–S19) cover the post-remediation wire conformance. S18 proves a repeated Idempotency-Key replays a single context (degrades gracefully). S19 runs fully offline and proves the playground's P-256 agent emits exactly the JWK-only JsonWebKey2020 verification method the control plane's did:web resolver now accepts.

Round-4 scenario (S20) tracks acdp-control-plane #50. S20 runs fully offline and proves the reserved default tenant can never be asserted (via X-Tenant-Id or a token claim), since it would alias the untenanted bucket. The registry returns 400 schema_violation and the CP 403 not_authorized; the playground mirrors the rule client-side so a caller fails fast locally.

S21 tracks acdp-control-plane #51. S21 runs fully offline and proves the playground's P-256 agent emits the ecdsa-p256 capability declaration the control plane's capability DTO now accepts (it previously rejected P-256 at the validation boundary); the signature is self-verified against the producer's key.

ACDP 0.2 trust & hardening (S22–S27) cover registry receipts and the RFC-ACDP-0010 §9 key lifecycle: a registry-signed receipt on every publish (S22), every dishonest receipt failing closed (S23), the retired-key lifecycle on both the producer (S24) and registry receipt-key (S27) sides, ephemeral did:key agents (S25), and the explain_hash_mismatch diagnostic (S26). Deterministic cores run fully offline; live receipt round-trips degrade gracefully against a stock registry.

ACDP 0.3.0 (S28–S30) cover lifecycle events & retraction (RFC-ACDP-0013, S28), the registry's Merkle transparency log (RFC-ACDP-0012, S29), and signed lineage-head receipts on /current (RFC-ACDP-0011, S30), all served live by registry-a's receipts/ lifecycle/log profiles. Each mints its artifacts offline with the SDK primitives, so the deterministic core runs with no registry; the live halves degrade gracefully.

S31 proves transparency-log witness cosigning (RFC-ACDP-0015): the playground acts as an independent did:key witness, and a cosignature over a tampered root fails closed.

S32 proves the producer key-revocation signal (RFC-ACDP-0014): a K1-signed context is accepted only when its receipt-attested created_at predates the compromise time. The offline core uses a did:web producer; the live half publishes with did:key agents.

S33 proves external anchors (RFC-ACDP-0016): an anchor is signed like any other field, is never dereferenced by verification, and carries forward on supersede unless clear_anchors=True.

S34 proves embedded data-ref content integrity (RFC-ACDP-0002 §6.3/§6.6): embedded.content_hash is checked over the decoded bytes of each encoding (json, utf8, base64), is independent of the DataRef-root content_hash, and a tampered byte fails closed on both the publish and retrieval paths. The live half round-trips the refs through registry-a, degrading gracefully without one.

A2A artifact provenance demo

a2a/ runs RFC-ACDP-0022 end to end with two agents built on the official A2A Python SDK. The producer signs each completed artifact through acdp-rs's acdp-a2a. The client verifies what it holds with acdp-verifier-py's holder. The demo has three runs against a local registry: pass, tamper and retraction. It is a separate project, so the deployed playground app does not include it. Run it with make a2a-demo (Docker, Rust and uv).

Protocol features exercised

Beyond the scenario catalog, the client layer (acdp_client) drives the protocol surfaces a real consumer needs: Ed25519 and ECDSA-P256 signing, JWT-bound multi-tenancy (X-Tenant-Id only as a fallback), cursor pagination (search_all), token revocation, pinned-key rotation windows, idempotent publish, the consumer SSRF guard for data_refs fetches, and the application/acdp+json error envelope surfaced as typed exceptions (NotAuthorizedError, PayloadTooLargeError, SupersededError, CursorError). Signing, JCS canonicalization and SSRF classification are delegated to the SDK — the playground keeps only the host-language orchestration. docs/client-sdk.md documents what the client adds; the rules themselves live in RFC-ACDP-0007 (capabilities and error envelope), RFC-ACDP-0008 (security, tenancy, SSRF) and the SDK's security.md and errors.md. The history of how each piece landed is in CHANGELOG.md.

LLM provider

Set LLM_PROVIDER in .env to one of:

  • openai (default) — LLM_MODEL=gpt-4o-mini, needs OPENAI_API_KEY
  • anthropic — needs ANTHROPIC_API_KEY
  • mock — deterministic offline echo (for smoke / CI runs without API keys)

Access and limits

Every route except /healthz and /webhooks/acdp takes the shared key in the x-api-key header (PLAYGROUND_API_KEY). It is enforced once PLAYGROUND_REQUIRE_API_KEY=true (default false, so callers can start sending it first). A keyed caller can forward its user's IP in X-ACDP-Client-IP. GET /registries/{a|b}/... is the only external path to the registries, which are private-network only in production: health, search, lineages, /.well-known/* and raw contexts/{ctx_id} bytes for end-to-end verification.

LimitDefaultEnv varWhen exceeded
Run launches per client IP5 / 10 minRUN_RATE_LIMIT_PER_IP, RUN_RATE_LIMIT_WINDOW_SECONDS429 + Retry-After
Concurrent runs3MAX_CONCURRENT_RUNS429 + Retry-After
LLM calls per client IP30 / day, 300 / monthLLM_QUOTA_PER_IP_PER_DAY, LLM_QUOTA_PER_IP_PER_MONTHrun finishes on the mock LLM, marked llm_quota_exceeded
LLM calls, global1,000 / day, 10,000 / monthLLM_QUOTA_GLOBAL_PER_DAY, LLM_QUOTA_GLOBAL_PER_MONTHsame

LLM quotas count each real LLM call, in Postgres (DATABASE_URL). Rollout note: per-IP limits apply to keyed requests now, and to keyless ones only once PLAYGROUND_REQUIRE_API_KEY=true. Until then a keyless request's peer is the shared edge proxy, so a per-IP bucket would throttle all users together. Global quotas and the concurrency cap apply from the start. Details: docs/http-api.md.

Control plane

acdp-control-plane is a separate sibling project — now fully implemented with bearer-token issuance, RFC 7662 introspection, RFC 7009 revocation, federated cross-issuer validation, multi-tenancy, policy engine, and an append-only audit ledger.

When CONTROL_PLANE_URL is empty, the playground runs standalone. When set, every registry webhook is HMAC-signed and forwarded (preserving the X-ACDP-Event-Id dedup key); run start/complete notifications are also posted there. Multi-tenant deployments set the X-Tenant-Id header on forwarded webhooks so the CP attributes events to the right tenant. The forwarder honours a cooperative Retry-After on a transient upstream.

The ControlPlaneClient also drives the CP operator surface when CONTROL_PLANE_ADMIN_TOKEN is set: introspect (RFC 7662), revocations (the cross-issuer feed), and reload_pinned_keys.

Running the full stack

make up-full   # playground + registry-a + registry-b + db + control-plane + ui-console

docker-compose.full.yml adds the NestJS control plane on :3001, the ephemeral Postgres db (postgres:16-alpine on tmpfs) it requires for its event, run and receipt-audit stores, and the UI console on :3000. It points the playground at the control plane and wires the shared HMAC + admin secrets (auth nonces and revocations stay in memory, AUTH_PERSISTENCE=memory). S13 and S14 need the control plane (S11 and S12 use it optionally); the full stack gives them a real one.

The console runs as a production build, so its backend proxy is gated by an operator passphrase: sign in at http://localhost:3000/login with playground-console. Set ACDP_UI_CONSOLE_PASSWORD to override it, and do so before exposing the stack beyond localhost.

Live auth caveat. For a did:web agent, the registry verifies challenge signatures by resolving the agent's DID document. The playground's *.playground.local DIDs aren't web-hosted and keys rotate per run, so token issuance for per-run did:web agents can't complete against a stock registry. That affects S10 only: the other token-issuing scenarios (S6, S11) use self-certifying did:key agents and complete live. S10 degrades gracefully and is validated by the unit suite (mocked registry/CP); the deterministic cores (P-256 crypto, cursor logic, tenant-header policy, rotation windows, Retry-After) are fully exercised offline.

Live conformance suite

The unit suite and smoke_test assert against httpx.MockTransport — fast and offline, but a mock can drift from the real binary (the reserved-tenant 422 → 400 fix is the cautionary tale). The live suite re-checks the externally-observable contracts against a running make up-full stack:

make up-full                     # in another shell (or: docker compose ... up -d --wait)
make test-live                   # ACDP_LIVE_STACK=1 uv run pytest -m live -q
make smoke-live                  # scripts/smoke_test.py --live

The 18 probes live in playground/conformance.py (shared by both entry points), grouped into registry-core contracts, the 0.3.0 endpoint set, and the control plane. They cover the reserved-tenant 400, the application/acdp+json error envelope, the 1 MiB ingest 413, the receipts profile and minimum acdp_version being advertised, did:key being an advertised DID method, the served-ctx_id binding, the media-type gate on POST /contexts, the retired interim revocation type, the anchors version gate, rejection of a self-signed key revocation, signed log checkpoints with inclusion and consistency proofs, head receipts on /current, the retract endpoint failing closed, the GET /events server-side limit cap, the revocation-feed shape, the admin pinned-key reload, and that the capability DTO accepts ecdsa-p256 (CP #51). docs/testing-and-conformance.md lists each one and what it asserts.

Everything in tests/live/ is skipped unless ACDP_LIVE_STACK is set, so a plain pytest stays offline. Three files need a second gate as well, so make test-live collects but skips them: the UI console sign-in check (ACDP_LIVE_CONSOLE=1; CI's live job never builds the console), the SSE de-duplication check (ACDP_LIVE_SSE=1; the bug only reproduces on a Redis StreamHub, and the demo stack is memory-backed) and the opt-in real-LLM suite (ACDP_LIVE_REAL_LLM=1), which runs all 34 scenarios through POST /runs against the playground at PLAYGROUND_URL with a real, billed provider key and re-verifies every context they publish. CI runs the conformance probes on manual workflow_dispatch and on a weekly schedule, as the tripwire for exactly that kind of drift; it never runs the real-LLM suite.

TokenManager refresh-reason telemetry

acdp_client.TokenManager emits structured logs on every mint with a refresh_reason field — one of first_use, proactive_refresh, or reactive_401 — so operators can detect abnormal patterns (secret rotation, audience mismatch, clock skew). Logs land at INFO on success and WARNING on failure with a failure_kind discriminator.

Compose layout

The playground image builds with context: . — the acdp Python SDK installs as a prebuilt wheel from PyPI, so no sibling checkout is needed. The registry images build from the sibling acdp-registry-rs/ repo's Dockerfile; docker-compose.full.yml overlays the control plane (built from ../acdp-control-plane), its Postgres db (stock postgres:16-alpine image), and the UI console (built from ../acdp-ui-console).

Deploying to Railway

.github/workflows/deploy-images.yml builds this repo's playground image and pushes it to ghcr.io/<owner>/acdp-playground on every merge to main, a v* tag, or a manual dispatch (the acdp SDK comes from PyPI — no sibling checkout required). Production redeploys automatically on merge: after a push to main the workflow redeploys the prod Railway acdp-playground service. The other stack images are published by their own repos. The playground image binds Railway's dynamic $PORT/$HOST. See railway/DEPLOY.md for the full deploy — service topology, IPv6 private networking, per-service env vars, and the shared-secret wiring.

Local SDK development

The acdp Python package is a compiled (maturin/pyo3) extension published as a wheel on PyPI, which is what make dev installs. To hack on the SDK against a local ../acdp-rs checkout (needs a Rust toolchain), overlay a source build into the venv:

make dev-local   # uv sync + `maturin develop --release` against ../acdp-rs
make build-sdk   # re-overlay after pulling acdp-rs changes (SDK dev only)

maturin develop installs the local build over the PyPI wheel; the next plain uv sync restores the published wheel. Override the checkout path with make build-sdk ACDP_RS=/path/to/acdp-rs.