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.0.tar.gz (27.8 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.0-py3-none-any.whl (37.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: capsule_trace-0.1.0.tar.gz
  • Upload date:
  • Size: 27.8 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.0.tar.gz
Algorithm Hash digest
SHA256 a09ba39269c67c2c68d56f82b5b599e11292698b97ca6bd76bd2e7577f442d21
MD5 df0128d072941c92f4c3e57fd00d6505
BLAKE2b-256 1f5d4d285cf68dba82bc84e1cb73274376cfe9c10fae16e579133cfcce3f04d5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: capsule_trace-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 37.5 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7fd5f087cfb6249a9a868cb667aa831e8364411e12114244667b5378a11582c9
MD5 274524973068b339348ca203b90d8eaf
BLAKE2b-256 0c50ffdd3c06491fffc615b12c67a9e52529348c273bdee912d339355e7c7f68

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