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

Uploaded Python 3

File details

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

File metadata

  • Download URL: langgraph_replay-0.1.0.tar.gz
  • Upload date:
  • Size: 176.9 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.0.tar.gz
Algorithm Hash digest
SHA256 09ce7ad468e1e06b091b9803518a1bca6145d789c00a9a595dcabf33081c4d2f
MD5 8ee1e16efcd2797266fc18a85fb7d2eb
BLAKE2b-256 eac40d314683c3329b40ecdb1c3f93c3e42bb9ef4ce9e82d9d9e547d9831b8fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for langgraph_replay-0.1.0.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.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langgraph_replay-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f9e12347aec7700d0dc9993655099340d7539c5ffa100f83b7e156147831b567
MD5 a9f841ca8f95b8d04bbcf64d42e717cc
BLAKE2b-256 f0de75f1a1141b0d74c49eabeb60d8e3ee2f7d14df37040045713dbf20feb485

See more details on using hashes here.

Provenance

The following attestation bundles were made for langgraph_replay-0.1.0-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