Skip to main content

Deterministic replay & time-travel debugger for AI agents

Project description

capsule-trace

Deterministic replay & time-travel debugger for AI agents.

pip install capsule-trace

Quick Start

import capsule_trace

@capsule.trace(agent_name="my-agent")
def run_agent(query: str) -> str:
    from openai import OpenAI
    client = OpenAI()
    response = client.chat.completions.create(
        model="gpt-4o",
        messages=[{"role": "user", "content": query}],
    )
    return response.choices[0].message.content

That's it. Every LLM call is now captured automatically.

CLI

# List captured sessions
capsule-trace list

# Inspect a session step by step
capsule-trace show ses_01HXYZ123

# Export to shareable file
capsule-trace export ses_01HXYZ123 --output bug.capsule

# Replay deterministically
capsule-trace replay ses_01HXYZ123

# Branch from step 7 with different temperature
capsule-trace branch ses_01HXYZ123 --from-step 7 --modify temperature=0.0

# Diff two sessions
capsule-trace diff ses_01HXYZ ses_01HABC

Supported Providers

Provider Status
OpenAI (sync + async) ✅ Sprint 2
Anthropic (sync + async) ✅ Sprint 2
Google Generative AI ✅ Sprint 2
LangChain Sprint 4
LangGraph Sprint 4

Disable at Runtime

CAPSULE_DISABLE=1 python my_agent.py

Zero overhead when disabled — checked once at function entry.

License

Apache 2.0 — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

capsule_trace-0.1.1.tar.gz (29.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

capsule_trace-0.1.1-py3-none-any.whl (39.0 kB view details)

Uploaded Python 3

File details

Details for the file capsule_trace-0.1.1.tar.gz.

File metadata

  • Download URL: capsule_trace-0.1.1.tar.gz
  • Upload date:
  • Size: 29.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for capsule_trace-0.1.1.tar.gz
Algorithm Hash digest
SHA256 dd955e6e4f3ba32fccf9aa96282845e3e48aea6589eea575c09821db64b1e7c4
MD5 8b189bf2d62c333530b55adef3b208fd
BLAKE2b-256 ca03787a3f3c45aa5b2c64f7296a9b1a1def24d7429902523922449f84646df6

See more details on using hashes here.

File details

Details for the file capsule_trace-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: capsule_trace-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 39.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for capsule_trace-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9161645c6b0434fd958d6201938a05129e910633fafed3e5554f5bef83ccc200
MD5 153198a426fbe606280bce1b95468100
BLAKE2b-256 2d7aeb8b5e8ab8e684a17a76dfa0dee85c8a041a27ffbba61e16c41ab31ef9a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page