Add local trace replay regression harness#494
Draft
Ritwij Aryan Parmar (RitwijParmar) wants to merge 1 commit into
Draft
Add local trace replay regression harness#494Ritwij Aryan Parmar (RitwijParmar) wants to merge 1 commit into
Ritwij Aryan Parmar (RitwijParmar) wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This adds a local trace replay path for the Python SDK. The goal is to make saved Braintrust trace exports useful as regression cases when iterating on an agent/task or scorer, without creating a new experiment just to sanity-check behavior.
What changed:
braintrust replayfor JSON/JSONL span exportsReplayTraceso replayed scorers can inspect spans withget_spans()andget_thread()-style access--min-score,--min-score-delta, and--fail-on-errorWhy
For agent/eval workflows, production traces often capture the hard cases: tool-call paths, bad intermediate states, or regressions that unit fixtures miss. This gives users a lightweight way to replay those traces locally and fail a check when a task or scorer change regresses against the saved baseline.
Tests
PYTHONPATH=py/src .venv/bin/python -m pytest py/src/braintrust/test_trace_replay.py -qPYTHONPATH=py/src .venv/bin/python -m pytest py/src/braintrust/cli/test_push.py py/src/braintrust/test_trace_replay.py -qPYTHONPATH=py/src .venv/bin/python -m compileall -q py/src/braintrust/trace_replay.py py/src/braintrust/test_trace_replay.py py/src/braintrust/cli/__main__.py py/src/braintrust/__init__.pygit diff --check