The undo button for AI agents.
Arm the airbag for your coding agent, record and rewind your own agents, replay verified runs without model calls, and gate the next change in CI.
Airbag: undo your coding agent
Snapshot before every tool call โ shell commands included โ for Claude Code, Codex, Gemini CLI, Cursor, Copilot CLI, OpenHands, OpenCode, Cline and Devin. vcr undo brings it back.
Record and time-travel
Capture typed execution frames, inspect state, compare boundaries, resume, and export portable bundles.
FilesystemACID workspace rollback
Restore tracked Git content and eligible pre-existing local files such as ignored .env files.
Identity-aware Ghost Replay
Reuse reviewed outputs on a full identity match and rerun changed work through explicit partial modes.
ReliabilityAgent CI
Compare real candidate recordings with reviewed baselines and enforce state, tool, cost, token, and latency expectations.
ConnectFramework integrations
Use raw Python, LangGraph, CrewAI, OpenHands, Claude Code hooks, n8n, or your own lifecycle adapter.
OperateWorkflows and self-hosting
Add durable workflow state, approvals, compensation, reliability intelligence, and a local dashboard/server.
Quick start
The base install is local-first and needs no model key, hosted account, or framework.
pip install ai-agent-vcr
vcr airbag install
python examples/basic_usage.py
vcr tui .vcr/<session-id>.vcr
Five-minute quickstart โ ยท All docs โ
ai-agent-vcr. The similarly named agent-vcr package on PyPI is a different project.Undo anything your coding agent did
Agents' built-in rewind only tracks their own edit tools. The airbag snapshots your project into a private store outside it before every tool call, so rm -rf, git reset --hard or a bad migration on a local SQLite file can be undone. Commands a snapshot cannot undo โ server databases, cloud deletions, force-pushes โ are stopped for a human.
pip install ai-agent-vcr
vcr airbag install # hooks for every agent on your PATH
# ...the agent runs `rm -rf .`...
vcr undo # files, .env and .git are back
vcr redo # changed your mind
vcr airbag check "psql -h prod -c 'DROP TABLE users'" # โ irreversible
Record a state transition
The recorder is the framework-neutral boundary. A session contains ordered JSONL frames for nodes, model calls, tools, errors, and checkpoints.
from agent_vcr import VCRPlayer, VCRRecorder
recorder = VCRRecorder(output_dir=".vcr")
recorder.start_session("support-triage")
recorder.record_step(
"classify",
{"status": "new"},
{"status": "classified", "priority": "high"},
)
recording = recorder.save()
player = VCRPlayer.load(recording, strict=True)
print(player.goto_frame(0))
print(player.verify_integrity())
Rollback state and files together
ACIDWorkspace combines isolated Git savepoints with private, per-savepoint local-file escrow.
.git/vcr-escrow, outside Git objects and VCR recordings..env is restored at rollback, while later hallucinated local files are removed. Oversized, excluded, and special files are preserved but cannot be reconstructed.- Blobs are immutable and content-addressed as
blobs/<sha256>. - Escrow directories use
0700; regular blobs use0600. - Paths containing
.., absolute paths, and resolved-parent symlink escapes are rejected. - Rollback can run repeatedly before commit; shared blob references stay valid.
Ghost Replay without silent drift
A golden run is selected by the normalized task plus an optional identity covering model, prompt, code, tools, dependencies, environment, and caller-defined fields.
from agent_vcr.golden_cache import GoldenRunCache
cache = GoldenRunCache()
identity = cache.build_identity(
model="provider/model@revision",
prompt_hash="sha256:prompt",
code_commit="0123456789abcdef",
tool_schema_hash="sha256:tools",
)
cache.save_golden_run("triage ticket", recorder, identity=identity)
outputs, ledger = cache.replay("triage ticket", identity=identity)
Nested identity JSON uses canonical sorted-key serialization. Key-order changes do not cause false misses; actual identity changes do.
Gate changes with recorded evidence
Generate candidates with the code under review, then compare them with versioned baseline cases. The gate itself makes no model calls.
vcr dataset create refunds
vcr dataset add refunds \
--task "refund a duplicate payment" \
--case-name duplicate-payment \
--vcr .vcr/reviewed/refund.vcr
vcr ci run \
--dataset refunds \
--candidates .vcr/candidates \
--fail-on degraded \
--report agent-ci-report.json \
--markdown agent-ci-report.md
Connect your agent runtime
vcr init --claude-code.Production building blocks
- Workflow engine โ durable runs, resume, schedules, approvals, retries, and saga compensation.
- SuperAgent โ validated plans, policy, budgets, tool schemas, and output verification.
- Dashboard and self-hosted store โ terminal debugger, local web UI, scoped project tokens.
- FAQ โ what it is, what it isn't, and how it compares.
- Sentinel โ local AST quality analysis and optional OpenHands feedback.
- Railway foundation โ optional auth/billing control plane with an explicit multitenancy boundary.
- Benchmark dashboard โ measured history and local regression ceilings.