Point your SDK at the recording.
Set the SDK’s base URL and key, and run the agent unchanged; answers come back in the provider’s own shape, streamed or not.
Model answers come from the recording, so you can change your code and see the step where the run diverges.
Set up Traza Replay for the agent in this repository, so a recorded run can be re-run with zero model calls and kept as a regression test.
1. Check that the agent's model calls go through the OpenAI or Anthropic SDK and are recorded to Traza Cloud with prompt and completion content on (OpenLLMetry: leave TRACELOOP_TRACE_CONTENT at its default, true). Exporter setup: https://www.trazadb.com/docs/otel/
2. Install the Traza Python client: pip install "git+https://github.com/toshish/traza.git#subdirectory=sdk/python"
3. Create a replay of a recorded run with a read key:
curl -s https://api.trazadb.com/v1/replays -H "Authorization: Bearer $TRAZA_API_KEY" -d '{"run": "<run id>"}'
The response's base_urls are paths: prefix them with https://api.trazadb.com.
4. Run the agent with ANTHROPIC_BASE_URL=https://api.trazadb.com/v1/replays/<replay id>/anthropic and ANTHROPIC_API_KEY=$TRAZA_API_KEY (or OPENAI_BASE_URL=https://api.trazadb.com/v1/replays/<replay id>/openai/v1 and OPENAI_API_KEY=$TRAZA_API_KEY). Build the provider client after the variables are set. Then GET https://api.trazadb.com/v1/replays/<replay id> should say "remaining": 0 and "diverged": null.
5. Add a pytest tape test: @pytest.mark.traza_tape("<run id>") on a test that takes the traza_tape fixture, run with TRAZA_URL=https://api.trazadb.com and TRAZA_TOKEN set to the read key.
Tools still run for real unless the tool dispatcher takes recorded results from POST /v1/replays/<replay id>/tools/next. Only chat completions and Anthropic messages are replayed: if the agent uses the OpenAI Responses API, tell me rather than changing it. cost · steps 0–11: $0 to a provider
Set the SDK’s base URL and key, and run the agent unchanged; answers come back in the provider’s own shape, streamed or not.
ANTHROPIC_BASE_URL=…/replays/$ID/anthropic
ANTHROPIC_API_KEY=$TRAZA_API_KEY
OPENAI_BASE_URL=…/replays/$ID/openai/v1
OPENAI_API_KEY=$TRAZA_API_KEY A fork replays up to a step, then goes live: you pay for the steps after the cut, not before.
−$0.068 fork against the original, after the cut
Every chunk of context is traced to the step that put it there, with stale and duplicate content marked.
context of step 12, as recorded
tool call from step 2 · 37% of this context
Turn a recorded run into a test that replays it with zero model calls, in pytest, vitest, jest or node:test.