Skip to main content

Chrome DevTools for AI agents — record, inspect, fork, replay, diff.

Project description

rewind-agent

Python SDK for Rewind — the time-travel debugger for AI agents.

Record every LLM call. See the exact context window. Fork, fix, replay from failure — without re-running.

Install

pip install rewind-agent

This installs both the Python SDK and the rewind CLI. The native binary is auto-downloaded on first use.

Quick Start

One line to start recording — no proxy, no setup:

import rewind_agent
import openai

rewind_agent.init()  # patches OpenAI + Anthropic automatically

client = openai.OpenAI()
client.chat.completions.create(model="gpt-4o", messages=[...])
# Recorded to ~/.rewind/ — inspect with: rewind show latest

Or as a scoped session:

with rewind_agent.session("my-agent"):
    client = openai.OpenAI()
    client.chat.completions.create(model="gpt-4o", messages=[...])

Two Recording Modes

Direct mode (default) Proxy mode
Setup rewind_agent.init() rewind record in a second terminal
How Monkey-patches SDK clients in-process HTTP proxy intercepts LLM traffic
Best for Python agents, quick iteration Any language, polyglot teams
# Direct mode (default — no proxy needed)
rewind_agent.init(mode="direct")

# Proxy mode (requires `rewind record` running)
rewind_agent.init(mode="proxy", proxy_url="http://127.0.0.1:8443")

Replay from Failure

Agent failed at step 5? Fix your code, then replay — steps 1-4 are cached (instant, free), step 5 re-runs live:

with rewind_agent.replay("latest", from_step=4):
    result = my_agent.run("Research Tokyo population")
    # Steps 1-4: instant cached responses (0ms, 0 tokens)
    # Step 5+: live LLM calls, recorded to a new forked timeline

After the replay, diff the timelines: rewind diff <session> main replayed

Regression Testing

Turn any session into a baseline. After code changes, check for regressions:

from rewind_agent import Assertions

# Check the latest session against a known-good baseline
result = Assertions().check("booking-happy-path", "latest")
assert result.passed, f"Regression: {result.failed_checks} checks failed"

Checks step types, models, tool calls, error status, and token usage. Supports configurable tolerance:

result = Assertions().check("my-baseline", "latest", token_tolerance=0.15)
print(f"Passed: {result.passed_checks}/{result.total_checks}")

Agent Hooks

Enrich recordings with semantic labels:

@rewind_agent.step("search")
def search(query: str) -> str:
    return client.chat.completions.create(...)

@rewind_agent.tool("calculator")
def calculate(a: float, b: float) -> float:
    return a + b

with rewind_agent.trace("analysis"):
    rewind_agent.annotate("confidence", 0.92)
    result = search("Tokyo population")

Framework Adapters

# LangGraph
graph = rewind_agent.wrap_langgraph(compiled_graph)

# CrewAI
crew = rewind_agent.wrap_crew(crew)

Learn More

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

rewind_agent-0.9.2.tar.gz (46.8 kB view details)

Uploaded Source

Built Distribution

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

rewind_agent-0.9.2-py3-none-any.whl (43.3 kB view details)

Uploaded Python 3

File details

Details for the file rewind_agent-0.9.2.tar.gz.

File metadata

  • Download URL: rewind_agent-0.9.2.tar.gz
  • Upload date:
  • Size: 46.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for rewind_agent-0.9.2.tar.gz
Algorithm Hash digest
SHA256 7611f9c08b8247b51d27909efe834f900823795d3b60c319eabec7784c2448b7
MD5 d806718c4808966d6af9c34e76a5e461
BLAKE2b-256 a29f9cfdc7fd941206f4981aab76d4758c02190ea4f6483de397aab15d91ff66

See more details on using hashes here.

File details

Details for the file rewind_agent-0.9.2-py3-none-any.whl.

File metadata

  • Download URL: rewind_agent-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 43.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for rewind_agent-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8ae23c5cff3b832ca75f8e8a6988c6dd22bdc33b34042d7cc9ffa2dccb99acac
MD5 7aca188ae893fa605a46665e244232e9
BLAKE2b-256 a27f62acfe6f62fd1c96fd41acf6c3da520c87572e40ce230cf811571f0ec114

See more details on using hashes here.

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