How it worksThe .capsule fileFeaturesCompliance
Deterministic replay · time-travel debugging

Rewind any agent.
Replay every decision.

Capsule captures every LLM call, tool use, and state change your AI agent makes — and packages it into a portable .capsule file you can replay, branch, and share.

$pip install capsule-trace
SOC 2 in progressEU AI Act readySelf-host available
checkout-agent · sess_8f2a91c4failed
LLM · planstep 01 / 08

Decompose user request into ordered subtasks.

tokens
1,284
cost
$0.0042
latency
820ms
01/08
How it works

Four steps from failure to fix.

Capsule turns a non-deterministic black box into something you can rewind, inspect, and reproduce on demand.

01

Capture

One decorator wraps your agent. Every LLM call, tool use, and memory write is recorded — zero code changes.

@capsule.trace
def agent(input):
    ...
02

Replay

Re-run any failure deterministically from stored cassettes — no live API calls, bit-exact output.

$ capsule-trace replay \
    sess_8f2a
03

Branch

Fork at any step. Swap a prompt, model, or tool response and run the alternative live.

$ capsule-trace branch \
    --from-step 5
04

Share

Export a portable .capsule file and attach it to any bug report. Reproducible anywhere.

$ capsule-trace export \
    --out bug.capsule
checkout-agent-fail.capsule2.4 MB
manifestv1.0 · sha256 verified ✓
events23 steps · llm · tool · memory
cassettes11 stored responses · offline replay
snapshots3 memory states · zstd compressed
integrityhash match · deterministic ✓
The .capsule file

One file. The entire execution.

  • Self-describing & portable

    A single compressed archive holding every event, cassette, and snapshot. No external metadata, no database required.

  • Cryptographically verifiable

    SHA-256 integrity hashes guarantee the capsule replays bit-exact — the same on any machine, any Python version.

  • An open standard

    The format is fully specified and open-source. Attach a .capsule to a bug report the way you attach a screenshot today.

Features

Everything you need to understand your agents.

Deterministic capture

One pip install. Every LLM call, tool execution, and state mutation recorded automatically.

Time-travel replay

Scrub through any session with millisecond precision. Pause and inspect the exact world state.

Branch & experiment

Fork any session at any step. Swap a model or prompt, run the branch, compare outputs side-by-side.

Failure intelligence

Automatic root-cause tagging for LLM timeouts, tool errors, context overflows, and schema mismatches.

Cost analytics

Per-session and per-step token costs by model, project, and time range. Know where budget goes.

Framework-agnostic

LangChain, LlamaIndex, AutoGen, raw OpenAI/Anthropic, or custom. If it calls an LLM, Capsule captures it.

Built for engineers

Replay from your terminal.

A complete CLI ships with the SDK. Capture, list, replay, branch, diff, and export — all scriptable with --json output.

Get started
zsh
# replay a failed production session
$ capsule-trace replay sess_8f2a91c4
  ✓ 23 steps · hash match · 0.31s

# branch at the failing step
$ capsule-trace branch sess_8f2a91c4 --from-step 5
  ↳ branch fix-schema created

# export a portable bug report
$ capsule-trace export sess_8f2a91c4 --out bug.capsule
  ✓ wrote bug.capsule (2.4 MB)
Compliance

Audit-ready from day one.

Every capsule is a signed, immutable record — built for regulated teams in fintech, insurance, and legal AI.

EU AI Act

Article 12 logging — signed, exportable audit trails.

SOC 2 in progress

Type II controls underway across security and availability.

GDPR

Configurable PII redaction at capture time.

Self-host

Air-gapped Docker / VPC deployment, your keys.

Stop guessing why your agent broke.

Capture your next production failure as a replayable .capsule — and rewind your way to the root cause.