braintrust 0.3.8 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,6 +1,48 @@
1
1
  import { z } from 'zod/v3';
2
2
  import { z as z$1 } from 'zod';
3
3
 
4
+ /**
5
+ * Abstract base class for ID generators
6
+ */
7
+ declare abstract class IDGenerator {
8
+ /**
9
+ * Generate a span ID
10
+ */
11
+ abstract getSpanId(): string;
12
+ /**
13
+ * Generate a trace ID
14
+ */
15
+ abstract getTraceId(): string;
16
+ /**
17
+ * Return true if the generator should use span_id as root_span_id for backwards compatibility
18
+ */
19
+ abstract shareRootSpanId(): boolean;
20
+ }
21
+ /**
22
+ * ID generator that uses UUID4 for both span and trace IDs
23
+ */
24
+ declare class UUIDGenerator extends IDGenerator {
25
+ getSpanId(): string;
26
+ getTraceId(): string;
27
+ shareRootSpanId(): boolean;
28
+ }
29
+ /**
30
+ * ID generator that generates OpenTelemetry-compatible IDs
31
+ * Uses hex strings for compatibility with OpenTelemetry systems
32
+ */
33
+ declare class OTELIDGenerator extends IDGenerator {
34
+ getSpanId(): string;
35
+ getTraceId(): string;
36
+ shareRootSpanId(): boolean;
37
+ }
38
+ /**
39
+ * Factory function that creates a new ID generator instance each time.
40
+ *
41
+ * This eliminates global state and makes tests parallelizable.
42
+ * Each caller gets their own generator instance.
43
+ */
44
+ declare function getIdGenerator(): IDGenerator;
45
+
4
46
  declare const TRANSACTION_ID_FIELD = "_xact_id";
5
47
  declare const IS_MERGE_FIELD = "_is_merge";
6
48
  declare const MERGE_PATHS_FIELD = "_merge_paths";
@@ -14283,8 +14325,10 @@ declare class LazyValue<T> {
14283
14325
  get hasSucceeded(): boolean;
14284
14326
  }
14285
14327
 
14286
- /// <reference lib="dom" />
14287
-
14328
+ interface ContextParentSpanIds {
14329
+ rootSpanId: string;
14330
+ spanParents: string[];
14331
+ }
14288
14332
  type SetCurrentArg = {
14289
14333
  setCurrent?: boolean;
14290
14334
  };
@@ -14435,6 +14479,12 @@ interface Span$1 extends Exportable {
14435
14479
  state(): BraintrustState;
14436
14480
  kind: "span";
14437
14481
  }
14482
+ declare abstract class ContextManager {
14483
+ abstract getParentSpanIds(): ContextParentSpanIds | undefined;
14484
+ abstract runInContext<R>(span: Span$1, callback: () => R): R;
14485
+ abstract getCurrentSpan(): Span$1 | undefined;
14486
+ }
14487
+ declare function getContextManager(): ContextManager;
14438
14488
  /**
14439
14489
  * A fake implementation of the Span API which does nothing. This can be used as the default span.
14440
14490
  */
@@ -14532,8 +14582,13 @@ declare class BraintrustState {
14532
14582
  private _apiConn;
14533
14583
  private _proxyConn;
14534
14584
  promptCache: PromptCache;
14585
+ private _idGenerator;
14586
+ private _contextManager;
14535
14587
  constructor(loginParams: LoginOptions);
14536
14588
  resetLoginInfo(): void;
14589
+ resetIdGenState(): void;
14590
+ get idGenerator(): IDGenerator;
14591
+ get contextManager(): ContextManager;
14537
14592
  copyLoginInfo(other: BraintrustState): void;
14538
14593
  serialize(): SerializedBraintrustState;
14539
14594
  static deserialize(serialized: unknown, opts?: LoginOptions): BraintrustState;
@@ -15845,6 +15900,7 @@ declare function simulateLogoutForTests(): BraintrustState;
15845
15900
  * @returns Promise containing the version data
15846
15901
  */
15847
15902
  declare function getPromptVersions(projectId: string, promptId: string): Promise<any>;
15903
+ declare function resetIdGenStateForTests(): void;
15848
15904
  declare const _exportsForTestingOnly: {
15849
15905
  extractAttachments: typeof extractAttachments;
15850
15906
  deepCopyEvent: typeof deepCopyEvent;
@@ -15856,6 +15912,7 @@ declare const _exportsForTestingOnly: {
15856
15912
  initTestExperiment: typeof initTestExperiment;
15857
15913
  isGeneratorFunction: typeof isGeneratorFunction;
15858
15914
  isAsyncGeneratorFunction: typeof isAsyncGeneratorFunction;
15915
+ resetIdGenStateForTests: typeof resetIdGenStateForTests;
15859
15916
  };
15860
15917
 
15861
15918
  declare const braintrustStreamChunkSchema: z.ZodUnion<[z.ZodObject<{
@@ -21248,14 +21305,14 @@ interface MastraAgentMethods {
21248
21305
  tools?: Record<string, unknown> | unknown[];
21249
21306
  model?: any;
21250
21307
  __setTools(tools: Record<string, unknown> | unknown[]): void;
21251
- generateVNext?: (params: any) => any;
21252
- streamVNext?: (params: any) => any;
21308
+ generate?: (params: any) => any;
21309
+ stream?: (params: any) => any;
21253
21310
  }
21254
21311
  /**
21255
21312
  * Wraps a Mastra agent with Braintrust tracing. This function wraps the agent's
21256
21313
  * underlying language model with BraintrustMiddleware and traces all agent method calls.
21257
21314
  *
21258
- * **Important**: This wrapper only supports AI SDK v5 methods such as `generateVNext` and `streamVNext`.
21315
+ * **Important**: This wrapper only supports AI SDK v5 methods such as `generate` and `stream`.
21259
21316
  *
21260
21317
  * @param agent - The Mastra agent to wrap
21261
21318
  * @param options - Optional configuration for the wrapper
@@ -21293,8 +21350,37 @@ declare function wrapMastraAgent<T extends MastraAgentMethods>(agent: T, options
21293
21350
  */
21294
21351
  declare function wrapAnthropic<T extends object>(anthropic: T): T;
21295
21352
 
21353
+ /**
21354
+ * Wraps the Claude Agent SDK with Braintrust tracing. This returns wrapped versions
21355
+ * of query and tool that automatically trace all agent interactions.
21356
+ *
21357
+ * @param sdk - The Claude Agent SDK module
21358
+ * @returns Object with wrapped query, tool, and createSdkMcpServer functions
21359
+ *
21360
+ * @example
21361
+ * ```typescript
21362
+ * import * as claudeSDK from "@anthropic-ai/claude-agent-sdk";
21363
+ * import { wrapClaudeAgentSDK } from "braintrust";
21364
+ *
21365
+ * // Wrap once - returns { query, tool, createSdkMcpServer } with tracing built-in
21366
+ * const { query, tool, createSdkMcpServer } = wrapClaudeAgentSDK(claudeSDK);
21367
+ *
21368
+ * // Use normally - tracing is automatic
21369
+ * for await (const message of query({
21370
+ * prompt: "Hello, Claude!",
21371
+ * options: { model: "claude-3-5-sonnet-20241022" }
21372
+ * })) {
21373
+ * console.log(message);
21374
+ * }
21375
+ *
21376
+ * // Tools created with wrapped tool() are automatically traced
21377
+ * const calculator = tool("calculator", "Does math", schema, handler);
21378
+ * ```
21379
+ */
21380
+ declare function wrapClaudeAgentSDK<T extends object>(sdk: T): T;
21381
+
21296
21382
  interface Context {
21297
- [key: string]: any;
21383
+ getValue?: (key: string) => unknown;
21298
21384
  }
21299
21385
  interface SpanProcessor {
21300
21386
  onStart(span: Span, parentContext?: Context): void;
@@ -21453,6 +21539,7 @@ declare class BraintrustSpanProcessor {
21453
21539
  private readonly aiSpanProcessor;
21454
21540
  constructor(options?: BraintrustSpanProcessorOptions);
21455
21541
  onStart(span: Span, parentContext: Context): void;
21542
+ private _getParentOtelBraintrustParent;
21456
21543
  onEnd(span: ReadableSpan): void;
21457
21544
  shutdown(): Promise<void>;
21458
21545
  forceFlush(): Promise<void>;
@@ -21510,7 +21597,10 @@ declare class BraintrustExporter {
21510
21597
  /**
21511
21598
  * Export spans to Braintrust by simulating span processor behavior.
21512
21599
  */
21513
- export(spans: ReadableSpan[], resultCallback: (result: any) => void): void;
21600
+ export(spans: ReadableSpan[], resultCallback: (result: {
21601
+ code: number;
21602
+ error?: unknown;
21603
+ }) => void): void;
21514
21604
  /**
21515
21605
  * Shutdown the exporter.
21516
21606
  */
@@ -21551,6 +21641,9 @@ declare const braintrust_CodePrompt: typeof CodePrompt;
21551
21641
  type braintrust_CompiledPrompt<Flavor extends "chat" | "completion"> = CompiledPrompt<Flavor>;
21552
21642
  type braintrust_CompiledPromptParams = CompiledPromptParams;
21553
21643
  type braintrust_CompletionPrompt = CompletionPrompt;
21644
+ type braintrust_ContextManager = ContextManager;
21645
+ declare const braintrust_ContextManager: typeof ContextManager;
21646
+ type braintrust_ContextParentSpanIds = ContextParentSpanIds;
21554
21647
  type braintrust_CreateProjectOpts = CreateProjectOpts;
21555
21648
  type braintrust_DataSummary = DataSummary;
21556
21649
  type braintrust_Dataset<IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY_DATASET> = Dataset<IsLegacyDataset>;
@@ -21584,6 +21677,8 @@ declare const braintrust_FailedHTTPResponse: typeof FailedHTTPResponse;
21584
21677
  type braintrust_FullInitOptions<IsOpen extends boolean> = FullInitOptions<IsOpen>;
21585
21678
  type braintrust_FullLoginOptions = FullLoginOptions;
21586
21679
  type braintrust_FunctionEvent = FunctionEvent;
21680
+ type braintrust_IDGenerator = IDGenerator;
21681
+ declare const braintrust_IDGenerator: typeof IDGenerator;
21587
21682
  declare const braintrust_INTERNAL_BTQL_LIMIT: typeof INTERNAL_BTQL_LIMIT;
21588
21683
  type braintrust_InitOptions<IsOpen extends boolean> = InitOptions<IsOpen>;
21589
21684
  type braintrust_InvokeFunctionArgs<Input, Output, Stream extends boolean = false> = InvokeFunctionArgs<Input, Output, Stream>;
@@ -21600,6 +21695,8 @@ declare const braintrust_NOOP_SPAN: typeof NOOP_SPAN;
21600
21695
  declare const braintrust_NOOP_SPAN_PERMALINK: typeof NOOP_SPAN_PERMALINK;
21601
21696
  type braintrust_NoopSpan = NoopSpan;
21602
21697
  declare const braintrust_NoopSpan: typeof NoopSpan;
21698
+ type braintrust_OTELIDGenerator = OTELIDGenerator;
21699
+ declare const braintrust_OTELIDGenerator: typeof OTELIDGenerator;
21603
21700
  type braintrust_ObjectMetadata = ObjectMetadata;
21604
21701
  type braintrust_Project = Project;
21605
21702
  declare const braintrust_Project: typeof Project;
@@ -21635,6 +21732,8 @@ type braintrust_TestBackgroundLogger = TestBackgroundLogger;
21635
21732
  declare const braintrust_TestBackgroundLogger: typeof TestBackgroundLogger;
21636
21733
  type braintrust_ToolBuilder = ToolBuilder;
21637
21734
  declare const braintrust_ToolBuilder: typeof ToolBuilder;
21735
+ type braintrust_UUIDGenerator = UUIDGenerator;
21736
+ declare const braintrust_UUIDGenerator: typeof UUIDGenerator;
21638
21737
  type braintrust_WithTransactionId<R> = WithTransactionId<R>;
21639
21738
  declare const braintrust_X_CACHED_HEADER: typeof X_CACHED_HEADER;
21640
21739
  declare const braintrust__exportsForTestingOnly: typeof _exportsForTestingOnly;
@@ -21651,6 +21750,8 @@ declare const braintrust_defaultErrorScoreHandler: typeof defaultErrorScoreHandl
21651
21750
  declare const braintrust_deserializePlainStringAsJSON: typeof deserializePlainStringAsJSON;
21652
21751
  declare const braintrust_devNullWritableStream: typeof devNullWritableStream;
21653
21752
  declare const braintrust_flush: typeof flush;
21753
+ declare const braintrust_getContextManager: typeof getContextManager;
21754
+ declare const braintrust_getIdGenerator: typeof getIdGenerator;
21654
21755
  declare const braintrust_getPromptVersions: typeof getPromptVersions;
21655
21756
  declare const braintrust_getSpanParentObject: typeof getSpanParentObject;
21656
21757
  declare const braintrust_init: typeof init;
@@ -21692,12 +21793,13 @@ declare const braintrust_withParent: typeof withParent;
21692
21793
  declare const braintrust_wrapAISDK: typeof wrapAISDK;
21693
21794
  declare const braintrust_wrapAISDKModel: typeof wrapAISDKModel;
21694
21795
  declare const braintrust_wrapAnthropic: typeof wrapAnthropic;
21796
+ declare const braintrust_wrapClaudeAgentSDK: typeof wrapClaudeAgentSDK;
21695
21797
  declare const braintrust_wrapMastraAgent: typeof wrapMastraAgent;
21696
21798
  declare const braintrust_wrapOpenAI: typeof wrapOpenAI;
21697
21799
  declare const braintrust_wrapOpenAIv4: typeof wrapOpenAIv4;
21698
21800
  declare const braintrust_wrapTraced: typeof wrapTraced;
21699
21801
  declare namespace braintrust {
21700
- export { braintrust_AISpanProcessor as AISpanProcessor, type braintrust_AnyDataset as AnyDataset, braintrust_Attachment as Attachment, type braintrust_AttachmentParams as AttachmentParams, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, braintrust_BaseAttachment as BaseAttachment, braintrust_BaseExperiment as BaseExperiment, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustExporter as BraintrustExporter, braintrust_BraintrustMiddleware as BraintrustMiddleware, braintrust_BraintrustSpanProcessor as BraintrustSpanProcessor, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, braintrust_CodeFunction as CodeFunction, type braintrust_CodeOpts as CodeOpts, braintrust_CodePrompt as CodePrompt, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, type braintrust_CreateProjectOpts as CreateProjectOpts, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, braintrust_ERR_PERMALINK as ERR_PERMALINK, type braintrust_EndSpanArgs as EndSpanArgs, braintrust_Eval as Eval, type braintrust_EvalCase as EvalCase, type braintrust_EvalHooks as EvalHooks, type braintrust_EvalResult as EvalResult, braintrust_EvalResultWithSummary as EvalResultWithSummary, type braintrust_EvalScorer as EvalScorer, type braintrust_EvalScorerArgs as EvalScorerArgs, type braintrust_EvalTask as EvalTask, type braintrust_Evaluator as Evaluator, type braintrust_EvaluatorDef as EvaluatorDef, type braintrust_EvaluatorFile as EvaluatorFile, braintrust_Experiment as Experiment, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_ExternalAttachment as ExternalAttachment, type braintrust_ExternalAttachmentParams as ExternalAttachmentParams, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, type braintrust_FunctionEvent as FunctionEvent, braintrust_INTERNAL_BTQL_LIMIT as INTERNAL_BTQL_LIMIT, type braintrust_InitOptions as InitOptions, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, braintrust_LazyValue as LazyValue, type braintrust_LogOptions as LogOptions, braintrust_Logger as Logger, type braintrust_LoginOptions as LoginOptions, type braintrust_MetricSummary as MetricSummary, braintrust_NOOP_SPAN as NOOP_SPAN, braintrust_NOOP_SPAN_PERMALINK as NOOP_SPAN_PERMALINK, braintrust_NoopSpan as NoopSpan, type braintrust_ObjectMetadata as ObjectMetadata, braintrust_Project as Project, braintrust_ProjectNameIdMap as ProjectNameIdMap, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, braintrust_PromptBuilder as PromptBuilder, type braintrust_PromptContents as PromptContents, type braintrust_PromptDefinition as PromptDefinition, type braintrust_PromptDefinitionWithTools as PromptDefinitionWithTools, type braintrust_PromptOpts as PromptOpts, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyAttachment as ReadonlyAttachment, braintrust_ReadonlyExperiment as ReadonlyExperiment, braintrust_Reporter as Reporter, type braintrust_ReporterBody as ReporterBody, type braintrust_ScoreSummary as ScoreSummary, braintrust_ScorerBuilder as ScorerBuilder, type braintrust_ScorerOpts as ScorerOpts, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type Span$1 as Span, type braintrust_SpanContext as SpanContext, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, braintrust_TestBackgroundLogger as TestBackgroundLogger, braintrust_ToolBuilder as ToolBuilder, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, braintrust__exportsForTestingOnly as _exportsForTestingOnly, braintrust__internalGetGlobalState as _internalGetGlobalState, braintrust__internalSetInitialState as _internalSetInitialState, braintrust_braintrustStreamChunkSchema as braintrustStreamChunkSchema, braintrust_buildLocalSummary as buildLocalSummary, braintrust_createFinalValuePassThroughStream as createFinalValuePassThroughStream, braintrust_currentExperiment as currentExperiment, braintrust_currentLogger as currentLogger, braintrust_currentSpan as currentSpan, braintrust_deepCopyEvent as deepCopyEvent, braintrust_defaultErrorScoreHandler as defaultErrorScoreHandler, braintrust_deserializePlainStringAsJSON as deserializePlainStringAsJSON, braintrust_devNullWritableStream as devNullWritableStream, braintrust_flush as flush, braintrust_getPromptVersions as getPromptVersions, braintrust_getSpanParentObject as getSpanParentObject, graphFramework as graph, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, braintrust_initFunction as initFunction, braintrust_initLogger as initLogger, braintrust_invoke as invoke, braintrust_loadPrompt as loadPrompt, braintrust_log as log, braintrust_logError as logError, braintrust_login as login, braintrust_loginToState as loginToState, braintrust_newId as newId, braintrust_parseCachedHeader as parseCachedHeader, braintrust_permalink as permalink, braintrust_projects as projects, braintrust_promptContentsSchema as promptContentsSchema, braintrust_promptDefinitionSchema as promptDefinitionSchema, braintrust_promptDefinitionToPromptData as promptDefinitionToPromptData, braintrust_promptDefinitionWithToolsSchema as promptDefinitionWithToolsSchema, braintrust_renderMessage as renderMessage, braintrust_renderPromptParams as renderPromptParams, braintrust_reportFailures as reportFailures, braintrust_runEvaluator as runEvaluator, braintrust_setFetch as setFetch, braintrust_setMaskingFunction as setMaskingFunction, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, braintrust_traceable as traceable, braintrust_traced as traced, braintrust_updateSpan as updateSpan, braintrust_withCurrent as withCurrent, braintrust_withDataset as withDataset, braintrust_withExperiment as withExperiment, braintrust_withLogger as withLogger, braintrust_withParent as withParent, braintrust_wrapAISDK as wrapAISDK, braintrust_wrapAISDKModel as wrapAISDKModel, braintrust_wrapAnthropic as wrapAnthropic, braintrust_wrapMastraAgent as wrapMastraAgent, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
21802
+ export { braintrust_AISpanProcessor as AISpanProcessor, type braintrust_AnyDataset as AnyDataset, braintrust_Attachment as Attachment, type braintrust_AttachmentParams as AttachmentParams, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, braintrust_BaseAttachment as BaseAttachment, braintrust_BaseExperiment as BaseExperiment, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustExporter as BraintrustExporter, braintrust_BraintrustMiddleware as BraintrustMiddleware, braintrust_BraintrustSpanProcessor as BraintrustSpanProcessor, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, braintrust_CodeFunction as CodeFunction, type braintrust_CodeOpts as CodeOpts, braintrust_CodePrompt as CodePrompt, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, braintrust_ContextManager as ContextManager, type braintrust_ContextParentSpanIds as ContextParentSpanIds, type braintrust_CreateProjectOpts as CreateProjectOpts, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, braintrust_ERR_PERMALINK as ERR_PERMALINK, type braintrust_EndSpanArgs as EndSpanArgs, braintrust_Eval as Eval, type braintrust_EvalCase as EvalCase, type braintrust_EvalHooks as EvalHooks, type braintrust_EvalResult as EvalResult, braintrust_EvalResultWithSummary as EvalResultWithSummary, type braintrust_EvalScorer as EvalScorer, type braintrust_EvalScorerArgs as EvalScorerArgs, type braintrust_EvalTask as EvalTask, type braintrust_Evaluator as Evaluator, type braintrust_EvaluatorDef as EvaluatorDef, type braintrust_EvaluatorFile as EvaluatorFile, braintrust_Experiment as Experiment, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_ExternalAttachment as ExternalAttachment, type braintrust_ExternalAttachmentParams as ExternalAttachmentParams, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, type braintrust_FunctionEvent as FunctionEvent, braintrust_IDGenerator as IDGenerator, braintrust_INTERNAL_BTQL_LIMIT as INTERNAL_BTQL_LIMIT, type braintrust_InitOptions as InitOptions, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, braintrust_LazyValue as LazyValue, type braintrust_LogOptions as LogOptions, braintrust_Logger as Logger, type braintrust_LoginOptions as LoginOptions, type braintrust_MetricSummary as MetricSummary, braintrust_NOOP_SPAN as NOOP_SPAN, braintrust_NOOP_SPAN_PERMALINK as NOOP_SPAN_PERMALINK, braintrust_NoopSpan as NoopSpan, braintrust_OTELIDGenerator as OTELIDGenerator, type braintrust_ObjectMetadata as ObjectMetadata, braintrust_Project as Project, braintrust_ProjectNameIdMap as ProjectNameIdMap, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, braintrust_PromptBuilder as PromptBuilder, type braintrust_PromptContents as PromptContents, type braintrust_PromptDefinition as PromptDefinition, type braintrust_PromptDefinitionWithTools as PromptDefinitionWithTools, type braintrust_PromptOpts as PromptOpts, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyAttachment as ReadonlyAttachment, braintrust_ReadonlyExperiment as ReadonlyExperiment, braintrust_Reporter as Reporter, type braintrust_ReporterBody as ReporterBody, type braintrust_ScoreSummary as ScoreSummary, braintrust_ScorerBuilder as ScorerBuilder, type braintrust_ScorerOpts as ScorerOpts, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type Span$1 as Span, type braintrust_SpanContext as SpanContext, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, braintrust_TestBackgroundLogger as TestBackgroundLogger, braintrust_ToolBuilder as ToolBuilder, braintrust_UUIDGenerator as UUIDGenerator, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, braintrust__exportsForTestingOnly as _exportsForTestingOnly, braintrust__internalGetGlobalState as _internalGetGlobalState, braintrust__internalSetInitialState as _internalSetInitialState, braintrust_braintrustStreamChunkSchema as braintrustStreamChunkSchema, braintrust_buildLocalSummary as buildLocalSummary, braintrust_createFinalValuePassThroughStream as createFinalValuePassThroughStream, braintrust_currentExperiment as currentExperiment, braintrust_currentLogger as currentLogger, braintrust_currentSpan as currentSpan, braintrust_deepCopyEvent as deepCopyEvent, braintrust_defaultErrorScoreHandler as defaultErrorScoreHandler, braintrust_deserializePlainStringAsJSON as deserializePlainStringAsJSON, braintrust_devNullWritableStream as devNullWritableStream, braintrust_flush as flush, braintrust_getContextManager as getContextManager, braintrust_getIdGenerator as getIdGenerator, braintrust_getPromptVersions as getPromptVersions, braintrust_getSpanParentObject as getSpanParentObject, graphFramework as graph, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, braintrust_initFunction as initFunction, braintrust_initLogger as initLogger, braintrust_invoke as invoke, braintrust_loadPrompt as loadPrompt, braintrust_log as log, braintrust_logError as logError, braintrust_login as login, braintrust_loginToState as loginToState, braintrust_newId as newId, braintrust_parseCachedHeader as parseCachedHeader, braintrust_permalink as permalink, braintrust_projects as projects, braintrust_promptContentsSchema as promptContentsSchema, braintrust_promptDefinitionSchema as promptDefinitionSchema, braintrust_promptDefinitionToPromptData as promptDefinitionToPromptData, braintrust_promptDefinitionWithToolsSchema as promptDefinitionWithToolsSchema, braintrust_renderMessage as renderMessage, braintrust_renderPromptParams as renderPromptParams, braintrust_reportFailures as reportFailures, braintrust_runEvaluator as runEvaluator, braintrust_setFetch as setFetch, braintrust_setMaskingFunction as setMaskingFunction, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, braintrust_traceable as traceable, braintrust_traced as traced, braintrust_updateSpan as updateSpan, braintrust_withCurrent as withCurrent, braintrust_withDataset as withDataset, braintrust_withExperiment as withExperiment, braintrust_withLogger as withLogger, braintrust_withParent as withParent, braintrust_wrapAISDK as wrapAISDK, braintrust_wrapAISDKModel as wrapAISDKModel, braintrust_wrapAnthropic as wrapAnthropic, braintrust_wrapClaudeAgentSDK as wrapClaudeAgentSDK, braintrust_wrapMastraAgent as wrapMastraAgent, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
21701
21803
  }
21702
21804
 
21703
21805
  type EvaluatorManifest = Record<string, EvaluatorDef<unknown, unknown, unknown, BaseMetadata>>;
@@ -28754,4 +28856,4 @@ type EvaluatorDefinitions = z.infer<typeof evaluatorDefinitionsSchema>;
28754
28856
  * @module braintrust
28755
28857
  */
28756
28858
 
28757
- export { AISpanProcessor, type AnyDataset, Attachment, type AttachmentParams, type BackgroundLoggerOpts, BaseAttachment, BaseExperiment, type BaseMetadata, BraintrustExporter, BraintrustMiddleware, BraintrustSpanProcessor, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, CodeFunction, type CodeOpts, CodePrompt, type CommentEvent, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, type CreateProjectOpts, type DataSummary, Dataset, type DatasetRecord, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, ERR_PERMALINK, type EndSpanArgs, Eval, type EvalCase, type EvalHooks, type EvalParameterSerializedSchema, type EvalParameters, type EvalResult, EvalResultWithSummary, type EvalScorer, type EvalScorerArgs, type EvalTask, type Evaluator, type EvaluatorDef, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorFile, type EvaluatorManifest, Experiment, type ExperimentLogFullArgs, type ExperimentLogPartialArgs, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, type FunctionEvent, INTERNAL_BTQL_LIMIT, type IdField, type InitOptions, type InputField, type InvokeFunctionArgs, type InvokeReturn, LEGACY_CACHED_HEADER, LazyValue, type LogCommentFullArgs, type LogFeedbackFullArgs, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, type ObjectMetadata, type OtherExperimentLogFields, type ParentExperimentIds, type ParentProjectLogIds, Project, ProjectNameIdMap, type PromiseUnless, Prompt, PromptBuilder, type PromptContents, type PromptDefinition, type PromptDefinitionWithTools, type PromptOpts, type PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, Reporter, type ReporterBody, type ScoreSummary, ScorerBuilder, type ScorerOpts, type SerializedBraintrustState, type SetCurrentArg, type Span$1 as Span, type SpanContext, SpanImpl, type StartSpanArgs, TestBackgroundLogger, ToolBuilder, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, buildLocalSummary, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, braintrust as default, defaultErrorScoreHandler, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getPromptVersions, getSpanParentObject, graphFramework as graph, init, initDataset, initExperiment, initFunction, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, projects, promptContentsSchema, promptDefinitionSchema, promptDefinitionToPromptData, promptDefinitionWithToolsSchema, renderMessage, renderPromptParams, reportFailures, runEvaluator, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapAISDK, wrapAISDKModel, wrapAnthropic, wrapMastraAgent, wrapOpenAI, wrapOpenAIv4, wrapTraced };
28859
+ export { AISpanProcessor, type AnyDataset, Attachment, type AttachmentParams, type BackgroundLoggerOpts, BaseAttachment, BaseExperiment, type BaseMetadata, BraintrustExporter, BraintrustMiddleware, BraintrustSpanProcessor, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, CodeFunction, type CodeOpts, CodePrompt, type CommentEvent, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, ContextManager, type ContextParentSpanIds, type CreateProjectOpts, type DataSummary, Dataset, type DatasetRecord, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, ERR_PERMALINK, type EndSpanArgs, Eval, type EvalCase, type EvalHooks, type EvalParameterSerializedSchema, type EvalParameters, type EvalResult, EvalResultWithSummary, type EvalScorer, type EvalScorerArgs, type EvalTask, type Evaluator, type EvaluatorDef, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorFile, type EvaluatorManifest, Experiment, type ExperimentLogFullArgs, type ExperimentLogPartialArgs, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, type FunctionEvent, IDGenerator, INTERNAL_BTQL_LIMIT, type IdField, type InitOptions, type InputField, type InvokeFunctionArgs, type InvokeReturn, LEGACY_CACHED_HEADER, LazyValue, type LogCommentFullArgs, type LogFeedbackFullArgs, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, OTELIDGenerator, type ObjectMetadata, type OtherExperimentLogFields, type ParentExperimentIds, type ParentProjectLogIds, Project, ProjectNameIdMap, type PromiseUnless, Prompt, PromptBuilder, type PromptContents, type PromptDefinition, type PromptDefinitionWithTools, type PromptOpts, type PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, Reporter, type ReporterBody, type ScoreSummary, ScorerBuilder, type ScorerOpts, type SerializedBraintrustState, type SetCurrentArg, type Span$1 as Span, type SpanContext, SpanImpl, type StartSpanArgs, TestBackgroundLogger, ToolBuilder, UUIDGenerator, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, buildLocalSummary, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, braintrust as default, defaultErrorScoreHandler, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getContextManager, getIdGenerator, getPromptVersions, getSpanParentObject, graphFramework as graph, init, initDataset, initExperiment, initFunction, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, projects, promptContentsSchema, promptDefinitionSchema, promptDefinitionToPromptData, promptDefinitionWithToolsSchema, renderMessage, renderPromptParams, reportFailures, runEvaluator, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapAISDK, wrapAISDKModel, wrapAnthropic, wrapClaudeAgentSDK, wrapMastraAgent, wrapOpenAI, wrapOpenAIv4, wrapTraced };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,48 @@
1
1
  import { z } from 'zod/v3';
2
2
  import { z as z$1 } from 'zod';
3
3
 
4
+ /**
5
+ * Abstract base class for ID generators
6
+ */
7
+ declare abstract class IDGenerator {
8
+ /**
9
+ * Generate a span ID
10
+ */
11
+ abstract getSpanId(): string;
12
+ /**
13
+ * Generate a trace ID
14
+ */
15
+ abstract getTraceId(): string;
16
+ /**
17
+ * Return true if the generator should use span_id as root_span_id for backwards compatibility
18
+ */
19
+ abstract shareRootSpanId(): boolean;
20
+ }
21
+ /**
22
+ * ID generator that uses UUID4 for both span and trace IDs
23
+ */
24
+ declare class UUIDGenerator extends IDGenerator {
25
+ getSpanId(): string;
26
+ getTraceId(): string;
27
+ shareRootSpanId(): boolean;
28
+ }
29
+ /**
30
+ * ID generator that generates OpenTelemetry-compatible IDs
31
+ * Uses hex strings for compatibility with OpenTelemetry systems
32
+ */
33
+ declare class OTELIDGenerator extends IDGenerator {
34
+ getSpanId(): string;
35
+ getTraceId(): string;
36
+ shareRootSpanId(): boolean;
37
+ }
38
+ /**
39
+ * Factory function that creates a new ID generator instance each time.
40
+ *
41
+ * This eliminates global state and makes tests parallelizable.
42
+ * Each caller gets their own generator instance.
43
+ */
44
+ declare function getIdGenerator(): IDGenerator;
45
+
4
46
  declare const TRANSACTION_ID_FIELD = "_xact_id";
5
47
  declare const IS_MERGE_FIELD = "_is_merge";
6
48
  declare const MERGE_PATHS_FIELD = "_merge_paths";
@@ -14283,8 +14325,10 @@ declare class LazyValue<T> {
14283
14325
  get hasSucceeded(): boolean;
14284
14326
  }
14285
14327
 
14286
- /// <reference lib="dom" />
14287
-
14328
+ interface ContextParentSpanIds {
14329
+ rootSpanId: string;
14330
+ spanParents: string[];
14331
+ }
14288
14332
  type SetCurrentArg = {
14289
14333
  setCurrent?: boolean;
14290
14334
  };
@@ -14435,6 +14479,12 @@ interface Span$1 extends Exportable {
14435
14479
  state(): BraintrustState;
14436
14480
  kind: "span";
14437
14481
  }
14482
+ declare abstract class ContextManager {
14483
+ abstract getParentSpanIds(): ContextParentSpanIds | undefined;
14484
+ abstract runInContext<R>(span: Span$1, callback: () => R): R;
14485
+ abstract getCurrentSpan(): Span$1 | undefined;
14486
+ }
14487
+ declare function getContextManager(): ContextManager;
14438
14488
  /**
14439
14489
  * A fake implementation of the Span API which does nothing. This can be used as the default span.
14440
14490
  */
@@ -14532,8 +14582,13 @@ declare class BraintrustState {
14532
14582
  private _apiConn;
14533
14583
  private _proxyConn;
14534
14584
  promptCache: PromptCache;
14585
+ private _idGenerator;
14586
+ private _contextManager;
14535
14587
  constructor(loginParams: LoginOptions);
14536
14588
  resetLoginInfo(): void;
14589
+ resetIdGenState(): void;
14590
+ get idGenerator(): IDGenerator;
14591
+ get contextManager(): ContextManager;
14537
14592
  copyLoginInfo(other: BraintrustState): void;
14538
14593
  serialize(): SerializedBraintrustState;
14539
14594
  static deserialize(serialized: unknown, opts?: LoginOptions): BraintrustState;
@@ -15845,6 +15900,7 @@ declare function simulateLogoutForTests(): BraintrustState;
15845
15900
  * @returns Promise containing the version data
15846
15901
  */
15847
15902
  declare function getPromptVersions(projectId: string, promptId: string): Promise<any>;
15903
+ declare function resetIdGenStateForTests(): void;
15848
15904
  declare const _exportsForTestingOnly: {
15849
15905
  extractAttachments: typeof extractAttachments;
15850
15906
  deepCopyEvent: typeof deepCopyEvent;
@@ -15856,6 +15912,7 @@ declare const _exportsForTestingOnly: {
15856
15912
  initTestExperiment: typeof initTestExperiment;
15857
15913
  isGeneratorFunction: typeof isGeneratorFunction;
15858
15914
  isAsyncGeneratorFunction: typeof isAsyncGeneratorFunction;
15915
+ resetIdGenStateForTests: typeof resetIdGenStateForTests;
15859
15916
  };
15860
15917
 
15861
15918
  declare const braintrustStreamChunkSchema: z.ZodUnion<[z.ZodObject<{
@@ -21248,14 +21305,14 @@ interface MastraAgentMethods {
21248
21305
  tools?: Record<string, unknown> | unknown[];
21249
21306
  model?: any;
21250
21307
  __setTools(tools: Record<string, unknown> | unknown[]): void;
21251
- generateVNext?: (params: any) => any;
21252
- streamVNext?: (params: any) => any;
21308
+ generate?: (params: any) => any;
21309
+ stream?: (params: any) => any;
21253
21310
  }
21254
21311
  /**
21255
21312
  * Wraps a Mastra agent with Braintrust tracing. This function wraps the agent's
21256
21313
  * underlying language model with BraintrustMiddleware and traces all agent method calls.
21257
21314
  *
21258
- * **Important**: This wrapper only supports AI SDK v5 methods such as `generateVNext` and `streamVNext`.
21315
+ * **Important**: This wrapper only supports AI SDK v5 methods such as `generate` and `stream`.
21259
21316
  *
21260
21317
  * @param agent - The Mastra agent to wrap
21261
21318
  * @param options - Optional configuration for the wrapper
@@ -21293,8 +21350,37 @@ declare function wrapMastraAgent<T extends MastraAgentMethods>(agent: T, options
21293
21350
  */
21294
21351
  declare function wrapAnthropic<T extends object>(anthropic: T): T;
21295
21352
 
21353
+ /**
21354
+ * Wraps the Claude Agent SDK with Braintrust tracing. This returns wrapped versions
21355
+ * of query and tool that automatically trace all agent interactions.
21356
+ *
21357
+ * @param sdk - The Claude Agent SDK module
21358
+ * @returns Object with wrapped query, tool, and createSdkMcpServer functions
21359
+ *
21360
+ * @example
21361
+ * ```typescript
21362
+ * import * as claudeSDK from "@anthropic-ai/claude-agent-sdk";
21363
+ * import { wrapClaudeAgentSDK } from "braintrust";
21364
+ *
21365
+ * // Wrap once - returns { query, tool, createSdkMcpServer } with tracing built-in
21366
+ * const { query, tool, createSdkMcpServer } = wrapClaudeAgentSDK(claudeSDK);
21367
+ *
21368
+ * // Use normally - tracing is automatic
21369
+ * for await (const message of query({
21370
+ * prompt: "Hello, Claude!",
21371
+ * options: { model: "claude-3-5-sonnet-20241022" }
21372
+ * })) {
21373
+ * console.log(message);
21374
+ * }
21375
+ *
21376
+ * // Tools created with wrapped tool() are automatically traced
21377
+ * const calculator = tool("calculator", "Does math", schema, handler);
21378
+ * ```
21379
+ */
21380
+ declare function wrapClaudeAgentSDK<T extends object>(sdk: T): T;
21381
+
21296
21382
  interface Context {
21297
- [key: string]: any;
21383
+ getValue?: (key: string) => unknown;
21298
21384
  }
21299
21385
  interface SpanProcessor {
21300
21386
  onStart(span: Span, parentContext?: Context): void;
@@ -21453,6 +21539,7 @@ declare class BraintrustSpanProcessor {
21453
21539
  private readonly aiSpanProcessor;
21454
21540
  constructor(options?: BraintrustSpanProcessorOptions);
21455
21541
  onStart(span: Span, parentContext: Context): void;
21542
+ private _getParentOtelBraintrustParent;
21456
21543
  onEnd(span: ReadableSpan): void;
21457
21544
  shutdown(): Promise<void>;
21458
21545
  forceFlush(): Promise<void>;
@@ -21510,7 +21597,10 @@ declare class BraintrustExporter {
21510
21597
  /**
21511
21598
  * Export spans to Braintrust by simulating span processor behavior.
21512
21599
  */
21513
- export(spans: ReadableSpan[], resultCallback: (result: any) => void): void;
21600
+ export(spans: ReadableSpan[], resultCallback: (result: {
21601
+ code: number;
21602
+ error?: unknown;
21603
+ }) => void): void;
21514
21604
  /**
21515
21605
  * Shutdown the exporter.
21516
21606
  */
@@ -21551,6 +21641,9 @@ declare const braintrust_CodePrompt: typeof CodePrompt;
21551
21641
  type braintrust_CompiledPrompt<Flavor extends "chat" | "completion"> = CompiledPrompt<Flavor>;
21552
21642
  type braintrust_CompiledPromptParams = CompiledPromptParams;
21553
21643
  type braintrust_CompletionPrompt = CompletionPrompt;
21644
+ type braintrust_ContextManager = ContextManager;
21645
+ declare const braintrust_ContextManager: typeof ContextManager;
21646
+ type braintrust_ContextParentSpanIds = ContextParentSpanIds;
21554
21647
  type braintrust_CreateProjectOpts = CreateProjectOpts;
21555
21648
  type braintrust_DataSummary = DataSummary;
21556
21649
  type braintrust_Dataset<IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY_DATASET> = Dataset<IsLegacyDataset>;
@@ -21584,6 +21677,8 @@ declare const braintrust_FailedHTTPResponse: typeof FailedHTTPResponse;
21584
21677
  type braintrust_FullInitOptions<IsOpen extends boolean> = FullInitOptions<IsOpen>;
21585
21678
  type braintrust_FullLoginOptions = FullLoginOptions;
21586
21679
  type braintrust_FunctionEvent = FunctionEvent;
21680
+ type braintrust_IDGenerator = IDGenerator;
21681
+ declare const braintrust_IDGenerator: typeof IDGenerator;
21587
21682
  declare const braintrust_INTERNAL_BTQL_LIMIT: typeof INTERNAL_BTQL_LIMIT;
21588
21683
  type braintrust_InitOptions<IsOpen extends boolean> = InitOptions<IsOpen>;
21589
21684
  type braintrust_InvokeFunctionArgs<Input, Output, Stream extends boolean = false> = InvokeFunctionArgs<Input, Output, Stream>;
@@ -21600,6 +21695,8 @@ declare const braintrust_NOOP_SPAN: typeof NOOP_SPAN;
21600
21695
  declare const braintrust_NOOP_SPAN_PERMALINK: typeof NOOP_SPAN_PERMALINK;
21601
21696
  type braintrust_NoopSpan = NoopSpan;
21602
21697
  declare const braintrust_NoopSpan: typeof NoopSpan;
21698
+ type braintrust_OTELIDGenerator = OTELIDGenerator;
21699
+ declare const braintrust_OTELIDGenerator: typeof OTELIDGenerator;
21603
21700
  type braintrust_ObjectMetadata = ObjectMetadata;
21604
21701
  type braintrust_Project = Project;
21605
21702
  declare const braintrust_Project: typeof Project;
@@ -21635,6 +21732,8 @@ type braintrust_TestBackgroundLogger = TestBackgroundLogger;
21635
21732
  declare const braintrust_TestBackgroundLogger: typeof TestBackgroundLogger;
21636
21733
  type braintrust_ToolBuilder = ToolBuilder;
21637
21734
  declare const braintrust_ToolBuilder: typeof ToolBuilder;
21735
+ type braintrust_UUIDGenerator = UUIDGenerator;
21736
+ declare const braintrust_UUIDGenerator: typeof UUIDGenerator;
21638
21737
  type braintrust_WithTransactionId<R> = WithTransactionId<R>;
21639
21738
  declare const braintrust_X_CACHED_HEADER: typeof X_CACHED_HEADER;
21640
21739
  declare const braintrust__exportsForTestingOnly: typeof _exportsForTestingOnly;
@@ -21651,6 +21750,8 @@ declare const braintrust_defaultErrorScoreHandler: typeof defaultErrorScoreHandl
21651
21750
  declare const braintrust_deserializePlainStringAsJSON: typeof deserializePlainStringAsJSON;
21652
21751
  declare const braintrust_devNullWritableStream: typeof devNullWritableStream;
21653
21752
  declare const braintrust_flush: typeof flush;
21753
+ declare const braintrust_getContextManager: typeof getContextManager;
21754
+ declare const braintrust_getIdGenerator: typeof getIdGenerator;
21654
21755
  declare const braintrust_getPromptVersions: typeof getPromptVersions;
21655
21756
  declare const braintrust_getSpanParentObject: typeof getSpanParentObject;
21656
21757
  declare const braintrust_init: typeof init;
@@ -21692,12 +21793,13 @@ declare const braintrust_withParent: typeof withParent;
21692
21793
  declare const braintrust_wrapAISDK: typeof wrapAISDK;
21693
21794
  declare const braintrust_wrapAISDKModel: typeof wrapAISDKModel;
21694
21795
  declare const braintrust_wrapAnthropic: typeof wrapAnthropic;
21796
+ declare const braintrust_wrapClaudeAgentSDK: typeof wrapClaudeAgentSDK;
21695
21797
  declare const braintrust_wrapMastraAgent: typeof wrapMastraAgent;
21696
21798
  declare const braintrust_wrapOpenAI: typeof wrapOpenAI;
21697
21799
  declare const braintrust_wrapOpenAIv4: typeof wrapOpenAIv4;
21698
21800
  declare const braintrust_wrapTraced: typeof wrapTraced;
21699
21801
  declare namespace braintrust {
21700
- export { braintrust_AISpanProcessor as AISpanProcessor, type braintrust_AnyDataset as AnyDataset, braintrust_Attachment as Attachment, type braintrust_AttachmentParams as AttachmentParams, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, braintrust_BaseAttachment as BaseAttachment, braintrust_BaseExperiment as BaseExperiment, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustExporter as BraintrustExporter, braintrust_BraintrustMiddleware as BraintrustMiddleware, braintrust_BraintrustSpanProcessor as BraintrustSpanProcessor, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, braintrust_CodeFunction as CodeFunction, type braintrust_CodeOpts as CodeOpts, braintrust_CodePrompt as CodePrompt, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, type braintrust_CreateProjectOpts as CreateProjectOpts, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, braintrust_ERR_PERMALINK as ERR_PERMALINK, type braintrust_EndSpanArgs as EndSpanArgs, braintrust_Eval as Eval, type braintrust_EvalCase as EvalCase, type braintrust_EvalHooks as EvalHooks, type braintrust_EvalResult as EvalResult, braintrust_EvalResultWithSummary as EvalResultWithSummary, type braintrust_EvalScorer as EvalScorer, type braintrust_EvalScorerArgs as EvalScorerArgs, type braintrust_EvalTask as EvalTask, type braintrust_Evaluator as Evaluator, type braintrust_EvaluatorDef as EvaluatorDef, type braintrust_EvaluatorFile as EvaluatorFile, braintrust_Experiment as Experiment, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_ExternalAttachment as ExternalAttachment, type braintrust_ExternalAttachmentParams as ExternalAttachmentParams, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, type braintrust_FunctionEvent as FunctionEvent, braintrust_INTERNAL_BTQL_LIMIT as INTERNAL_BTQL_LIMIT, type braintrust_InitOptions as InitOptions, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, braintrust_LazyValue as LazyValue, type braintrust_LogOptions as LogOptions, braintrust_Logger as Logger, type braintrust_LoginOptions as LoginOptions, type braintrust_MetricSummary as MetricSummary, braintrust_NOOP_SPAN as NOOP_SPAN, braintrust_NOOP_SPAN_PERMALINK as NOOP_SPAN_PERMALINK, braintrust_NoopSpan as NoopSpan, type braintrust_ObjectMetadata as ObjectMetadata, braintrust_Project as Project, braintrust_ProjectNameIdMap as ProjectNameIdMap, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, braintrust_PromptBuilder as PromptBuilder, type braintrust_PromptContents as PromptContents, type braintrust_PromptDefinition as PromptDefinition, type braintrust_PromptDefinitionWithTools as PromptDefinitionWithTools, type braintrust_PromptOpts as PromptOpts, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyAttachment as ReadonlyAttachment, braintrust_ReadonlyExperiment as ReadonlyExperiment, braintrust_Reporter as Reporter, type braintrust_ReporterBody as ReporterBody, type braintrust_ScoreSummary as ScoreSummary, braintrust_ScorerBuilder as ScorerBuilder, type braintrust_ScorerOpts as ScorerOpts, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type Span$1 as Span, type braintrust_SpanContext as SpanContext, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, braintrust_TestBackgroundLogger as TestBackgroundLogger, braintrust_ToolBuilder as ToolBuilder, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, braintrust__exportsForTestingOnly as _exportsForTestingOnly, braintrust__internalGetGlobalState as _internalGetGlobalState, braintrust__internalSetInitialState as _internalSetInitialState, braintrust_braintrustStreamChunkSchema as braintrustStreamChunkSchema, braintrust_buildLocalSummary as buildLocalSummary, braintrust_createFinalValuePassThroughStream as createFinalValuePassThroughStream, braintrust_currentExperiment as currentExperiment, braintrust_currentLogger as currentLogger, braintrust_currentSpan as currentSpan, braintrust_deepCopyEvent as deepCopyEvent, braintrust_defaultErrorScoreHandler as defaultErrorScoreHandler, braintrust_deserializePlainStringAsJSON as deserializePlainStringAsJSON, braintrust_devNullWritableStream as devNullWritableStream, braintrust_flush as flush, braintrust_getPromptVersions as getPromptVersions, braintrust_getSpanParentObject as getSpanParentObject, graphFramework as graph, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, braintrust_initFunction as initFunction, braintrust_initLogger as initLogger, braintrust_invoke as invoke, braintrust_loadPrompt as loadPrompt, braintrust_log as log, braintrust_logError as logError, braintrust_login as login, braintrust_loginToState as loginToState, braintrust_newId as newId, braintrust_parseCachedHeader as parseCachedHeader, braintrust_permalink as permalink, braintrust_projects as projects, braintrust_promptContentsSchema as promptContentsSchema, braintrust_promptDefinitionSchema as promptDefinitionSchema, braintrust_promptDefinitionToPromptData as promptDefinitionToPromptData, braintrust_promptDefinitionWithToolsSchema as promptDefinitionWithToolsSchema, braintrust_renderMessage as renderMessage, braintrust_renderPromptParams as renderPromptParams, braintrust_reportFailures as reportFailures, braintrust_runEvaluator as runEvaluator, braintrust_setFetch as setFetch, braintrust_setMaskingFunction as setMaskingFunction, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, braintrust_traceable as traceable, braintrust_traced as traced, braintrust_updateSpan as updateSpan, braintrust_withCurrent as withCurrent, braintrust_withDataset as withDataset, braintrust_withExperiment as withExperiment, braintrust_withLogger as withLogger, braintrust_withParent as withParent, braintrust_wrapAISDK as wrapAISDK, braintrust_wrapAISDKModel as wrapAISDKModel, braintrust_wrapAnthropic as wrapAnthropic, braintrust_wrapMastraAgent as wrapMastraAgent, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
21802
+ export { braintrust_AISpanProcessor as AISpanProcessor, type braintrust_AnyDataset as AnyDataset, braintrust_Attachment as Attachment, type braintrust_AttachmentParams as AttachmentParams, type braintrust_BackgroundLoggerOpts as BackgroundLoggerOpts, braintrust_BaseAttachment as BaseAttachment, braintrust_BaseExperiment as BaseExperiment, type braintrust_BaseMetadata as BaseMetadata, braintrust_BraintrustExporter as BraintrustExporter, braintrust_BraintrustMiddleware as BraintrustMiddleware, braintrust_BraintrustSpanProcessor as BraintrustSpanProcessor, braintrust_BraintrustState as BraintrustState, braintrust_BraintrustStream as BraintrustStream, type braintrust_BraintrustStreamChunk as BraintrustStreamChunk, type braintrust_ChatPrompt as ChatPrompt, braintrust_CodeFunction as CodeFunction, type braintrust_CodeOpts as CodeOpts, braintrust_CodePrompt as CodePrompt, type braintrust_CompiledPrompt as CompiledPrompt, type braintrust_CompiledPromptParams as CompiledPromptParams, type braintrust_CompletionPrompt as CompletionPrompt, braintrust_ContextManager as ContextManager, type braintrust_ContextParentSpanIds as ContextParentSpanIds, type braintrust_CreateProjectOpts as CreateProjectOpts, type braintrust_DataSummary as DataSummary, braintrust_Dataset as Dataset, type braintrust_DatasetSummary as DatasetSummary, type braintrust_DefaultMetadataType as DefaultMetadataType, type braintrust_DefaultPromptArgs as DefaultPromptArgs, braintrust_ERR_PERMALINK as ERR_PERMALINK, type braintrust_EndSpanArgs as EndSpanArgs, braintrust_Eval as Eval, type braintrust_EvalCase as EvalCase, type braintrust_EvalHooks as EvalHooks, type braintrust_EvalResult as EvalResult, braintrust_EvalResultWithSummary as EvalResultWithSummary, type braintrust_EvalScorer as EvalScorer, type braintrust_EvalScorerArgs as EvalScorerArgs, type braintrust_EvalTask as EvalTask, type braintrust_Evaluator as Evaluator, type braintrust_EvaluatorDef as EvaluatorDef, type braintrust_EvaluatorFile as EvaluatorFile, braintrust_Experiment as Experiment, type braintrust_ExperimentSummary as ExperimentSummary, type braintrust_Exportable as Exportable, braintrust_ExternalAttachment as ExternalAttachment, type braintrust_ExternalAttachmentParams as ExternalAttachmentParams, braintrust_FailedHTTPResponse as FailedHTTPResponse, type braintrust_FullInitOptions as FullInitOptions, type braintrust_FullLoginOptions as FullLoginOptions, type braintrust_FunctionEvent as FunctionEvent, braintrust_IDGenerator as IDGenerator, braintrust_INTERNAL_BTQL_LIMIT as INTERNAL_BTQL_LIMIT, type braintrust_InitOptions as InitOptions, type braintrust_InvokeFunctionArgs as InvokeFunctionArgs, type braintrust_InvokeReturn as InvokeReturn, braintrust_LEGACY_CACHED_HEADER as LEGACY_CACHED_HEADER, braintrust_LazyValue as LazyValue, type braintrust_LogOptions as LogOptions, braintrust_Logger as Logger, type braintrust_LoginOptions as LoginOptions, type braintrust_MetricSummary as MetricSummary, braintrust_NOOP_SPAN as NOOP_SPAN, braintrust_NOOP_SPAN_PERMALINK as NOOP_SPAN_PERMALINK, braintrust_NoopSpan as NoopSpan, braintrust_OTELIDGenerator as OTELIDGenerator, type braintrust_ObjectMetadata as ObjectMetadata, braintrust_Project as Project, braintrust_ProjectNameIdMap as ProjectNameIdMap, type braintrust_PromiseUnless as PromiseUnless, braintrust_Prompt as Prompt, braintrust_PromptBuilder as PromptBuilder, type braintrust_PromptContents as PromptContents, type braintrust_PromptDefinition as PromptDefinition, type braintrust_PromptDefinitionWithTools as PromptDefinitionWithTools, type braintrust_PromptOpts as PromptOpts, type braintrust_PromptRowWithId as PromptRowWithId, braintrust_ReadonlyAttachment as ReadonlyAttachment, braintrust_ReadonlyExperiment as ReadonlyExperiment, braintrust_Reporter as Reporter, type braintrust_ReporterBody as ReporterBody, type braintrust_ScoreSummary as ScoreSummary, braintrust_ScorerBuilder as ScorerBuilder, type braintrust_ScorerOpts as ScorerOpts, type braintrust_SerializedBraintrustState as SerializedBraintrustState, type braintrust_SetCurrentArg as SetCurrentArg, type Span$1 as Span, type braintrust_SpanContext as SpanContext, braintrust_SpanImpl as SpanImpl, type braintrust_StartSpanArgs as StartSpanArgs, braintrust_TestBackgroundLogger as TestBackgroundLogger, braintrust_ToolBuilder as ToolBuilder, braintrust_UUIDGenerator as UUIDGenerator, type braintrust_WithTransactionId as WithTransactionId, braintrust_X_CACHED_HEADER as X_CACHED_HEADER, braintrust__exportsForTestingOnly as _exportsForTestingOnly, braintrust__internalGetGlobalState as _internalGetGlobalState, braintrust__internalSetInitialState as _internalSetInitialState, braintrust_braintrustStreamChunkSchema as braintrustStreamChunkSchema, braintrust_buildLocalSummary as buildLocalSummary, braintrust_createFinalValuePassThroughStream as createFinalValuePassThroughStream, braintrust_currentExperiment as currentExperiment, braintrust_currentLogger as currentLogger, braintrust_currentSpan as currentSpan, braintrust_deepCopyEvent as deepCopyEvent, braintrust_defaultErrorScoreHandler as defaultErrorScoreHandler, braintrust_deserializePlainStringAsJSON as deserializePlainStringAsJSON, braintrust_devNullWritableStream as devNullWritableStream, braintrust_flush as flush, braintrust_getContextManager as getContextManager, braintrust_getIdGenerator as getIdGenerator, braintrust_getPromptVersions as getPromptVersions, braintrust_getSpanParentObject as getSpanParentObject, graphFramework as graph, braintrust_init as init, braintrust_initDataset as initDataset, braintrust_initExperiment as initExperiment, braintrust_initFunction as initFunction, braintrust_initLogger as initLogger, braintrust_invoke as invoke, braintrust_loadPrompt as loadPrompt, braintrust_log as log, braintrust_logError as logError, braintrust_login as login, braintrust_loginToState as loginToState, braintrust_newId as newId, braintrust_parseCachedHeader as parseCachedHeader, braintrust_permalink as permalink, braintrust_projects as projects, braintrust_promptContentsSchema as promptContentsSchema, braintrust_promptDefinitionSchema as promptDefinitionSchema, braintrust_promptDefinitionToPromptData as promptDefinitionToPromptData, braintrust_promptDefinitionWithToolsSchema as promptDefinitionWithToolsSchema, braintrust_renderMessage as renderMessage, braintrust_renderPromptParams as renderPromptParams, braintrust_reportFailures as reportFailures, braintrust_runEvaluator as runEvaluator, braintrust_setFetch as setFetch, braintrust_setMaskingFunction as setMaskingFunction, braintrust_spanComponentsToObjectId as spanComponentsToObjectId, braintrust_startSpan as startSpan, braintrust_summarize as summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, braintrust_traceable as traceable, braintrust_traced as traced, braintrust_updateSpan as updateSpan, braintrust_withCurrent as withCurrent, braintrust_withDataset as withDataset, braintrust_withExperiment as withExperiment, braintrust_withLogger as withLogger, braintrust_withParent as withParent, braintrust_wrapAISDK as wrapAISDK, braintrust_wrapAISDKModel as wrapAISDKModel, braintrust_wrapAnthropic as wrapAnthropic, braintrust_wrapClaudeAgentSDK as wrapClaudeAgentSDK, braintrust_wrapMastraAgent as wrapMastraAgent, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
21701
21803
  }
21702
21804
 
21703
21805
  type EvaluatorManifest = Record<string, EvaluatorDef<unknown, unknown, unknown, BaseMetadata>>;
@@ -28754,4 +28856,4 @@ type EvaluatorDefinitions = z.infer<typeof evaluatorDefinitionsSchema>;
28754
28856
  * @module braintrust
28755
28857
  */
28756
28858
 
28757
- export { AISpanProcessor, type AnyDataset, Attachment, type AttachmentParams, type BackgroundLoggerOpts, BaseAttachment, BaseExperiment, type BaseMetadata, BraintrustExporter, BraintrustMiddleware, BraintrustSpanProcessor, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, CodeFunction, type CodeOpts, CodePrompt, type CommentEvent, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, type CreateProjectOpts, type DataSummary, Dataset, type DatasetRecord, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, ERR_PERMALINK, type EndSpanArgs, Eval, type EvalCase, type EvalHooks, type EvalParameterSerializedSchema, type EvalParameters, type EvalResult, EvalResultWithSummary, type EvalScorer, type EvalScorerArgs, type EvalTask, type Evaluator, type EvaluatorDef, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorFile, type EvaluatorManifest, Experiment, type ExperimentLogFullArgs, type ExperimentLogPartialArgs, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, type FunctionEvent, INTERNAL_BTQL_LIMIT, type IdField, type InitOptions, type InputField, type InvokeFunctionArgs, type InvokeReturn, LEGACY_CACHED_HEADER, LazyValue, type LogCommentFullArgs, type LogFeedbackFullArgs, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, type ObjectMetadata, type OtherExperimentLogFields, type ParentExperimentIds, type ParentProjectLogIds, Project, ProjectNameIdMap, type PromiseUnless, Prompt, PromptBuilder, type PromptContents, type PromptDefinition, type PromptDefinitionWithTools, type PromptOpts, type PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, Reporter, type ReporterBody, type ScoreSummary, ScorerBuilder, type ScorerOpts, type SerializedBraintrustState, type SetCurrentArg, type Span$1 as Span, type SpanContext, SpanImpl, type StartSpanArgs, TestBackgroundLogger, ToolBuilder, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, buildLocalSummary, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, braintrust as default, defaultErrorScoreHandler, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getPromptVersions, getSpanParentObject, graphFramework as graph, init, initDataset, initExperiment, initFunction, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, projects, promptContentsSchema, promptDefinitionSchema, promptDefinitionToPromptData, promptDefinitionWithToolsSchema, renderMessage, renderPromptParams, reportFailures, runEvaluator, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapAISDK, wrapAISDKModel, wrapAnthropic, wrapMastraAgent, wrapOpenAI, wrapOpenAIv4, wrapTraced };
28859
+ export { AISpanProcessor, type AnyDataset, Attachment, type AttachmentParams, type BackgroundLoggerOpts, BaseAttachment, BaseExperiment, type BaseMetadata, BraintrustExporter, BraintrustMiddleware, BraintrustSpanProcessor, BraintrustState, BraintrustStream, type BraintrustStreamChunk, type ChatPrompt, CodeFunction, type CodeOpts, CodePrompt, type CommentEvent, type CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, ContextManager, type ContextParentSpanIds, type CreateProjectOpts, type DataSummary, Dataset, type DatasetRecord, type DatasetSummary, type DefaultMetadataType, type DefaultPromptArgs, ERR_PERMALINK, type EndSpanArgs, Eval, type EvalCase, type EvalHooks, type EvalParameterSerializedSchema, type EvalParameters, type EvalResult, EvalResultWithSummary, type EvalScorer, type EvalScorerArgs, type EvalTask, type Evaluator, type EvaluatorDef, type EvaluatorDefinition, type EvaluatorDefinitions, type EvaluatorFile, type EvaluatorManifest, Experiment, type ExperimentLogFullArgs, type ExperimentLogPartialArgs, type ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, type FunctionEvent, IDGenerator, INTERNAL_BTQL_LIMIT, type IdField, type InitOptions, type InputField, type InvokeFunctionArgs, type InvokeReturn, LEGACY_CACHED_HEADER, LazyValue, type LogCommentFullArgs, type LogFeedbackFullArgs, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, OTELIDGenerator, type ObjectMetadata, type OtherExperimentLogFields, type ParentExperimentIds, type ParentProjectLogIds, Project, ProjectNameIdMap, type PromiseUnless, Prompt, PromptBuilder, type PromptContents, type PromptDefinition, type PromptDefinitionWithTools, type PromptOpts, type PromptRowWithId, ReadonlyAttachment, ReadonlyExperiment, Reporter, type ReporterBody, type ScoreSummary, ScorerBuilder, type ScorerOpts, type SerializedBraintrustState, type SetCurrentArg, type Span$1 as Span, type SpanContext, SpanImpl, type StartSpanArgs, TestBackgroundLogger, ToolBuilder, UUIDGenerator, type WithTransactionId, X_CACHED_HEADER, _exportsForTestingOnly, _internalGetGlobalState, _internalSetInitialState, braintrustStreamChunkSchema, buildLocalSummary, createFinalValuePassThroughStream, currentExperiment, currentLogger, currentSpan, deepCopyEvent, braintrust as default, defaultErrorScoreHandler, deserializePlainStringAsJSON, devNullWritableStream, evaluatorDefinitionSchema, evaluatorDefinitionsSchema, flush, getContextManager, getIdGenerator, getPromptVersions, getSpanParentObject, graphFramework as graph, init, initDataset, initExperiment, initFunction, initLogger, invoke, loadPrompt, log, logError, login, loginToState, newId, parseCachedHeader, permalink, projects, promptContentsSchema, promptDefinitionSchema, promptDefinitionToPromptData, promptDefinitionWithToolsSchema, renderMessage, renderPromptParams, reportFailures, runEvaluator, setFetch, setMaskingFunction, spanComponentsToObjectId, startSpan, summarize, ToolFunctionDefinition as toolFunctionDefinitionSchema, traceable, traced, updateSpan, withCurrent, withDataset, withExperiment, withLogger, withParent, wrapAISDK, wrapAISDKModel, wrapAnthropic, wrapClaudeAgentSDK, wrapMastraAgent, wrapOpenAI, wrapOpenAIv4, wrapTraced };