Observed since 20 Oct, 23:12 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Record & replay LLM API calls for deterministic agent tests.
Record & replay LLM API calls for deterministic agent tests.
agent-replay captures the HTTP traffic your agent makes to LLM providers
(Anthropic, OpenAI, …) into a human-readable JSONL "cassette", then plays it
back on subsequent runs so your tests are fast, offline, and deterministic —
while still flagging when a prompt has drifted away from what was recorded.
pip install agent-replay-py
The install name is agent-replay-py; the import name is agentreplay
(there is an unrelated agentreplay project on PyPI, so we distinguish the
distribution name).
Optional extras:
pip install "agent-replay-py[pytest]" # pytest fixture & marker
import agentreplay as ar
with ar.cassette("tests/cassettes/hello.jsonl", mode="auto") as c:
client = c.httpx_client() # a preconfigured httpx.Client
r = client.post(
"https://api.anthropic.com/v1/messages",
json={"model": "claude-3", "messages": [{"role": "user", "content": "hi"}]},
)
print(r.json())
mode accepts "record" | "replay" | "auto" | "passthrough", and can be
overridden globally via AGENTREPLAY_MODE.Async is the same shape:
async with ar.cassette("tests/cassettes/hello.jsonl") as c:
async with c.httpx_async_client() as client:
r = await client.post(...)
agent-replay ships a pytest plugin. Cassettes are auto-named from the test
node id and stored under tests/cassettes/.
import pytest
@pytest.mark.agentreplay(mode="auto")
def test_agent(agentreplay):
client = agentreplay.httpx_client()
...
agentreplay inspect tests/cassettes/hello.jsonl # header + summary
agentreplay show tests/cassettes/hello.jsonl 0 # pretty-print seq 0
agentreplay verify tests/cassettes/hello.jsonl # re-check fingerprints
When the request your code sends no longer matches what was recorded (a
prompt changed, a tool schema was edited, …), agent-replay produces a
structured diff (ar.Report) instead of silently returning stale data. The
divergence policy ("warn" | "error") controls whether it raises.
MIT — see LICENSE.
The TypeScript sibling of this package lives at
@retr0hxx/agent-replay.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.0 | 19 Jul 2026 | 3 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 23:12 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:23b9a3b747f906e7d49834b84fa7415802d3227716afa14b8261997bb8f3ceed