Repository navigation
feat: trace judge calls in Braintrust - #369
Merged
mattrossman merged 7 commits intoOct 6, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This reverts commit 9f97812.
mattrossman
marked this pull request as ready for review
October 6, 2026 14:11
This reverts commit 92d915b.
gregnr
approved these changes
Oct 6, 2026
Collaborator
Author
|
@gregnr that's an interesting idea, Braintrust does support OTel via most of the GenAI semantic conventions and then the Braintrust-specific stuff it achieves through its own braintrust attributes. In my testing, the only parts that still require Braintrust-specific API/SDK are: I'll keep that in mind as we expand evals tracing. I don't think we get much benefit migrating to OTel short term but maybe we can consider it when we want the data funneling from/to more places. |
Collaborator
Author
|
Tracking that suggestion in AI-1287! |
This branch was successfully deployed
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.
Motivation
We want to understand how our scorers are judging eval outputs. Today we capture the final output of our judge, but not the input / usage details. We don't know how much $ we spend on judge inference or where inefficiencies are in our judge context (e.g. #366)
Changes
Scorers now ask for verdicts through
ctx.judge()instead of plainjudge(), which records each judge call's model, full prompt, output, tokens and timing inresult.json. The uploader logs each call as an LLM span under the score span:Note
23 of the changed eval files are just swapping
judge()forctx.judge()purpose: "scorer"is how Braintrust keeps judge cost out of preset cost charts. Core no longer exportsjudge()so folks are encouraged to usectx.judgeas the preferred way to access the judge in scorers similar toctx.query.As an incidental fix, the root eval span no longer logs agent tokens, since its LLM spans carry them. Braintrust sums metrics across every span in a trace, so with the initial approach in #351 the experiment table double counts tokens (example). Note
aiSdkAgenthas no per-request usage so its rows now show no tokens, but it's unused and slated for removal anyway.Verification
See Braintrust experiment of the regression suite and this specific sample trace with LLM judge calls now visible under the scorer span.
Tip
Braintrust hides scorer spans by default in the Timeline view, to see them enable "Include score spans in timeline" from the overflow menu:

Future improvements
I'd like to more formally pair checks with
ctx.judge()calls so we can attach nice labels to these spans, e.g.judge: wrote safe RLS policy. Today, we don't have that structural pairing so I've left it out of this PR.Closes AI-1271