Skip to main content

Time-travel debugging for LangGraph agents — record, replay, fork, and catch regressions from a single SQLite file.

Project description

LangGraph Replay

langgraph-replay

Time-travel debugging for LangGraph agents.
Record every step. Replay without API calls. Fork from any checkpoint. Catch regressions before they ship.

PyPI Python License


Install

pip install langgraph-replay

Requires Python 3.10+ and a LangGraph agent.

Why langgraph-replay?

LLM agents are non-deterministic. A prompt tweak or model upgrade can silently break routing, and you only discover it in production. langgraph-replay gives you:

  • Full execution history in a single SQLite file — no external services.
  • Deterministic replay — substitute recorded LLM + tool responses. Zero API calls, instant re-execution.
  • Regression detection — real LLM + recorded tools. If the agent routes differently after a code change, you see exactly where it diverged.
  • Fork from any step — branch, modify inputs, and re-run downstream logic.
  • Built-in dashboard — timeline, state diffs, and one-click replay/fork in your browser.

Quick start

from langgraph_replay import ReplayCheckpointer, ReplayCallbackHandler

checkpointer = ReplayCheckpointer(db_path="replay.db")
handler = ReplayCallbackHandler("replay.db")

graph = workflow.compile(checkpointer=checkpointer)
graph.invoke(
    {"messages": [("user", "What's the weather in Tokyo?")]},
    {"configurable": {"thread_id": "run-1"}, "callbacks": [handler]},
)

Launch the dashboard:

langgraph-replay dev --db replay.db
langgraph-replay dev --db replay.db --graph my_agent:build_graph   # enables Re-run and Fork

Features

Feature Description
Checkpoint timeline Every LangGraph step persisted to SQLite with full state
State diffs Message-level and tool-call diffs between any two steps
Fork Branch from any checkpoint and re-execute downstream
Re-run / Restart Re-execute from step 0 or any mid-run checkpoint
Deterministic replay Recorded LLM + tools — no API calls, instant verification
Regression replay Live LLM + recorded tools — detect routing drift

Dashboard

Action What it does
Re-run Restart the workflow from step 0 with current code
Fork Branch from the selected step with modified inputs
Deterministic Replay with fake LLM + tools — verify routing logic
Regression Replay with real LLM + fake tools — detect divergence

CLI

# Launch dashboard
langgraph-replay dev --db replay.db --graph my_agent:build_graph

# Restart from a specific step
langgraph-replay replay --db replay.db --graph my_agent:build_graph --thread run-1 --from-step 3

# Deterministic replay (no API calls)
langgraph-replay replay --db replay.db --graph my_agent:build_graph --thread run-1 --mode deterministic

# Regression replay (real LLM, recorded tools)
langgraph-replay replay --db replay.db --graph my_agent:build_graph --thread run-1 --mode regression

Python API

from langgraph_replay import (
    ReplayCheckpointer,
    ReplayCallbackHandler,
    StateDiffEngine,
    ForkManager,
    RestartEngine,
    ReplayRunner,
    DivergenceReport,
    serve,
)

# Restart from a checkpoint
RestartEngine("replay.db", graph).restart("run-1", from_step=3)

# Deterministic replay
ReplayRunner("replay.db", graph).replay("run-1", mode="deterministic")

# Regression replay with divergence report
report = ReplayRunner("replay.db", graph).replay("run-1", mode="regression")

Examples

See the examples directory for a runnable chat agent with tools (chat_agent.py).

Links

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

langgraph_replay-0.1.1.tar.gz (177.1 kB view details)

Uploaded Source

Built Distribution

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

langgraph_replay-0.1.1-py3-none-any.whl (183.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langgraph_replay-0.1.1.tar.gz
  • Upload date:
  • Size: 177.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for langgraph_replay-0.1.1.tar.gz
Algorithm Hash digest
SHA256 dd964d4f0d7dc9e48847abeda3008c3873059aad449f6a3317d73c39aecdaa16
MD5 7c5d24370a1e576b5ac939b64fec2f83
BLAKE2b-256 6291e4a19485bfc61153ec48f9785c11f3f8f90e0e970237797fbd020ba501b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for langgraph_replay-0.1.1.tar.gz:

Publisher: release.yml on Devendra116/agent-replay-engine

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for langgraph_replay-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 28627c335b6deac536c5fcc3613c8315cf080aee53bfaf44e86f3610974c3bff
MD5 2216fa4475cdb2579388cedaa272bbc5
BLAKE2b-256 f7c58355b5e0e6eda828d8f2772a5006d1227b341b273f84fcf5538eb52f2413

See more details on using hashes here.

Provenance

The following attestation bundles were made for langgraph_replay-0.1.1-py3-none-any.whl:

Publisher: release.yml on Devendra116/agent-replay-engine

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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