AITP integration

How the playground talks to the AITP SDK, where each protocol moment lives in the codebase, and why the boundaries are drawn the way they are.

The hard rule

All AITP protocol logic — keygen, manifest construction, the handshake state machine, TCT issuance and verification, delegation, revocation semantics — lives in the aitp Python SDK (PyPI distribution aitp-sdk, built from aitp-rs/bindings/aitp-py). Nothing in this repo parses an envelope, canonicalizes JSON, or signs an AITP artifact in src/ or agents/. (The one thing signed outside the SDK is the per-run mock OIDC issuer's ID tokens: trust/oidc_issuer.py makes the issuer keys and agents/base/oidc.py (mint_jwt_for) signs the tokens — an input to the protocol standing in for an external IdP, not an AITP message.) If a future change makes you want to, the SDK is what needs the new API.

The repo imports aitp almost exclusively from inside agent workers (agents/base/bootstrap.py, agents/base/aitp_server.py, agents/base/agent_admin.py, agents/base/oidc.py, agents/base/revocation_refresh.py). The playground service touches the SDK in exactly three places, none of which holds protocol state: the feature probe (capabilities.py, behind GET /capabilities), the pure-SDK spki_pin_check step in the engine, and verify_manifest_json in the engine's cp_provision_trust_anchor step (see "Peer manifest signatures" below).

This page documents the playground side only — where and why the SDK is called from this repo. For the SDK call signatures and the protocol semantics behind them, read the authoritative sources instead of relying on the summaries here:

Each RFC reference below links the specific spec; if a summary here and an RFC ever disagree, the RFC wins.

Where the SDK is actually called

Argument lists below are abbreviated to show which call is made from where; the authoritative signatures are the SDK's aitp.pyi and sdk-python.md.

SDK callCallerPurpose
aitp.AitpAgent.from_seed(bytes)agents/base/bootstrap.pyBuild the agent identity from a deterministic seed.
agent.build_manifest(...)agents/base/bootstrap.pyConstruct the AitpManifest JSON served from /.well-known/aitp-manifest.
agent.new_responder(pinned_keys=…) + process_hello / process_commitagents/base/aitp_server.pyThe responder side of the 4-message handshake. pinned_keys is the agent's trust store (see Trust store).
agent.new_session(pinned_keys=[peer_aid]) + build_hello, process_hello_ack, completeagents/base/agent_admin.py (in /admin/initiate-handshake)The initiator side. peer_aid comes from the peer Manifest it just verified.
agent.verify_tct(tct_token, required_grant, expected_audience=…, revoked_jtis=…)agents/base/aitp_server.py (verify_capability_tct)Per-call authorization on /capabilities/<name>.
agent.build_delegation(voucher_token, delegatee_aid, scope, ttl_secs)agents/base/agent_admin.py (/admin/delegate)Mint a DelegationToken from the grant voucher the handshake returned alongside the TCT (see "Held TCTs").
aitp.verify_delegation(token_json, my_aid, issuer_manifests, revoked_jtis)agents/base/aitp_server.py (/aitp/delegation/redeem)Verify a presented DelegationToken before issuing a fresh TCT. The delegator's key comes from its Manifest in issuer_manifests (RFC-AITP-0007 §1). The deny-set argument is RFC-AITP-0006 §4 step 7 — a revoked source jti MUST refuse a fresh TCT.
agent.issue_tct_for_delegatee(verified)agents/base/aitp_server.py (/aitp/delegation/redeem)Mint the redeemed TCT bound to the delegatee's key.

That covers the core surface. The draft/extension surfaces below add a handful more calls (availability and the runtime probe are covered under Draft and extension surfaces below):

SDK callCallerPurpose
agent.new_session(jwks=…, trust_anchors=…) / agent.new_responder(jwks=…, …)agent_admin.py, aitp_server.pyOIDC-aware handshake sessions — preload a JwksProvider so OIDC peers can be verified.
aitp.JwksProvider(...) + aitp.compute_aid_jkt(aid)agents/base/oidc.pyVerify OIDC ID tokens; bind a token to the agent's key via the cnf.jkt claim. (trust/oidc_issuer.py creates the per-run mock issuer's keys with cryptography, and the worker signs ID tokens with them — neither makes an SDK call.)
agent.verify_tct_cached(tct_token, grant, store, …)aitp_server.py (verify_capability_tct)TCT verification with an aitp.TctStore cache on the hot path.
agent.build_renewal_request(tct_token) / agent.process_renewal_request(req, …)agent_admin.py (/admin/renew-tct, /admin/process-renewal)RFC-AITP-0013 in-band TCT renewal (holder + issuer sides).
aitp.SessionBundleBuilder(agent) + aitp.verify_session_bundle(env, aid, coordinator_manifest)agent_admin.py (/admin/export…, /admin/verify-session-bundle)RFC-AITP-0010 session-bundle export + verify.
aitp.verify_manifest_json(envelope)agent_admin.py (/admin/initiate-handshake, /admin/delegate, /admin/redeem-delegation, /admin/verify-session-bundle), runner/engine.py (cp_provision_trust_anchor), api/hosted.py (trust-peer) — the service's SDK touch-pointsVerify a peer ManifestEnvelope before reading the AID or endpoint out of it.
aitp.verify_revocation_list(envelope, expected_issuer_aid, …)agents/base/revocation_refresh.py (refresh_revocations())Verify a signed revocation snapshot against the pinned issuer AID before any entry is applied (RFC-AITP-0008 §1.5). See "The revocation snapshot has one ingest" below.
aitp.verify_delegation_multihop(token, aid, issuer_manifests, max_hops, revoked_jtis)aitp_server.py (/aitp/delegation/redeem)RFC-AITP-0011 multi-hop delegation verify (replaces verify_delegation when enabled). revoked_jtis is consulted once for the root voucher's src_jti and once per hop (RFC-AITP-0011 §6).
aitp.AitpAgent.generate(suite=…) + agent.build_manifest(...)aitp_server.py (/admin/rotate-keys)Key rotation — fresh keypair + republished manifest (RFC-AITP-0003 §8, Manifest Rotation).
aitp.compute_spki_hash(der) + aitp.SpkiPinVerifier(...)engine (spki_pin_check step)SPKI client-cert pin computation + verification.

Everything else is HTTP plumbing or telemetry. The boundary is: nothing security-relevant is decided outside the SDK — no envelope is canonicalized or signed here, and every trust decision routes through an SDK verify call.

That is deliberately narrower than "no envelope is parsed outside the SDK", which this repo said until it stopped being true. JSON is read outside the SDK in three places, and each is fine only because the SDK made the decision first or the value is not load-bearing:

  • peer manifests are json.loads'd after verify_manifest_json has verified the envelope (agent_admin.py, runner/engine.py);
  • TCT claims are decoded unverified by tct_claims.decode_claims for a precise 403, an issuer guard, and the declared audience — verify_tct is still the gate (see "What you can ignore" below);
  • the revocation snapshot is parsed only after aitp.verify_revocation_list has verified the envelope against the pinned issuer AID (refresh_revocations() in agents/base/revocation_refresh.py).

Parsing is not the property that matters; deciding is.

Each agent's own revocation list (issuer side)

Every agent signs and serves its own list. RFC-AITP-0008 §1.5 makes a revocation list valid only for tokens its signer issued (spec fixture rev-011), so the control plane signs nothing. It records entries and hands them back to their issuer. IssuerRevocationList (agents/base/revocation_publish.py) pulls GET {CP_BASE_URL}/api/revocations?iss=<own AID>, signs the full entry set with the agent's own key (AitpAgent.sign_revocation_list), and AitpServer serves it at GET /.well-known/aitp-revocation-list. That is the path aitp-rs serves ListRevoked at.

sequenceDiagram
    participant R as Runner (revoke_tct, via_cp)
    participant CP as Control plane
    participant I as Issuing agent
    participant V as Verifying peer
    R->>CP: POST /api/revocation/entries {jti, iss}
    R->>I: POST /admin/publish-revocations
    I->>CP: GET /api/revocations?iss=<own AID>
    CP-->>I: {iss, entries}
    I->>I: sign_revocation_list(entries)
    V->>I: GET /.well-known/aitp-revocation-list
    I-->>V: list signed by the issuer

The list is re-signed before the agent reports ready, on every poll (REVOCATION_POLL_SECS), after /admin/rotate-keys, and on POST /admin/publish-revocations. Two rules decide what is served. Both follow from one fact: an empty signed list asserts that nothing is revoked.

  • The CP is unreachable or answers with an error (including its own 503 REVOCATION_UNAVAILABLE): the last list is served unchanged until its signed expires_at (REVOCATION_LIST_TTL_SECS). It is not re-signed, since that would extend a list nobody can currently confirm.
  • No list is in force (never pulled, or expired): the route answers 503 REVOCATION_UNAVAILABLE with Retry-After: 30, never an empty list. A fail_closed verifier then refuses this issuer's tokens.

An answer for a different iss, or one with a non-UUID jti, is refused as a whole, and the last list stays in force. With no control plane configured there is no revocation record anywhere, so the agent serves an empty signed list. Every agent therefore has one.

The Manifest advertises the list as rfc-aitp-0008.revocation_list_uri (build_manifest(revocation_list_uri=...), aitp-sdk 0.20), pointing at <agent origin>/.well-known/aitp-revocation-list, so a peer can find and verify it against the agent's AID without asking anyone else.

Revocation list ingest (verifier side)

An agent enforces its own list, and only after verifying it. An agent verifies the TCTs it issued: a capability call presents a TCT this agent minted at the handshake, and a delegation's source TCT was minted by the redeemer. So the deny-set it enforces is its local revocations plus the list it signs and serves above. That ingest lives in exactly one place, refresh_revocations() in agents/base/revocation_refresh.py: pull and re-sign (IssuerRevocationList.refresh), then aitp.verify_revocation_list against the agent's own AID before reading a single entry, then RevocationState.apply_snapshot. A list that fails to verify is discarded and the previously applied one stays in force (RFC-AITP-0008 §1.5). There is no CP key to pin: the CP signs nothing since CP1.1, so CP_AID is gone.

Three callers reach it: /admin/refresh-revocations, the start-up refresh (before AITP_AGENT_READY) and the background poll, the latter two in-process. If the CP is down, the last applied list stays in force until its signed expires_at; past that, nothing is in force and the posture is degraded, so fail_closed refuses calls rather than treat "no list" as "nothing revoked".

Every SDK verification call passes the effective deny-set explicitly with revocation="fail_closed": verify_tct(_cached), verify_delegation, and the handshake's process_commit (responder) and complete (initiator). Since aitp-sdk 0.20 a call without revoked_jtis raises rather than skipping the check. A TCT handed over in a handshake was minted moments earlier by the peer, so no issuer list can name it yet; the local set still applies.

RevocationState (agents/base/revocation_state.py) only holds that decision; it verifies nothing itself, deliberately, so it cannot become a second hand-rolled trust boundary.

CpClient has no counterpart. It carried a fetch_revocation_list() that parsed the envelope signature-blind, and it was deleted rather than taught to verify: nothing in src/ called it, and two ingest paths for the same signed artifact is the condition that let the signature-blind version survive in the first place. If service-side code ever needs the deny-set, it goes through the verifying path — it does not grow a second one.

Peer manifest signatures

Peer manifest signatures were the same shape of gap and are now checked at all three sites that ingest one: the handshake (/admin/initiate-handshake), delegation (/admin/delegate), and the runner before it pins a key into the CP's trust store (runner/engine.py). Each calls aitp.verify_manifest_json before reading any field out of the envelope.

Note precisely what that establishes: the envelope was minted by the holder of the AID it declares. It is self-certifying, not trust-anchored — it does not prove that AID is the peer you meant. Two consequences worth keeping straight:

  • For did:web, the DID document supplies the manifest endpoint (serviceEndpoint), not a key or an AID (trust/resolver.py). So the chain is DID → endpoint → whatever manifest that endpoint serves.
  • At the runner's CP trust-anchor site the expected AID is known — the runner launched the agent — and the site uses it: after verify_manifest_json passes, runner/engine.py compares the manifest's declared aid against ra.aid, the AID the supervisor read from the spawned process's own AITP_AGENT_READY line over a parent-child pipe, not off the network. A mismatch raises PlaygroundError and the fetch is refused before any key is pinned. This closes the gap authenticity alone leaves open here: launch and manifest-fetch are separate channels, so without the comparison, whatever answers at a launched agent's port — including a substitute that took the port after the real agent died between reporting ready and being provisioned — could serve its own genuinely-signed manifest and have its key trusted as that agent's (D-8).

Identity

Each agent's keypair is derived from a deterministic seed:

seed_hex = SHA256("<org>:<run_id>:<agent_id>")    # hosting/identity.py
  • Same run + same agent_id → same AID, so an agent re-spawned within a run keeps its identity. run_id is a fresh UUID for every POST /runs, so AIDs differ between runs — the seed is deterministic per run, not stable across runs.
  • org: external agents are derived under a separate namespace, so cross-org scenarios produce AIDs that genuinely look like they come from a different org.

The seed lands in bootstrap.aitp.seed_hex; the worker reads it and calls aitp.AitpAgent.from_seed(bytes.fromhex(seed_hex)).

Manifest

agent.build_manifest(...) returns the JSON served from /.well-known/aitp-manifest. The worker passes:

  • display_name from the manifest YAML (spec.aitp.display_name).
  • handshake_endpoint = http://localhost:<port>/aitp/handshake/hello.
  • offered_caps from the manifest YAML.
  • ttl_secs from the manifest YAML.

The wire schema is owned by the SDK (RFC-AITP-0003). The playground only fishes offered_capabilities, handshake_endpoint, aid, and identity_hint.public_key out of it when constructing requests.

Peer discovery (TrustOrchestrator.resolve_peers)

Resolves {agent_id: {manifest_url, did, source?}} based on the scenario's spec.trust.discovery. The spec's discovery guide covers out-of-band configuration, DNS SRV and registries; the did:web resolution below (a DID document carrying an AitpManifest service entry) is the playground's own convention, not something the spec defines. The cp_registry request/response contract is the CP's integration-playground.md. What follows is how the playground applies them:

static

Default. Returns http://localhost:<port>/.well-known/aitp-manifest for every peer. Used by most scenarios.

did_web

For each agent that has did_web_host set:

  1. Build did:web:<host> (URL-encoded port).
  2. GET <scheme>://<host>/.well-known/did.json.
  3. Find the AitpManifest service entry; append /.well-known/aitp-manifest to its serviceEndpoint.
  4. On any failure, fall back to localhost.

The DID document itself is served by the agent's AitpServer when did_web_host was passed in the bootstrap (the cross-cloud scenarios embed localhost:8101 and friends to keep it on-machine).

cp_registry

For agents marked org: external:

  1. Query GET <CP_BASE_URL>/api/registry/agents?capability=<hint> where the hint is the first workflow capability the runner sees for that agent.
  2. If the CP responds with anything, the orchestrator reads the first result's handshakeEndpoint (the CP's camelCase key; the snake_case spelling is also accepted) to derive the manifest URL — see control-plane.md § Discovery.
  3. If the CP is disabled, empty, or fails, fall back to localhost (source: "static_fallback").

CP unavailability is never fatal.

Handshake

The 4-message mutual handshake is RFC-AITP-0004; the SDK calls that drive it are in sdk-python.md § Mutual handshake. What's playground-specific is the HTTP plumbing around those calls — which /admin and /aitp route carries each message:

Initiator (caller)                                Responder (callee)
  /admin/initiate-handshake POST ----.            
                                      \           
  GET peer /.well-known/aitp-manifest  ─\─────►   200 manifest JSON
  verify_manifest_json(manifest)
  session = agent.new_session(pinned_keys=[manifest.aid])
  hello = session.build_hello(manifest, grants)
  POST /aitp/handshake/hello (hello) ─────────►   responder = agent.new_responder(
                                                      pinned_keys=trusted_peer_aids)
                                                  ack, sid = responder.process_hello(hello)
                                       ◄──────── 200 ack + X-Aitp-Session-Id
                                                  (stash responder under sid)
  commit = session.process_hello_ack(ack, sid)
  POST /aitp/handshake/commit (commit) ───────►   responder.process_commit(commit)
                                                  → (final_ack, completed JSON)
                                                  emit handshake.complete (responder)
                                       ◄──────── 200 final_ack
  completed = session.complete(final_ack)   # JSON {"tct", "grant_voucher"}
  held_tcts[peer_port] = completed["tct"]
  held_vouchers[peer_port] = completed["grant_voucher"]  # if present
  emit handshake.complete (initiator)

Under aitp/0.3 the responder's process_commit also returns a TCT (the one its peer issued it), but the worker only reports it in handshake.complete (role="responder") — it never lands in held_tcts. In practice each agent holds the TCT for the direction it initiated. To get the reverse direction the runner triggers /admin/initiate-handshake on the other agent. The _establish_pairwise_trust helper does both directions for every pair when spec.trust.eager: true.

For scenarios that opt out of eager handshakes, explicit handshake steps run one direction at a time and can carry requested_grants to scope the TCT.

TCTs and capability authorization

Under protocol aitp/0.3 the X-AITP-TCT header carries an opaque compact-JWS token. It is not a bearer token: the TCT comes back to the agent that issued it, which is the "issuer as resource server" case of RFC-AITP-0005 §10.5, and the caller must also prove it holds the key of the TCT's sub with downstream proof of possession (§6). When a peer call hits /capabilities/<name>, the worker calls server.verify_capability_tct(tct_token, "<name>", pop_response=...), which in essence does:

# agents/base/aitp_server.py (condensed)
def verify_capability_tct(self, tct_token, required_grant, pop_response=""):
    if not tct_token: raise 403 "missing X-AITP-TCT"
    claims = decode_claims(tct_token)        # unverified claims, for precise 403s
    jti = claims.get("jti", "")
    if jti and self.revocation.is_revoked(jti):
        source = "local" if self.revocation.is_locally_revoked(jti) else "issuer-list"
        raise 403 f"tct revoked ({source}): jti={jti}"
    self._enforce_revocation_freshness()     # 403 unless fail_mode == "soft_fail"
    if claims.get("iss") != self.agent.aid:
        raise 403 "tct issuer mismatch"      # e.g. issued pre-key-rotation
    if not pop_response:                     # §6.1: challenge, single-use, 60 s
        challenge = self.pop_challenges.issue(
            lambda ttl: self.agent.new_pop_challenge(tct_token, ttl))
        raise 401 POP_RESPONSE_INVALID, header x-aitp-pop-challenge=b64url(challenge)
    challenge = self.pop_challenges.consume(response)   # 403 POP_CHALLENGE_INVALID
    return self.agent.verify_tct(            # or verify_tct_cached(...) with a TctStore
        tct_token, required_grant,
        pop=(challenge, response),           # audience pinned to the proven sub
        revoked_jtis=self.revocation.effective_jtis,
        revocation="fail_closed",
    )

The checks, in order:

  1. Local revocation short-circuit (playground choice). The spec (RFC-AITP-0008 §3.3, revocation lookup ordering) places the revocation check after signature verification so a forged jti can't probe the deny set. The demo checks first — every jti in our deny set was observed via a prior handshake, so the early-out is safe and gives a precise 403. It's fail-closed either way: the same union — revocation.effective_jtis, local revocations ∪ the agent's own verified list — is also passed into the SDK as revoked_jtis, which re-checks it after signature verification. The 403 names its source (local vs issuer-list), because "we revoked this here" and "the console revoked this through the control plane" send an operator to different places. (See Revocation below.)
  2. Revocation-freshness guard. Checked after the deny-set, so a genuine revocation keeps its own reason. If revocation verification is configured but there is no fresh verified snapshot, the call is refused under the default fail_mode="fail_closed"; soft_fail proceeds on the last verified deny-set and logs. This is only about the absence of a fresh snapshot — an unverifiable one was already discarded at ingest and no mode here can resurrect it.
  3. Issuer-AID guard (§10.5 item 1). TCTs this resource server issued must declare its AID as iss. After a key rotation the AID changes, so TCTs minted under the old key fail here before the signature path runs.
  4. Downstream PoP challenge (§6.1, §6.3). A call with no x-aitp-pop-response gets a 401 whose x-aitp-pop-challenge header is the base64url (unpadded) JSON of a fresh SDK challenge bound to the TCT's jti, with a 60 s expires_at. The SDK keeps no nonce cache, so agents/base/pop_challenges.py holds outstanding challenges by nonce: the first answer naming a nonce consumes it, valid or not, and an unknown, reused or expired nonce is 403 POP_CHALLENGE_INVALID (RFC-AITP-0001 §5.5). The store is capped at 100 000 outstanding challenges and answers 429 when full, like the handshake replay set. Steps 1–3 run first, so a revoked or foreign TCT never opens a challenge.
  5. SDK verify_tct(..., pop=(challenge, response)). The SDK checks the TCT's signature against iss, every §6.2 step (jti match, nonce echo, expiry, and the signature over the nonce against sub's key), pins the audience to the proven sub, then the deny-set and the grant. There is no expected_audience: the audience comes from the proof, never from the token's own claims, and the SDK refuses both together. A response signed by any key other than sub's is 403 POP_RESPONSE_INVALID. When the wheel exposes aitp.TctStore, the same call routes through verify_tct_cached, which re-checks the PoP on every call. See sdk-python.md § TCT verification.

Posture: PoP is enforced for every grant. This is the default the §6.2 conformance note asks implementations to document. There is no fallback to the bare header: with no channel binding between the agents, §10.5 requires the issuer to reject a TCT presented without PoP.

Every other failure is a 403. The two parse failures (missing token, malformed token) are reported distinctly so debugging is easier.

Held TCTs

Each agent process holds a dict held_tcts: {peer_port: tct_token} (compact-JWS strings) populated by /admin/initiate-handshake, /admin/renew-tct and /admin/redeem-delegation. A sibling map, held_vouchers: {peer_port: grant_voucher}, keeps the grant voucher the SDK returns next to each TCT ({"tct", "grant_voucher"}) — it is what /admin/delegate builds a delegation from. Both maps are module-scoped — all requests in this process see the same set.

/admin/invoke looks up held_tcts[peer_port] and attaches it as X-AITP-TCT on the request to /capabilities/<name>. The peer answers that first call with a 401 and a PoP challenge; /admin/invoke signs it with agent.sign_pop_response and resends the same body once, with the answer in x-aitp-pop-response. If the held TCT was revoked or expired, the peer 403s before issuing any challenge; the admin router wraps any non-2xx into {error:true, status_code, body} so probe steps can observe it without crashing the run.

Trust store

aitp-sdk 0.14 removed possession-only admission: a pinned_key peer is admitted only if its AID is in the session's pinned_keys trust store, and an empty store rejects everyone. The playground never fills the store from the AID a HELLO claims. Instead:

  • Initiator: the AID of the peer Manifest it fetched and verified just before building the HELLO. It also refuses a HELLO_ACK signed by anyone else.
  • Responder (runner-launched agents): after spawning, the runner POSTs every other agent's AID to each agent's /admin/trust-peers ({"aids": [...], "replace": true}) and emits trust.peers_pinned. The AIDs come from each child's AITP_AGENT_READY pipe line, the channel the runner already trusts for ports and AIDs. After a rotate_keys step it pushes again with the new AID.
  • Responder (hosted agents): a remote org's AID cannot be known up front, so an operator calls POST /hosted-agents/{id}/trust-peer with the peer's did:web. The service resolves it (same fail-closed rules as resolve-and-handshake), verifies the Manifest there, and pins the AID it declares. A handshake from an unprovisioned peer fails with pinned_key not in local trust store.

Like every /admin route, /admin/trust-peers needs the agent's admin token in X-Aitp-Admin-Token and returns 401 without it (DECISIONS.md D-23). It asks the SDK to validate the new set before adopting it, so a malformed AID is a 400 and leaves the store unchanged. See DECISIONS.md D-22.

Delegation (RFC-AITP-0006)

Delegation semantics — scope narrowing, the cnf key binding, redemption — are RFC-AITP-0006 and sdk-python.md § Delegation. The playground-specific part is the HTTP choreography across two agents:

Single-hop delegation flow:

delegator (researcher)            delegatee (sub-researcher)        verifier (writer)
  holds TCT_AB + grant voucher                                      
  issued by writer for {write.content}                              
  /admin/delegate                                                   
    build_delegation(voucher_AB,                                    
      sub.aid, scope=[write.content], ttl)                          
    → DelegationToken (DT)                                          
  ── returns DT ──►          (DT in hand)
                              /admin/redeem-delegation              
                                fetch + verify researcher Manifest
                                POST DT + issuer_manifests ───────►
                                  to writer /aitp/delegation/redeem
                                                                    verify_delegation(DT, writer.aid,
                                                                      issuer_manifests, deny_set)
                                                                    issue_tct_for_delegatee(verified)
                                                                    → TCT_BC bound to sub's key
                              ◄── fresh TCT_BC ──────────────────── 
                              held_tcts[writer_port] = TCT_BC      
                              /admin/invoke (writer, write.content)
                                presents TCT_BC ──────────────────► verify_capability_tct(TCT_BC, "write.content")
                                                                    ✓

Playground-relevant notes (the SDK enforces the rules; the playground just sequences the calls):

  • /admin/delegate feeds the delegator's held grant voucher (not the TCT) into build_delegation, and a 412 means no voucher is held for that peer; the SDK rejects a scope wider than the voucher's grants, so a scenario can only narrow. The delegatee's key binding is derived from its AID, so no public key is passed.
  • /aitp/delegation/redeem only issues if this agent is the token's original grantor (the SDK's verify_delegation(token, my_aid, …) check) — an agent can't redeem a chain it never authored. It performs no proof-of-possession challenge, which RFC-AITP-0006 §4 step 9 requires; the handler marks this a demo simplification (the issued TCT is bound to the delegatee's key, so replaying a stolen token only yields a TCT the thief cannot present). The RFC lets an implementation skip the exchange only with an equivalent channel binding, and requires it to document that posture — do not copy this shortcut into a real resource server.
  • The redeemer needs every issuer's Manifest (aitp-sdk >= 0.16): the delegator's key comes from its verified Manifest, never from the token. The engine records each delegate step's issuer_manifest_urls (the delegator's, after any chain the delegator itself redeemed into) and forwards them to /admin/redeem-delegation. The delegatee fetches and verifies each one and POSTs the JSON as issuer_manifests. A request without them is a 400. A Manifest that does not designate the issuer fails as KEY_RESOLUTION_FAILED, a 403.
  • The redeemed TCT lands in the delegatee's held_tcts[target_port], so the next /admin/invoke from delegatee → target presents it automatically.

Revocation (RFC-AITP-0008)

Revocation starts local to the issuer, and its own signed list can add to it:

  1. The runner's revoke_tct step finds the jti of the TCT issuer granted to audience by walking the event log (ScenarioRunner._find_tct_jti) and POSTs it to the issuer's /admin/revoke-tct.
  2. The issuer records it as a local revocation on the shared RevocationState that AitpServer enforces against. Local revocations are held apart from the list-derived entries and are never cleared by a refresh — a CP answer cannot un-revoke what an operator revoked here.
  3. Subsequent capability calls that present that jti hit the local revocation short-circuit and 403.

By default no revocation list is published over the wire — local deny-set fail-closed is all the base demo needs (RFC-AITP-0008 defines the signed-list distribution model). The revoke_tct step's via_cp: true mode exercises the CP path — record the entry at the Control Plane under its issuer, then have the issuer pull it into its own signed list at /.well-known/aitp-revocation-list and apply it after verification. intra-org/revocation-cp-only shows that entry alone refusing a redemption (source revoked (issuer-list)); tests/integration/test_revocation_two_agents.py shows it rejecting a capability call within one poll interval and surviving a CP outage until the list expires. See control-plane.md.

Draft and extension surfaces

These are optional SDK features rather than part of the minimal handshake/TCT path. Some ride on core RFCs (OIDC identity, manifest rotation, the TCT verification cache); others are outside the v0.2 core conformance set — the RFC index marks RFC-AITP-0010 and 0011 as Draft/opt-in and 0013 as Planned. The published aitp-sdk wheel includes OIDC identity, the TCT verification cache and SPKI pinning. TCT renewal, session bundles and multi-hop delegation are experimental-* features, available only in a source build (maturin develop --features experimental; feature flags: aitp-py README § Cargo features). The playground's image and compose stacks build the SDK from the locked sdist with AITP_SDK_SOURCE=pypi-src and AITP_SDK_FEATURES=experimental, so all of them are on there. A native uv sync installs the published wheel, where GET /capabilities reports those three as false and their scenarios degrade cleanly (capabilities.md). The SDK mechanics are in sdk-python.md § OIDC identity and § Experimental (build from source); below is only what the playground wires up and which scenario shows it.

SurfacePlayground wiring (the part that's ours)ScenarioSpec
OIDC identityThe engine mints a per-run mock OIDC issuer (trust/oidc_issuer.py) and threads its key material through every bootstrap; OIDC agents sign via an oidc_mint_jwt callback, pinned-key agents still get a JwksProvider to verify OIDC peers. Each agent's manifest lists its accepted_identity_types (build_manifest, default [own type]; RFC-AITP-0004 §5.1 step 8), so both sides of the mixed pair list [pinned_key, oidc]. Real deployments swap in an external IdP.intra-org/oidc-identity (+ p256-suite template)RFC-AITP-0002 · sdk-python.md
Key rotation/admin/rotate-keys regenerates the key + republishes the manifest; verify_capability_tct's issuer-AID guard then rejects TCTs minted under the old AID before the SDK is consulted.intra-org/key-rotationRFC-AITP-0003 §8 (Manifest Rotation) · operational guidance
TCT renewalHolder's /admin/renew-tct → issuer's /admin/process-renewal; the holder swaps its held TCT in place.intra-org/tct-renewalRFC-AITP-0013
TCT verification cacheWhen aitp.TctStore exists, verify_capability_tct routes through verify_tct_cached; tct_cache_stats exposes hit/miss counters.intra-org/tct-cache-perfRFC-AITP-0005
Session bundlesA coordinator's /admin/export-session-bundle packages the TCTs it issued; a verifier's /admin/verify-session-bundle returns the BundleOutcome.intra-org/session-bundleRFC-AITP-0010
Multi-hop delegationThe redeem endpoint swaps verify_delegation for verify_delegation_multihop when available. (The delegation-multihop scenario chains single-hop delegations through /admin/delegate + /admin/redeem-delegation; it does not encode an RFC-AITP-0011 chain in the token.)intra-org/delegation-multihopRFC-AITP-0011
SPKI pinningA pure-SDK spki_pin_check step — no agent involved.intra-org/spki-pinningsdk-python.md § SPKI cert pinning

What you can ignore (boundary check)

If you find yourself wanting to do any of these in this repo, the SDK should be doing it instead:

  • Parse a TCT to inspect grants (workers read the unverified claims via the shared decode_claims helper only for the revocation short-circuit, the issuer-AID guard, and the declared audience; everything security-relevant routes through verify_tct).
  • Canonicalize JSON for signing.
  • Verify a signature — in src/ or agents/. Test code is the one carve-out, and it is deliberate: when the SDK itself is the thing under test, verifying with the SDK is circular. It would pass under any self-consistent convention, including a wrong one — which is exactly how a wrapped-form revocation signing input survived a full release across this family before 0.5.0. tests/unit/test_revocation_signing_convention.py therefore verifies with cryptography plus an independent RFC 8785 canonicalizer vendored in tests/unit/_jcs_reference.py. The same carve-out covers tests/unit/test_tct_claim_shape_convention.py (which mints TCTs with cryptography and verifies them with the wheel, to pin the claim shapes against a non-wheel minter) and tests/unit/test_pinned_key_proof_convention.py. The oracle has to be independent of the artifact under test. Do not "fix" that into circularity.
  • Build any AITP message by hand in src/ or agents/ (the test oracles above are the only exception).
  • Track handshake state across multiple requests (the responder map in AitpServer._sessions is keyed by session_id from the SDK, not state we own).

The playground exists to drive scenarios; the SDK exists to enforce the protocol. Keep the wall solid.