Skip to Content
Quickstart (capsule-emit)

Quickstart: seal your first capsule

From install to a signed, verified record in a few minutes — using seal(), the canonical one-call API — and to a witnessed one with one setting.

1. Install

pip install capsule-emit
Where you start matters. seal() signs by default, async and non-blocking — no signup, no key. Out of the box nothing leaves your process: you get a signed, structured record in a local ledger store you can verify offline, and your checkpoints stay self-attested until you name a witness. One config change, CAPSULE_WITNESS_URL, sends them to a witness when you’re ready. See the adoption ladder.

2. Seal an action

Call seal() once at each consequential action — the payload is the first positional argument, never a keyword. action, operator, developer, and agent_output are what you’ll always pass; model, verdict, and effect are optional (adapters fill in what they can — the MCP adapter, for example, sees the tool boundary, not the LLM, so pass model explicitly there if you want it sealed).

from capsule_emit import seal def place(vendor, total, po_number): # stand-in for your tool logic return {"po_number": po_number, "status": "accepted"} result = place("Frobozz Supply", "4210.00", "PO-0047") cap = seal( {"vendor": "Frobozz Supply", "total": "4210.00"}, # payload — first arg; monetary values are strings, not floats action="submit_order", operator="acme-co", # accountable tenant developer="po-agent@v1", # agent identity + version agent_output=result, model={"provider": "example-provider", "model_id": "example-model"}, verdict="executed", # a verdict_class: executed | blocked | denied | … effect={"type": "submit_order", "status": "dispatched"}, ) print(cap.capsule_id, cap.signature) # sealed and signed; recorded in ./capsule-ledger/
Adapter shortcut: if you use MCP, LangChain, CrewAI, or Goose, a thin adapter seals on every tool call — the fields above are what every adapter fills in automatically. See the capsule-emit adapter docs.

3. Where it’s witnessed

Every seal() folds the capsule into your ledger’s checkpoint stream: roughly every 100 entries (or 15 minutes), a signed checkpoint of the whole ledger — never capsule content — is cut. Where it goes is your choice: with no witness named, it stays in your process, self-attested, and seal() prints a one-time notice saying so. Set CAPSULE_WITNESS_URL (or pass witness_url=…) to a witness you choose — the public one, a SCITT Transparency Service at witness.agentactioncapsule.org  (CAPSULE_WITNESS_URL=https://witness.agentactioncapsule.org, no signup, no key), or your own. Set CAPSULE_WITNESS=off (or pass witness=False) to seal fully offline and silence the notice. The older per-capsule anchor channel (cap.anchored, anchor=True / CAPSULE_ANCHOR=legacy-on) is a legacy, explicit opt-in kept only as a rollback path — it has not been the default egress path since 0.5.0. See the adoption ladder for the full rung-by-rung path.

4. Verify

Each seal() also writes the sealed capsule to a ledger store directory, ./capsule-ledger/ by default (its signing key sits beside it as capsule-ledger.signing_key.pem) — that’s what you verify, offline:

# verify the ledger store, offline — no keys or network needed capsule-emit verify --store ./capsule-ledger VALID 1/1 VALID
Two verify surfaces, not one: agent-action-capsule verify (the spec package’s own CLI, bundled as a capsule-emit dependency) checks structural/digest conformance only. capsule-emit verify runs that same check plus the producer-envelope check: a capsule with an altered signature but an otherwise-untouched digest still reads ok under agent-action-capsule verify and fails INVALID under capsule-emit verify. Use capsule-emit verify —store for the full check.

Adapters: seal from your framework

You don’t have to call seal() by hand. Thin adapters seal one capsule per tool call across the framework you already use — MCP / any callable (a decorator), LangChain / LangGraph (a callback), CrewAI (a tool wrap), and Goose (companion MCP server or @emitter.tool() decorator, verified against Goose v1.39.0). A gateway integration (agentgateway) seals at the chokepoint every consequential action flows through — one policy point instead of N integrations (via the gateway’s mcpGuardrails ExtMcp hook). Any custom loop works via one call at the tool boundary. Per-framework guides: docs/adapters/  — including the Goose extension  and the agentgateway adapter .

Next: verify a capsule in detail — the hosted verifier, command line, and what each check covers.
Go deeper — implementation & usage docs in capsule-emit: Tutorial: your first capsule ↗ · Confirming & chaining ↗