Applies to:
- Plan - Any
- Deployment - Braintrust-hosted
- LLM calls missing beneath hosted code scorers
Summary
To nest a Gateway LLM call beneath a scorer, export the active span withawait currentSpan().export() and pass it as x-bt-parent.
If the export is empty, check the scorer’s deployment method before adding the header.
Check the deployment method
A custom script can combine code and dependencies, then upload the result through the REST API as an inline function. This differs frombt functions push, which uploads a bundle referenced by the function definition.
Scorers uploaded inline via the REST API return empty span context. Deploying the same scorers with bt functions push provides non-empty context and enables LLM nesting.
Resolution
- Define your scorer using the Braintrust SDK.
- Push the source file with
bt functions push. The CLI handles bundling. - Inside the scorer, export the active span and pass it on the request.
judgePrompt is already defined and uses the hosted runtime’s Gateway configuration.
Verify
Run the uploaded scorer through your online scoring rule and check that:- The exported context is non-empty.
- The model request succeeds.
- The LLM span appears within the scorer’s trace hierarchy. A hosted runtime span may appear between them.
inline or bundle), SDK version, and deployment method.
For more information, see Advanced tracing and Gateway logging.