Rewind is a time-travel debugger for AI agents that records every LLM call for inspection, forking, replay, and diffing. It integrates natively with popular agent frameworks so recordings capture rich semantic information (agent names, tool calls, handoffs) with minimal setup.
If you're using the OpenAI Agents SDK, Rewind auto-detects it. Just init() and every agent run is recorded -- LLM calls, tool executions, and handoffs between agents:
import rewind_agent
from agents import Agent, Runner
rewind_agent.init() # auto-detects Agents SDK, registers tracing
agent = Agent(name="researcher", instructions="You are a research assistant.", tools=[web_search])
result = await Runner.run(agent, "What is the population of Tokyo?")
# rewind show latest → trace with agent names, tool calls, handoffs⏪ Rewind — Session Trace
┌ ✓ 🧠 Step 1 gpt-4o researcher 320ms 156↓ 28↑
│ → tool_calls: web_search
├ ✓ 🔧 Step 2 tool:web_search 45ms
├ ✓ 🧠 Step 3 gpt-4o researcher 890ms 312↓ 35↑
│ → final answer
For explicit control over lifecycle hooks:
hooks = rewind_agent.openai_agents_hooks()
result = await Runner.run(agent, input, hooks=hooks)Install with: pip install rewind-agent[agents]
For a deep dive on the OpenAI Agents SDK integration, see openai-agents-sdk.md.
If Pydantic AI is installed, init() auto-patches Agent.__init__ to inject Rewind's Hooks capability. Every agent gets recording for free:
import rewind_agent
from pydantic_ai import Agent
rewind_agent.init() # auto-patches Pydantic AI Agent
agent = Agent('openai:gpt-4o', system_prompt='You are a research assistant.')
result = agent.run_sync('What is the population of Tokyo?')
# rewind show latest → full trace with model, tokens, tool callsOr pass hooks explicitly as a capability:
hooks = rewind_agent.pydantic_ai_hooks()
agent = Agent('openai:gpt-4o', capabilities=[hooks])Install with: pip install rewind-agent[pydantic]
Wrap a compiled LangGraph graph to automatically record all graph nodes:
# LangGraph — wraps all graph nodes automatically
graph = rewind_agent.wrap_langgraph(compiled_graph)
result = graph.invoke({"input": "..."})See the full example: examples/04_langgraph.py
Hook into CrewAI step and task callbacks:
# CrewAI — hooks into step and task callbacks
crew = rewind_agent.wrap_crew(crew)
result = crew.kickoff()Building an agent or framework that isn't in the list above? Don't write a custom HTTP emitter — Rewind ships the integration primitives. Three tiers, pick the one that matches your transport:
- Tier 1 — your agent uses
httpx/requests/aiohttp: one-liner viarewind_agent.connector.setup(). - Tier 2 — custom transport (gRPC, in-process, mTLS-tunneled): ~30-line
ExplicitClientintegration. - Tier 3 — shipping a connector for an org or framework family (one package consumed by every internal agent): thin wrapper around Tier 1 with org-specific defaults.
import rewind_agent
with rewind_agent.connector.setup(name="my-agent"):
run_agent_loop()See hdk.md for the full decision tree, configuration knobs (REWIND_ENABLED, REWIND_URL, REWIND_LLM_HOSTS), and common pitfalls.
examples/04_langgraph.py-- LangGraph integrationexamples/09_pydantic_ai.py-- Pydantic AI integrationexamples/10_openai_agents_sdk.py-- OpenAI Agents SDK integration