explaingit

gadda00/agentreplay

Analysis updated 2026-05-18

2PythonAudience · developerComplexity · 3/5LicenseSetup · easy

TLDR

A Python library that records AI agent runs and replays them exactly, letting you debug, mutate, and regression test agents without calling the model again.

Mindmap

mindmap
  root((agentreplay))
    What it does
      Records agent runs
      Bit exact replay
      Zero model calls on replay
    Modes
      Record
      Replay
      Hybrid
      Live
    Use cases
      Debug agent failures
      Counterfactual what if testing
      Free CI regression tests
    Tech stack
      Python
      pip package
      CLI tool
    Audience
      AI agent developers
      MLOps and reliability engineers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Record a failing agent run and replay it repeatedly to debug it without paying for new model calls.

USE CASE 2

Mutate a recorded tool response to test how the agent would behave if a step had failed differently.

USE CASE 3

Turn captured production failures into permanent regression tests that run in CI for free.

USE CASE 4

Compare two cassette recordings to see exactly where an agent's behavior diverged.

What is it built with?

PythonOpenAI SDKAnthropic SDKLangGraph

How does it compare?

gadda00/agentreplay0-bingwu-0/live-interpreter010zx00x1/faresnipe
Stars222
LanguagePythonPythonPython
Setup difficultyeasymoderateeasy
Complexity3/52/52/5
Audiencedevelopergeneralgeneral

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Simple pip install, but wiring the Recorder or Replayer into an existing agent's client and tool calls takes some integration work.

MIT license: use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

AgentReplay is a Python library that sits between an AI agent and everything unpredictable it talks to, such as the AI model API, external tools, the network, and the clock. Its main promise is that once you record one run of your agent, you can replay that exact run again and again, byte for byte identical, without ever calling the AI model again. This matters because AI agents can behave differently each time they run, which makes debugging and testing them difficult. The README explains that existing tools for watching agent behavior let you see what happened, but do not guarantee that running the same scenario again produces the same result, because their time travel features restart live execution rather than replaying a fixed recording. AgentReplay borrows an idea from deterministic replay tools used in other areas of software, such as HTTP mocking libraries, where every unpredictable input is recorded exactly during a real run, then played back later instead of being generated again. Because of this, the library unlocks two extra abilities. One is counterfactual testing, where you can edit a single recorded step, such as making a tool return an error instead of its real result, and then replay forward to see how the agent would have reacted differently. The other is that every recorded failure or important run can become a permanent, free regression test in continuous integration, since replaying it never costs another model call. The library works in four modes: recording a real run, replaying a recorded run with no live calls, a hybrid mode that replays until something differs from the recording and then falls back to live calls, and a live mode that behaves as if AgentReplay were not installed at all. The agent's own code does not need to know which mode it is running in. It installs through pip, with optional extras for OpenAI, Anthropic, LangGraph, CrewAI, and AutoGen, and it includes a command line tool for inspecting, listing, replaying, comparing, and mutating recorded runs.

Copy-paste prompts

Prompt 1
Wrap my OpenAI client with AgentReplay's Recorder so I can capture and later replay this agent's run.
Prompt 2
Show me how to mutate a recorded cassette step to simulate a tool returning a permission error.
Prompt 3
Set up a GitHub Actions workflow that replays my cassettes directory as a regression suite on every pull request.
Prompt 4
Explain the difference between AgentReplay's record, replay, hybrid, and live modes.

Frequently asked questions

What is agentreplay?

A Python library that records AI agent runs and replays them exactly, letting you debug, mutate, and regression test agents without calling the model again.

What language is agentreplay written in?

Mainly Python. The stack also includes Python, OpenAI SDK, Anthropic SDK.

What license does agentreplay use?

MIT license: use freely for any purpose, including commercial use, as long as you keep the copyright notice.

How hard is agentreplay to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is agentreplay for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.