Metadata-Version: 2.4
Name: ai-agent-vcr
Version: 1.6.0
Summary: The undo button for coding agents: record runs, roll back state and files, replay verified work, and gate regressions in CI.
Project-URL: Homepage, https://github.com/ixchio/agent-vcr
Project-URL: Documentation, https://ixchio.github.io/agent-vcr/
Project-URL: Repository, https://github.com/ixchio/agent-vcr
Project-URL: Issues, https://github.com/ixchio/agent-vcr/issues
Project-URL: Changelog, https://github.com/ixchio/agent-vcr/blob/main/CHANGELOG.md
Author-email: ixchio <amankumarpandeyin@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: acid-transactions,agent-airbag,agent-checkpoint,agent-framework,agent-orchestration,agent-rollback,agent-vcr,agentic-workflow,ai-agent-debugging,ai-agent-rollback,ai-agent-testing,ai-agent-undo,claude-code,codex,coding-agent-safety,crewai,ghost-replay,langchain,langgraph,langgraph-time-travel,llm-debugging,llm-observability,multi-agent,openhands,prompt-debugging,time-travel-debugging
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Debuggers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Software Development :: Version Control :: Git
Requires-Python: >=3.9
Requires-Dist: aiofiles>=23.0.0
Requires-Dist: eval-type-backport>=0.2.0; python_version < '3.10'
Requires-Dist: pydantic>=2.0.0
Provides-Extra: all
Requires-Dist: crewai>=0.28.0; extra == 'all'
Requires-Dist: e2b>=2.46.0; extra == 'all'
Requires-Dist: fastapi>=0.104.0; extra == 'all'
Requires-Dist: inngest>=0.5.0; extra == 'all'
Requires-Dist: langchain>=0.1.0; extra == 'all'
Requires-Dist: langgraph>=0.0.20; extra == 'all'
Requires-Dist: litellm>=1.100.0; extra == 'all'
Requires-Dist: openhands-ai>=0.30.0; extra == 'all'
Requires-Dist: psycopg[binary]>=3.2.0; extra == 'all'
Requires-Dist: pyjwt[crypto]>=2.10.1; extra == 'all'
Requires-Dist: python-multipart>=0.0.9; extra == 'all'
Requires-Dist: qdrant-client>=1.19.0; extra == 'all'
Requires-Dist: rich>=13.0.0; extra == 'all'
Requires-Dist: stripe>=12.0.0; extra == 'all'
Requires-Dist: textual>=0.40.0; extra == 'all'
Requires-Dist: uvicorn>=0.24.0; extra == 'all'
Requires-Dist: watchdog>=3.0.0; extra == 'all'
Requires-Dist: websockets>=12.0; extra == 'all'
Provides-Extra: cloud
Requires-Dist: e2b>=2.46.0; extra == 'cloud'
Requires-Dist: inngest>=0.5.0; extra == 'cloud'
Requires-Dist: litellm>=1.100.0; extra == 'cloud'
Requires-Dist: qdrant-client>=1.19.0; extra == 'cloud'
Provides-Extra: crewai
Requires-Dist: crewai>=0.28.0; extra == 'crewai'
Provides-Extra: dashboard
Requires-Dist: fastapi>=0.104.0; extra == 'dashboard'
Requires-Dist: python-multipart>=0.0.9; extra == 'dashboard'
Requires-Dist: uvicorn>=0.24.0; extra == 'dashboard'
Requires-Dist: watchdog>=3.0.0; extra == 'dashboard'
Requires-Dist: websockets>=12.0; extra == 'dashboard'
Provides-Extra: dev
Requires-Dist: black>=23.0.0; extra == 'dev'
Requires-Dist: build>=1.0.0; extra == 'dev'
Requires-Dist: fastapi>=0.104.0; extra == 'dev'
Requires-Dist: httpx>=0.25.0; extra == 'dev'
Requires-Dist: mypy>=1.6.0; extra == 'dev'
Requires-Dist: pre-commit>=3.5.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
Requires-Dist: pytest-benchmark>=4.0.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
Requires-Dist: pytest>=7.4.0; extra == 'dev'
Requires-Dist: python-multipart>=0.0.9; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Requires-Dist: twine>=4.0.0; extra == 'dev'
Requires-Dist: types-aiofiles>=23.2.0.20240417; extra == 'dev'
Requires-Dist: uvicorn>=0.24.0; extra == 'dev'
Requires-Dist: watchdog>=3.0.0; extra == 'dev'
Requires-Dist: websockets>=12.0; extra == 'dev'
Provides-Extra: hosted
Requires-Dist: psycopg[binary]>=3.2.0; extra == 'hosted'
Requires-Dist: pyjwt[crypto]>=2.10.1; extra == 'hosted'
Requires-Dist: stripe>=12.0.0; extra == 'hosted'
Provides-Extra: inngest
Requires-Dist: inngest>=0.5.0; extra == 'inngest'
Provides-Extra: langchain
Requires-Dist: langchain>=0.1.0; extra == 'langchain'
Provides-Extra: langgraph
Requires-Dist: langgraph>=0.0.20; extra == 'langgraph'
Provides-Extra: llm
Requires-Dist: litellm>=1.100.0; extra == 'llm'
Provides-Extra: openhands
Requires-Dist: openhands-ai>=0.30.0; extra == 'openhands'
Provides-Extra: sandbox
Requires-Dist: e2b>=2.46.0; extra == 'sandbox'
Provides-Extra: tui
Requires-Dist: rich>=13.0.0; extra == 'tui'
Requires-Dist: textual>=0.40.0; extra == 'tui'
Provides-Extra: vector
Requires-Dist: qdrant-client>=1.19.0; extra == 'vector'
Description-Content-Type: text/markdown

# Agent VCR

[![PyPI Version](https://img.shields.io/pypi/v/ai-agent-vcr?style=flat-square&label=PyPI)](https://pypi.org/project/ai-agent-vcr/)
[![PyPI Downloads](https://static.pepy.tech/personalized-badge/ai-agent-vcr?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads)](https://pepy.tech/projects/ai-agent-vcr)
[![Python Versions](https://img.shields.io/pypi/pyversions/ai-agent-vcr?style=flat-square)](https://pypi.org/project/ai-agent-vcr/)
[![CI](https://github.com/ixchio/agent-vcr/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/ixchio/agent-vcr/actions/workflows/ci.yml)
[![MIT License](https://img.shields.io/pypi/l/ai-agent-vcr?style=flat-square)](https://github.com/ixchio/agent-vcr/blob/main/LICENSE)

**The undo button for AI agents.** Undo anything your coding agent did — including `rm -rf`
from the shell — record and rewind agent runs, replay verified work without model calls, and
gate agent regressions in CI.

```bash
pip install ai-agent-vcr
vcr airbag install        # hooks for every coding agent on your PATH
vcr undo                  # the agent deleted something? bring it back
```

No model key, account, or framework required. Everything stays on your machine.

![Agent VCR recording, rollback, and replay demo](https://raw.githubusercontent.com/ixchio/agent-vcr/main/docs/demo.gif)

## Why

Coding agents run shell commands. The built-in "rewind" in agent tools only tracks the agent's
own file-edit tool — Claude Code's docs say file changes made by Bash are not tracked, and
Gemini CLI's checkpoints cover only its edit tools. So `rm -rf`, `git reset --hard`,
`sed -i`, a migration against your local SQLite file, or an over-eager "cleanup" can destroy
work that no undo button sees.

Agent VCR's **airbag** snapshots your project *before every tool call* — shell commands
included — and `vcr undo` restores it. Commands a snapshot cannot undo (remote databases,
`terraform destroy`, force-pushes, `npm publish`) are stopped so a human can confirm.

## The airbag in 30 seconds

```text
$ vcr airbag install claude
  ✓ Claude Code: .claude/settings.json

# ...the agent decides to "clean up" and runs `rm -rf ~/code/myapp`...
🛟 Agent VCR airbag: snapshot #1 saved before `rm -rf ~/code/myapp`. Undo with `vcr undo`.

$ vcr undo --project-dir ~/code/myapp
↩ Undid: rm -rf ~/code/myapp  (claude, 12s ago)
  restored 5 files — back to snapshot #1.
    + .claude/settings.json
    + .env
    + .gitignore
    + src/billing.py
    + .git/
  Changed your mind? `vcr redo`
```

Your uncommitted edits, your git-ignored `.env`, and your git history are back. Try it
yourself without an agent: [`examples/airbag_demo.sh`](https://github.com/ixchio/agent-vcr/blob/main/examples/airbag_demo.sh),
or classify any command:

```text
$ vcr airbag check "psql -h prod-db.internal -c 'DROP TABLE invoices'"
⚠ IRREVERSIBLE: cannot be undone by a snapshot — the airbag asks a human first
   • SQL DROP on a remote database (prod-db.internal) — server data is not in your project files
```

### Supported agents

| Agent | Install | Commands a snapshot cannot undo |
|---|---|---|
| Claude Code | `vcr airbag install claude` | asks you |
| OpenAI Codex CLI | `vcr airbag install codex` | blocked until `vcr airbag allow` |
| Gemini CLI | `vcr airbag install gemini` | asks you (≥ 0.36) |
| Cursor (IDE + CLI) | `vcr airbag install cursor` | blocked until `vcr airbag allow` |
| GitHub Copilot CLI | `vcr airbag install copilot` | asks you |
| OpenHands | `vcr airbag install openhands` or the [Python integration](https://github.com/ixchio/agent-vcr/blob/main/docs/airbag.md#supported-agents) | blocked, or asks with `confirm=True` |
| OpenCode 1.x | `vcr airbag install opencode` | blocked until `vcr airbag allow` |
| Cline | `vcr airbag install cline` | task stopped |
| Devin Local (ex-Windsurf) | `vcr airbag install devin` | blocked until `vcr airbag allow` |
| Anything else | `vcr airbag run -- aider` | snapshots every 2 s (no interception) |

**What it protects:** tracked and untracked files, small ignored "precious" files (`.env*`,
SQLite databases — copied consistently even while open), and your `.git` when a command would
delete or damage it. Snapshots live in a private git store **outside** the project, so deleting
the project cannot delete them, and your own `.git` is never touched.
**What it cannot undo:** anything outside the project, server databases, cloud resources,
pushed commits, sent requests. Those are stopped for confirmation. Details and limits:
[docs/airbag.md](https://github.com/ixchio/agent-vcr/blob/main/docs/airbag.md).

| Command | |
|---|---|
| `vcr undo [N]` · `vcr redo` | undo / redo the last agent action that changed files |
| `vcr rewind` · `vcr rewind 12` | timeline of snapshots · restore snapshot #12 |
| `vcr airbag check "<cmd>"` | classify a command without running it |
| `vcr airbag allow` | approve a stopped command for one retry |
| `vcr airbag status` · `vcr airbag gc` | installed hooks and store · delete old snapshots |

## More than an undo button

### Record and time-travel agent runs

Every step — state in, state out, tool calls, model calls, cost, latency, errors — is a frame in
an append-only JSONL file you can open, diff, bundle, and replay.

```python
from agent_vcr import VCRPlayer, VCRRecorder

recorder = VCRRecorder(output_dir=".vcr")
recorder.start_session("billing-fix")
recorder.record_step("planner", {"task": "add invoice status"}, {"plan": "migration first"})
recorder.record_checkpoint({"plan": "migration first"}, label="plan-approved")
path = recorder.save()

player = VCRPlayer.load(path)
player.goto_checkpoint("plan-approved")   # jump to any frame or checkpoint
player.verify_integrity()                 # durability checks
```

Fork a run from any frame, edit state, and resume; compare frames; open a recording in the
terminal debugger with `vcr path/to/run.vcr`.

### Roll back files and state together in your own agent

`ACIDWorkspace` gives Python agents transactions over a git repository: savepoints pair a git
commit with the agent's state, rollback restores both, and pre-existing untracked files such as
`.env` are escrowed byte-for-byte outside git history.

```python
from agent_vcr.integrations.openhands import ACIDWorkspace

with ACIDWorkspace("/path/to/repo") as ws:          # begin() on enter
    ws.savepoint({"phase": "planned"}, node_name="planner")
    ...                                             # the agent works on an isolated branch
    ws.rollback(to_frame_index=0)                   # rewind files + state to a savepoint
# clean exit → commit (merge); exception → abort (everything restored)
```

### Ghost Replay and Agent CI

Save a verified run as a *golden* run keyed by model, prompt hash, code commit and tool schema;
replay it with zero model calls, re-run only changed steps, and see what you saved. Turn golden
runs into datasets and fail a pull request on behavioral, cost, token or latency regressions:

```bash
vcr dataset create refunds
vcr dataset add refunds --task "refund a duplicate payment" --vcr .vcr/golden/refund.vcr
vcr ci run --dataset refunds --candidates .vcr/candidates --fail-on degraded
```

A reusable GitHub Action is included ([action.yml](https://github.com/ixchio/agent-vcr/blob/main/action.yml)).

### Sentinel

An AST quality guard for agent-written Python: syntax errors, complexity and length spikes,
duplicate functions across files. `sentinel scan .` in CI, or attach it to an OpenHands run.

## Framework integrations

```python
from agent_vcr import VCRRecorder

recorder = VCRRecorder()
recorder.start_session("my-run")      # ... run your agent ..., then recorder.save()
```

```python
# LangGraph — no graph changes: pass the callback per run …
from agent_vcr.integrations.langgraph import LangGraphCallback
app.invoke(inputs, config={"callbacks": [LangGraphCallback(recorder)]})

# … or wrap every node of a StateGraph (before or after compile)
from agent_vcr.integrations.langgraph import VCRLangGraph
graph = VCRLangGraph(recorder).wrap_graph(builder)
```

```python
# CrewAI
from agent_vcr.integrations.crewai import VCRCrewAI, VCRCrewCallback
result = VCRCrewAI(recorder).kickoff(crew)        # or: with VCRCrewCallback(recorder): crew.kickoff()
```

```python
# OpenHands SDK — snapshot before every action, block irreversible ones
from agent_vcr.integrations.openhands_airbag import AirbagCallback, protect
airbag = AirbagCallback()
conversation = Conversation(agent=agent, workspace=ws, callbacks=[airbag])
protect(conversation, airbag)
```

Any other framework: call `record_step`, `record_llm_call`, `record_tool_call`, `record_error`
and `record_checkpoint` from its lifecycle hooks, or forward frames live with
`VCRRecorder(on_frame_recorded=...)`. Guides:
[docs/integrations](https://github.com/ixchio/agent-vcr/blob/main/docs/integrations/README.md).

## Architecture

```text
 coding agents ──hooks/plugins──►  airbag ──► shadow git store (outside the project)
 (Claude Code, Codex, …)            │           └─ vcr undo / redo / rewind
                                    ▼
 frameworks ──callbacks──►  recorder ──► .vcr JSONL (execution/v1) ──► player
 (LangGraph, CrewAI, …)        ▲                                        │
                               │                          Ghost Replay ◄┘──► Agent CI
                      ACIDWorkspace (git transactions + escrow)
```

| Layer | Status |
|---|---|
| Recording kernel (`recorder`, `player`, `execution/v1` schema) | stable — old recordings always load |
| Airbag, ACID workspace, Sentinel | stable API |
| Ghost Replay, datasets, Agent CI, bundles | stable |
| LangGraph / CrewAI / OpenHands / Claude Code integrations | stable — tested against the real libraries |
| Dashboard and self-hosted store (`vcr-server`) | supported |
| SuperAgent, workflows, sandbox, intelligence | experimental — APIs may change |

The full package map and design notes are in
[docs/architecture.md](https://github.com/ixchio/agent-vcr/blob/main/docs/architecture.md).

## Install what you need

```bash
pip install ai-agent-vcr                  # core: recorder, player, airbag, replay, CI
pip install "ai-agent-vcr[tui]"          # terminal debugger
pip install "ai-agent-vcr[dashboard]"    # local dashboard and server
pip install "ai-agent-vcr[langgraph]"    # LangGraph integration
pip install "ai-agent-vcr[crewai]"       # CrewAI integration
pip install "ai-agent-vcr[all]"          # everything optional
```

Python 3.9–3.13. The airbag and ACID workspace need `git` on `PATH`.

## Where it fits

Agent VCR is an **intervention** tool, not an observability platform. LangSmith, Langfuse,
Phoenix and AgentOps observe and evaluate model calls; Agent VCR lets you go back — files, state
and history — after an agent changed them. They work well together. It cannot make third-party
side effects (emails, payments, cloud APIs) transactional; it stops those for confirmation.

## Documentation

- [Airbag](https://github.com/ixchio/agent-vcr/blob/main/docs/airbag.md) — per-agent support, commands, limits
- [Recording, time travel and Ghost Replay](https://github.com/ixchio/agent-vcr/blob/main/docs/recording-and-replay.md)
- [ACID workspace rollback](https://github.com/ixchio/agent-vcr/blob/main/docs/acid-workspace.md)
- [Agent CI regression gates](https://github.com/ixchio/agent-vcr/blob/main/docs/agent-ci.md)
- [Integrations](https://github.com/ixchio/agent-vcr/blob/main/docs/integrations/README.md)
- [Architecture](https://github.com/ixchio/agent-vcr/blob/main/docs/architecture.md)
- [All docs](https://github.com/ixchio/agent-vcr/blob/main/docs/README.md) ·
  [Live site](https://ixchio.github.io/agent-vcr/) ·
  [Examples](https://github.com/ixchio/agent-vcr/blob/main/examples/README.md) ·
  [Changelog](https://github.com/ixchio/agent-vcr/blob/main/CHANGELOG.md)

## Contributing

Issues and pull requests are welcome — new agent integrations especially. See
[CONTRIBUTING.md](https://github.com/ixchio/agent-vcr/blob/main/CONTRIBUTING.md) (including
*Adding an agent to the airbag*), run `make verify`, and include a test with every change.
Please follow the [Code of Conduct](https://github.com/ixchio/agent-vcr/blob/main/CODE_OF_CONDUCT.md)
and report vulnerabilities privately per [SECURITY.md](https://github.com/ixchio/agent-vcr/blob/main/SECURITY.md).

## License

[MIT](https://github.com/ixchio/agent-vcr/blob/main/LICENSE) · Copyright © 2026 QueryXLabs and
[ixchio](https://github.com/ixchio).
