Skip to content

feat(ai-sdk): Add batch tracing - #2642

Merged
Luca Forstner (lforst) merged 6 commits into
mainfrom
lforst/dum-e/kyoto-964adf14a1
Oct 20, 2026
Merged

Luca Forstner (lforst) merged 6 commits into
mainfrom
lforst/dum-e/kyoto-964adf14a1

Conversation

@lforst

Copy link
Copy Markdown
Member
  • Add explicit tracing helpers for AI SDK text batches, capturing prompts, outputs, token usage, and errors under one batch trace with a child span per request.

  • Allow tracing to start after submission and finish in another process using saved context. Retrying completion updates the same spans.

  • Keep submission, polling, and result collection in application code. The new helpers only capture trace data:

    import { startAISDKBatchTrace, completeAISDKBatchTrace } from "braintrust";
    
    // New: capture submitted requests and save context for later.
    const context = await startAISDKBatchTrace({ batch, requests });
    
    // New: finish tracing after collecting the batch results.
    await completeAISDKBatchTrace({ batch, requests, context, status, results });

@lforst
Luca Forstner (lforst) merged commit 6fb0def into main Oct 20, 2026
57 checks passed
@lforst
Luca Forstner (lforst) deleted the lforst/dum-e/kyoto-964adf14a1 branch October 20, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants