Satchel Hamilton
← Work
Solo design & build · 2026

Kinescope: record an AI agent run, replay it exactly, fork it at any step

An agent failure you saw once replays exactly from a local recording. Go to the step that went wrong, change that one result, and watch the rest of the run play out live.

Source ↗PyPI ↗

Debugging an agent usually means reading the logs of a run you can't repeat. The model samples differently, a tool flakes, the clock moves. Kinescope does for agents what rr does for native programs. It records the parts of a run that can change from one run to the next (model calls, tool calls, the clock, random numbers and UUIDs), replays the run exactly from that recording, and lets you fork it at any step to see what would have happened if one result had been different.

The problem

Only a few places in an agent can give a different result from the same code. That is still enough for a failure to show up once and never again. Logs say what happened. They don't let you run it again, and they can't tell you what the agent would have done if it had chosen differently at step six.

How it works

  • It records at the HTTP layer. Kinescope sits on the httpx transport, the http_client= hook the SDKs document, and patches no SDK methods. That covers sync, async and streaming calls, and one engine handles Anthropic, OpenAI, Gemini and local models through Ollama.
  • Tools, clock and randomness are recorded too. A @kinescope.tool decorator records each tool call as one event. Capturing the clock, RNG and UUIDs is opt-in. Everything lands in a single ordered sequence.
  • Replay returns recorded results. On replay nothing calls out. The model isn't sampled again, tools don't run again, and time.time() returns the recorded value.
  • A fork changes one result and continues live. fork(run_id, at=k, override=...) replays to step k, swaps that event's output, and runs the rest for real. The fork is a new recording that can itself be replayed and forked.
  • It runs locally. Recordings are a SQLite index plus content-addressed files in .kinescope/, and the engine depends only on httpx. A terminal timeline shows each step and the state change it caused, and forks with one key.

The example

An agent misreads a sensor and calls the weather cold. Open the recording in the timeline, go to the sensor step, press f and change the reading. The classification after it runs again live and comes out warm.

Why you can trust a replay

  • Inputs are checked. Each event's input is hashed when it is recorded. On replay, a different input, a different order or a different number of events is reported as a divergence. Strict mode raises and warn mode continues.
  • Real runs are in the test suite. Three recorded runs are committed: hosted Anthropic and Gemini calls, and a local Ollama model. They replay offline in CI with identical results.
  • Keys stay out of recordings. Credential headers are removed before anything is written to disk.

Where it's used

Countercheck records every check's model calls with Kinescope, so a finding that a store owner disputes can be graded again offline. Gatecheck uses it to record a suite's model calls once and replay them in CI with no keys.

What it can't do

Determinism holds at the recorded boundaries, and no further.

  • Tool calls and clock reads on worker threads that don't inherit the recording context aren't captured. Single-threaded code and asyncio are the supported cases.
  • patch() sees httpx only. Calls made with requests or from a subprocess aren't recorded, and replay reports a divergence where they matter.
  • Concurrent calls under asyncio.gather can come back in a different order. When they do, replay flags it.
  • Streams replay by content, not by timing.