braintrust 0.3.6 → 0.3.8

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,295 @@
1
- import { TRANSACTION_ID_FIELD, TransactionId, ExperimentEvent, DEFAULT_IS_LEGACY_DATASET, DatasetRecord, ExperimentLogFullArgs, ExperimentLogPartialArgs, LogFeedbackFullArgs, SpanType, IdField, BackgroundLogEvent, SpanComponentsV3, SpanObjectTypeV3, Score } from '@braintrust/core';
2
- export { CommentEvent, DatasetRecord, ExperimentLogFullArgs, ExperimentLogPartialArgs, IdField, InputField, LogCommentFullArgs, LogFeedbackFullArgs, OtherExperimentLogFields, ParentExperimentIds, ParentProjectLogIds } from '@braintrust/core';
3
- import { z } from 'zod';
1
+ import { z } from 'zod/v3';
2
+ import { z as z$1 } from 'zod';
3
+
4
+ declare const TRANSACTION_ID_FIELD = "_xact_id";
5
+ declare const IS_MERGE_FIELD = "_is_merge";
6
+ declare const MERGE_PATHS_FIELD = "_merge_paths";
7
+ declare const AUDIT_SOURCE_FIELD = "_audit_source";
8
+ declare const AUDIT_METADATA_FIELD = "_audit_metadata";
9
+ declare const VALID_SOURCES: readonly ["app", "api", "external"];
10
+ type Source = (typeof VALID_SOURCES)[number];
11
+ declare const ASYNC_SCORING_CONTROL_FIELD = "_async_scoring_control";
12
+ declare const SKIP_ASYNC_SCORING_FIELD = "_skip_async_scoring";
13
+ type TransactionId = string;
14
+
15
+ declare const AsyncScoringControl: z.ZodUnion<[z.ZodObject<{
16
+ kind: z.ZodLiteral<"score_update">;
17
+ token: z.ZodString;
18
+ }, "strip", z.ZodTypeAny, {
19
+ token: string;
20
+ kind: "score_update";
21
+ }, {
22
+ token: string;
23
+ kind: "score_update";
24
+ }>, z.ZodObject<{
25
+ kind: z.ZodLiteral<"state_override">;
26
+ state: z.ZodUnion<[z.ZodObject<{
27
+ status: z.ZodLiteral<"enabled">;
28
+ token: z.ZodString;
29
+ function_ids: z.ZodArray<z.ZodUnknown, "many">;
30
+ skip_logging: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
31
+ }, "strip", z.ZodTypeAny, {
32
+ status: "enabled";
33
+ token: string;
34
+ function_ids: unknown[];
35
+ skip_logging?: boolean | null | undefined;
36
+ }, {
37
+ status: "enabled";
38
+ token: string;
39
+ function_ids: unknown[];
40
+ skip_logging?: boolean | null | undefined;
41
+ }>, z.ZodObject<{
42
+ status: z.ZodLiteral<"disabled">;
43
+ }, "strip", z.ZodTypeAny, {
44
+ status: "disabled";
45
+ }, {
46
+ status: "disabled";
47
+ }>, z.ZodNull, z.ZodNull]>;
48
+ }, "strip", z.ZodTypeAny, {
49
+ kind: "state_override";
50
+ state: {
51
+ status: "enabled";
52
+ token: string;
53
+ function_ids: unknown[];
54
+ skip_logging?: boolean | null | undefined;
55
+ } | {
56
+ status: "disabled";
57
+ } | null;
58
+ }, {
59
+ kind: "state_override";
60
+ state: {
61
+ status: "enabled";
62
+ token: string;
63
+ function_ids: unknown[];
64
+ skip_logging?: boolean | null | undefined;
65
+ } | {
66
+ status: "disabled";
67
+ } | null;
68
+ }>, z.ZodObject<{
69
+ kind: z.ZodLiteral<"state_force_reselect">;
70
+ }, "strip", z.ZodTypeAny, {
71
+ kind: "state_force_reselect";
72
+ }, {
73
+ kind: "state_force_reselect";
74
+ }>, z.ZodObject<{
75
+ kind: z.ZodLiteral<"state_enabled_force_rescore">;
76
+ }, "strip", z.ZodTypeAny, {
77
+ kind: "state_enabled_force_rescore";
78
+ }, {
79
+ kind: "state_enabled_force_rescore";
80
+ }>]>;
81
+ type AsyncScoringControlType = z.infer<typeof AsyncScoringControl>;
82
+ declare const ObjectReference$1: z.ZodObject<{
83
+ object_type: z.ZodEnum<["project_logs", "experiment", "dataset", "prompt", "function", "prompt_session"]>;
84
+ object_id: z.ZodString;
85
+ id: z.ZodString;
86
+ _xact_id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
87
+ created: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
88
+ }, "strip", z.ZodTypeAny, {
89
+ id: string;
90
+ object_type: "function" | "experiment" | "dataset" | "prompt" | "prompt_session" | "project_logs";
91
+ object_id: string;
92
+ created?: string | null | undefined;
93
+ _xact_id?: string | null | undefined;
94
+ }, {
95
+ id: string;
96
+ object_type: "function" | "experiment" | "dataset" | "prompt" | "prompt_session" | "project_logs";
97
+ object_id: string;
98
+ created?: string | null | undefined;
99
+ _xact_id?: string | null | undefined;
100
+ }>;
101
+
102
+ type IdField = {
103
+ id: string;
104
+ };
105
+ type InputField = {
106
+ input: unknown;
107
+ };
108
+ type OtherExperimentLogFields = {
109
+ output: unknown;
110
+ expected: unknown;
111
+ error: unknown;
112
+ tags: string[];
113
+ scores: Record<string, number | null>;
114
+ metadata: Record<string, unknown>;
115
+ metrics: Record<string, unknown>;
116
+ datasetRecordId: string;
117
+ origin: z.infer<typeof ObjectReference$1>;
118
+ span_attributes: Record<string, unknown>;
119
+ [ASYNC_SCORING_CONTROL_FIELD]: AsyncScoringControlType;
120
+ [MERGE_PATHS_FIELD]: string[][];
121
+ [SKIP_ASYNC_SCORING_FIELD]: boolean;
122
+ };
123
+ type ExperimentLogPartialArgs = Partial<OtherExperimentLogFields> & Partial<InputField>;
124
+ type ExperimentLogFullArgs = Partial<Omit<OtherExperimentLogFields, "output" | "scores">> & Required<Pick<OtherExperimentLogFields, "output" | "scores">> & Partial<InputField> & Partial<IdField>;
125
+ type LogFeedbackFullArgs = IdField & Partial<Omit<OtherExperimentLogFields, "output" | "metrics" | "datasetRecordId"> & {
126
+ comment: string;
127
+ source: Source;
128
+ }>;
129
+ interface ParentExperimentIds {
130
+ experiment_id: string;
131
+ }
132
+ interface ParentProjectLogIds {
133
+ project_id: string;
134
+ log_id: "g";
135
+ }
136
+ interface ParentPlaygroundLogIds {
137
+ prompt_session_id: string;
138
+ log_id: "x";
139
+ }
140
+ type LogCommentFullArgs = IdField & {
141
+ created: string;
142
+ origin: {
143
+ id: string;
144
+ };
145
+ comment: {
146
+ text: string;
147
+ };
148
+ [AUDIT_SOURCE_FIELD]: Source;
149
+ [AUDIT_METADATA_FIELD]?: Record<string, unknown>;
150
+ } & (ParentExperimentIds | ParentProjectLogIds);
151
+ type ExperimentEvent = Partial<InputField> & Partial<OtherExperimentLogFields> & {
152
+ id: string;
153
+ span_id?: string;
154
+ root_span_id?: string;
155
+ experiment_id: string;
156
+ [IS_MERGE_FIELD]: boolean;
157
+ } & Partial<{
158
+ created: string;
159
+ span_parents: string[];
160
+ span_attributes: Record<string, unknown>;
161
+ context: Record<string, unknown>;
162
+ [AUDIT_SOURCE_FIELD]: Source;
163
+ [AUDIT_METADATA_FIELD]?: Record<string, unknown>;
164
+ }>;
165
+ type DatasetEvent = {
166
+ input?: unknown;
167
+ tags?: string[];
168
+ metadata?: unknown;
169
+ created?: string;
170
+ id: string;
171
+ dataset_id: string;
172
+ } & ({
173
+ expected?: unknown;
174
+ } | {
175
+ output?: unknown;
176
+ });
177
+ type LoggingEvent = Omit<ExperimentEvent, "experiment_id"> & {
178
+ project_id: string;
179
+ log_id: "g";
180
+ };
181
+ type PlaygroundLogEvent = Omit<ExperimentEvent, "experiment_id"> & {
182
+ prompt_session_id: string;
183
+ log_id: "x";
184
+ };
185
+ type CommentEvent = IdField & {
186
+ created: string;
187
+ origin: {
188
+ id: string;
189
+ };
190
+ comment: {
191
+ text: string;
192
+ };
193
+ [AUDIT_SOURCE_FIELD]: Source;
194
+ [AUDIT_METADATA_FIELD]?: Record<string, unknown>;
195
+ } & (ParentExperimentIds | ParentProjectLogIds | ParentPlaygroundLogIds);
196
+ type BackgroundLogEvent = ExperimentEvent | DatasetEvent | LoggingEvent | PlaygroundLogEvent | CommentEvent;
197
+ declare const DEFAULT_IS_LEGACY_DATASET = false;
198
+ interface LegacyDatasetRecord {
199
+ id: string;
200
+ input: any;
201
+ output: any;
202
+ metadata: any;
203
+ }
204
+ interface NewDatasetRecord {
205
+ id: string;
206
+ input: any;
207
+ expected: any;
208
+ tags: any;
209
+ metadata: any;
210
+ }
211
+ type DatasetRecord<IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY_DATASET> = IsLegacyDataset extends true ? LegacyDatasetRecord : NewDatasetRecord;
212
+
213
+ declare enum SpanObjectTypeV3 {
214
+ EXPERIMENT = 1,
215
+ PROJECT_LOGS = 2,
216
+ PLAYGROUND_LOGS = 3
217
+ }
218
+ declare const spanComponentsV3Schema: z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
219
+ object_type: z.ZodNativeEnum<typeof SpanObjectTypeV3>;
220
+ propagated_event: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
221
+ }, "strip", z.ZodTypeAny, {
222
+ object_type: SpanObjectTypeV3;
223
+ propagated_event?: Record<string, unknown> | null | undefined;
224
+ }, {
225
+ object_type: SpanObjectTypeV3;
226
+ propagated_event?: Record<string, unknown> | null | undefined;
227
+ }>, z.ZodUnion<[z.ZodObject<{
228
+ object_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
229
+ compute_object_metadata_args: z.ZodOptional<z.ZodNull>;
230
+ }, "strip", z.ZodTypeAny, {
231
+ object_id?: string | null | undefined;
232
+ compute_object_metadata_args?: null | undefined;
233
+ }, {
234
+ object_id?: string | null | undefined;
235
+ compute_object_metadata_args?: null | undefined;
236
+ }>, z.ZodObject<{
237
+ object_id: z.ZodOptional<z.ZodNull>;
238
+ compute_object_metadata_args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
239
+ }, "strip", z.ZodTypeAny, {
240
+ compute_object_metadata_args: Record<string, unknown>;
241
+ object_id?: null | undefined;
242
+ }, {
243
+ compute_object_metadata_args: Record<string, unknown>;
244
+ object_id?: null | undefined;
245
+ }>]>>, z.ZodUnion<[z.ZodObject<{
246
+ row_id: z.ZodString;
247
+ span_id: z.ZodString;
248
+ root_span_id: z.ZodString;
249
+ }, "strip", z.ZodTypeAny, {
250
+ span_id: string;
251
+ root_span_id: string;
252
+ row_id: string;
253
+ }, {
254
+ span_id: string;
255
+ root_span_id: string;
256
+ row_id: string;
257
+ }>, z.ZodObject<{
258
+ row_id: z.ZodOptional<z.ZodNull>;
259
+ span_id: z.ZodOptional<z.ZodNull>;
260
+ root_span_id: z.ZodOptional<z.ZodNull>;
261
+ }, "strip", z.ZodTypeAny, {
262
+ span_id?: null | undefined;
263
+ root_span_id?: null | undefined;
264
+ row_id?: null | undefined;
265
+ }, {
266
+ span_id?: null | undefined;
267
+ root_span_id?: null | undefined;
268
+ row_id?: null | undefined;
269
+ }>]>>;
270
+ type SpanComponentsV3Data = z.infer<typeof spanComponentsV3Schema>;
271
+ declare class SpanComponentsV3 {
272
+ data: SpanComponentsV3Data;
273
+ constructor(data: SpanComponentsV3Data);
274
+ toStr(): string;
275
+ static fromStr(s: string): SpanComponentsV3;
276
+ objectIdFields(): ParentExperimentIds | ParentProjectLogIds | ParentPlaygroundLogIds;
277
+ export(): Promise<string>;
278
+ private static fromJsonObj;
279
+ }
280
+
281
+ interface Score {
282
+ name: string;
283
+ score: number | null;
284
+ metadata?: Record<string, unknown>;
285
+ /**
286
+ * @deprecated
287
+ */
288
+ error?: unknown;
289
+ }
290
+
291
+ declare const spanTypeAttributeValues: readonly ["llm", "score", "function", "eval", "task", "tool"];
292
+ type SpanType = (typeof spanTypeAttributeValues)[number];
4
293
 
5
294
  declare const AnyModelParams: z.ZodObject<{
6
295
  temperature: z.ZodOptional<z.ZodNumber>;
@@ -13994,6 +14283,8 @@ declare class LazyValue<T> {
13994
14283
  get hasSucceeded(): boolean;
13995
14284
  }
13996
14285
 
14286
+ /// <reference lib="dom" />
14287
+
13997
14288
  type SetCurrentArg = {
13998
14289
  setCurrent?: boolean;
13999
14290
  };
@@ -14167,31 +14458,32 @@ declare class NoopSpan implements Span$1 {
14167
14458
  setAttributes(_args: Omit<StartSpanArgs, "event">): void;
14168
14459
  startSpanWithParents(_spanId: string, _spanParents: string[], _args?: StartSpanArgs): Span$1;
14169
14460
  state(): BraintrustState;
14461
+ toString(): string;
14170
14462
  }
14171
14463
  declare const NOOP_SPAN: NoopSpan;
14172
14464
  declare const NOOP_SPAN_PERMALINK = "https://braintrust.dev/noop-span";
14173
14465
  declare global {
14174
14466
  var __inherited_braintrust_state: BraintrustState;
14175
14467
  }
14176
- declare const loginSchema: z.ZodObject<{
14177
- appUrl: z.ZodString;
14178
- appPublicUrl: z.ZodString;
14179
- orgName: z.ZodString;
14180
- apiUrl: z.ZodString;
14181
- proxyUrl: z.ZodString;
14182
- loginToken: z.ZodString;
14183
- orgId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
14184
- gitMetadataSettings: z.ZodOptional<z.ZodNullable<z.ZodObject<{
14185
- collect: z.ZodEnum<["all", "none", "some"]>;
14186
- fields: z.ZodOptional<z.ZodArray<z.ZodEnum<["commit", "branch", "tag", "dirty", "author_name", "author_email", "commit_message", "commit_time", "git_diff"]>, "many">>;
14187
- }, "strip", z.ZodTypeAny, {
14468
+ declare const loginSchema: z$1.ZodObject<{
14469
+ appUrl: z$1.ZodString;
14470
+ appPublicUrl: z$1.ZodString;
14471
+ orgName: z$1.ZodString;
14472
+ apiUrl: z$1.ZodString;
14473
+ proxyUrl: z$1.ZodString;
14474
+ loginToken: z$1.ZodString;
14475
+ orgId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
14476
+ gitMetadataSettings: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodObject<{
14477
+ collect: z$1.ZodEnum<["all", "none", "some"]>;
14478
+ fields: z$1.ZodOptional<z$1.ZodArray<z$1.ZodEnum<["commit", "branch", "tag", "dirty", "author_name", "author_email", "commit_message", "commit_time", "git_diff"]>, "many">>;
14479
+ }, "strip", z$1.ZodTypeAny, {
14188
14480
  collect: "some" | "none" | "all";
14189
14481
  fields?: ("dirty" | "commit" | "branch" | "tag" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
14190
14482
  }, {
14191
14483
  collect: "some" | "none" | "all";
14192
14484
  fields?: ("dirty" | "commit" | "branch" | "tag" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
14193
14485
  }>>>;
14194
- }, "strict", z.ZodTypeAny, {
14486
+ }, "strict", z$1.ZodTypeAny, {
14195
14487
  appUrl: string;
14196
14488
  appPublicUrl: string;
14197
14489
  orgName: string;
@@ -14216,7 +14508,7 @@ declare const loginSchema: z.ZodObject<{
14216
14508
  fields?: ("dirty" | "commit" | "branch" | "tag" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
14217
14509
  } | null | undefined;
14218
14510
  }>;
14219
- type SerializedBraintrustState = z.infer<typeof loginSchema>;
14511
+ type SerializedBraintrustState = z$1.infer<typeof loginSchema>;
14220
14512
  declare class BraintrustState {
14221
14513
  private loginParams;
14222
14514
  id: string;
@@ -14259,6 +14551,8 @@ declare class BraintrustState {
14259
14551
  loginReplaceApiConn(apiConn: HTTPConnection): void;
14260
14552
  disable(): void;
14261
14553
  enforceQueueSizeLimit(enforce: boolean): void;
14554
+ toJSON(): Record<string, any>;
14555
+ toString(): string;
14262
14556
  }
14263
14557
  declare function useTestBackgroundLogger(): TestBackgroundLogger;
14264
14558
  declare function clearTestBackgroundLogger(): void;
@@ -14295,6 +14589,7 @@ declare class HTTPConnection {
14295
14589
  post(path: string, params?: Record<string, unknown> | string, config?: RequestInit): Promise<Response>;
14296
14590
  get_json(object_type: string, args?: Record<string, string | string[] | undefined> | undefined, retries?: number): Promise<any>;
14297
14591
  post_json(object_type: string, args?: Record<string, unknown> | string | undefined): Promise<any>;
14592
+ toString(): string;
14298
14593
  }
14299
14594
  interface ObjectMetadata {
14300
14595
  id: string;
@@ -14449,19 +14744,19 @@ declare class ExternalAttachment extends BaseAttachment {
14449
14744
  debugInfo(): Record<string, unknown>;
14450
14745
  private initData;
14451
14746
  }
14452
- declare const attachmentMetadataSchema: z.ZodObject<{
14453
- downloadUrl: z.ZodString;
14454
- status: z.ZodObject<{
14455
- upload_status: z.ZodEnum<["uploading", "done", "error"]>;
14456
- error_message: z.ZodOptional<z.ZodString>;
14457
- }, "strip", z.ZodTypeAny, {
14747
+ declare const attachmentMetadataSchema: z$1.ZodObject<{
14748
+ downloadUrl: z$1.ZodString;
14749
+ status: z$1.ZodObject<{
14750
+ upload_status: z$1.ZodEnum<["uploading", "done", "error"]>;
14751
+ error_message: z$1.ZodOptional<z$1.ZodString>;
14752
+ }, "strip", z$1.ZodTypeAny, {
14458
14753
  upload_status: "uploading" | "done" | "error";
14459
14754
  error_message?: string | undefined;
14460
14755
  }, {
14461
14756
  upload_status: "uploading" | "done" | "error";
14462
14757
  error_message?: string | undefined;
14463
14758
  }>;
14464
- }, "strip", z.ZodTypeAny, {
14759
+ }, "strip", z$1.ZodTypeAny, {
14465
14760
  status: {
14466
14761
  upload_status: "uploading" | "done" | "error";
14467
14762
  error_message?: string | undefined;
@@ -14474,7 +14769,7 @@ declare const attachmentMetadataSchema: z.ZodObject<{
14474
14769
  };
14475
14770
  downloadUrl: string;
14476
14771
  }>;
14477
- type AttachmentMetadata = z.infer<typeof attachmentMetadataSchema>;
14772
+ type AttachmentMetadata = z$1.infer<typeof attachmentMetadataSchema>;
14478
14773
  /**
14479
14774
  * A readonly alternative to `Attachment`, which can be used for fetching
14480
14775
  * already-uploaded Attachments.
@@ -14963,8 +15258,11 @@ declare function currentLogger<IsAsyncFlush extends boolean>(options?: AsyncFlus
14963
15258
  declare function currentSpan(options?: OptionalStateArg): Span$1;
14964
15259
  /**
14965
15260
  * Mainly for internal use. Return the parent object for starting a span in a global context.
15261
+ * Applies precedence: current span > propagated parent string > experiment > logger.
14966
15262
  */
14967
- declare function getSpanParentObject<IsAsyncFlush extends boolean>(options?: AsyncFlushArg<IsAsyncFlush> & OptionalStateArg): Span$1 | Experiment | Logger<IsAsyncFlush>;
15263
+ declare function getSpanParentObject<IsAsyncFlush extends boolean>(options?: AsyncFlushArg<IsAsyncFlush> & OptionalStateArg & {
15264
+ parent?: string;
15265
+ }): SpanComponentsV3 | Span$1 | Experiment | Logger<IsAsyncFlush>;
14968
15266
  declare function logError(span: Span$1, error: unknown): void;
14969
15267
  /**
14970
15268
  * Toplevel function for starting a span. It checks the following (in precedence order):
@@ -15275,6 +15573,7 @@ declare class SpanImpl implements Span$1 {
15275
15573
  flush(): Promise<void>;
15276
15574
  close(args?: EndSpanArgs): number;
15277
15575
  state(): BraintrustState;
15576
+ toString(): string;
15278
15577
  }
15279
15578
  /**
15280
15579
  * A dataset is a collection of records, such as model inputs and expected outputs, which represent
@@ -20909,6 +21208,79 @@ declare function BraintrustMiddleware(config?: MiddlewareConfig): LanguageModelV
20909
21208
  */
20910
21209
  declare function wrapAISDKModel<T extends object>(model: T): T;
20911
21210
 
21211
+ interface AISDKMethods {
21212
+ wrapLanguageModel: (options: any) => any;
21213
+ generateText: (params: any) => Promise<any>;
21214
+ streamText: (params: any) => any;
21215
+ generateObject: (params: any) => Promise<any>;
21216
+ streamObject: (params: any) => any;
21217
+ }
21218
+ /**
21219
+ * Wraps Vercel AI SDK methods with Braintrust tracing. Returns wrapped versions
21220
+ * of generateText, streamText, generateObject, and streamObject that automatically
21221
+ * create spans and log inputs, outputs, and metrics.
21222
+ *
21223
+ * @param ai - The AI SDK namespace (e.g., import * as ai from "ai")
21224
+ * @returns Object with AI SDK methods with Braintrust tracing
21225
+ *
21226
+ * @example
21227
+ * ```typescript
21228
+ * import { wrapAISDK } from "braintrust";
21229
+ * import * as ai from "ai";
21230
+ *
21231
+ * const { generateText, streamText, generateObject, streamObject } = wrapAISDK(ai);
21232
+ *
21233
+ * const result = await generateText({
21234
+ * model: openai("gpt-4"),
21235
+ * prompt: "Hello world"
21236
+ * });
21237
+ * ```
21238
+ */
21239
+ declare function wrapAISDK<T extends AISDKMethods>(ai: T): {
21240
+ generateText: T["generateText"];
21241
+ streamText: T["streamText"];
21242
+ generateObject: T["generateObject"];
21243
+ streamObject: T["streamObject"];
21244
+ };
21245
+
21246
+ interface MastraAgentMethods {
21247
+ name?: string;
21248
+ tools?: Record<string, unknown> | unknown[];
21249
+ model?: any;
21250
+ __setTools(tools: Record<string, unknown> | unknown[]): void;
21251
+ generateVNext?: (params: any) => any;
21252
+ streamVNext?: (params: any) => any;
21253
+ }
21254
+ /**
21255
+ * Wraps a Mastra agent with Braintrust tracing. This function wraps the agent's
21256
+ * underlying language model with BraintrustMiddleware and traces all agent method calls.
21257
+ *
21258
+ * **Important**: This wrapper only supports AI SDK v5 methods such as `generateVNext` and `streamVNext`.
21259
+ *
21260
+ * @param agent - The Mastra agent to wrap
21261
+ * @param options - Optional configuration for the wrapper
21262
+ * @returns The wrapped agent with Braintrust tracing
21263
+ *
21264
+ * @example
21265
+ * ```typescript
21266
+ * import { wrapMastraAgent } from "braintrust";
21267
+ * import { Agent } from "@mastra/core/agent";
21268
+ * import { openai } from "@ai-sdk/openai";
21269
+ *
21270
+ * const agent = new Agent({
21271
+ * name: "Assistant",
21272
+ * model: openai("gpt-4"),
21273
+ * instructions: "You are a helpful assistant."
21274
+ * });
21275
+ *
21276
+ * const wrappedAgent = wrapMastraAgent(agent);
21277
+ * ```
21278
+ */
21279
+ declare function wrapMastraAgent<T extends MastraAgentMethods>(agent: T, options?: {
21280
+ name?: string;
21281
+ span_name?: string;
21282
+ }): T;
21283
+
20912
21284
  /**
20913
21285
  * Wrap an `Anthropic` object (created with `new Anthropic(...)`) to add tracing. If Braintrust is
20914
21286
  * not configured, nothing will be traced. If this is not an `Anthropic` object, this function is
@@ -21274,6 +21646,7 @@ declare const braintrust_createFinalValuePassThroughStream: typeof createFinalVa
21274
21646
  declare const braintrust_currentExperiment: typeof currentExperiment;
21275
21647
  declare const braintrust_currentLogger: typeof currentLogger;
21276
21648
  declare const braintrust_currentSpan: typeof currentSpan;
21649
+ declare const braintrust_deepCopyEvent: typeof deepCopyEvent;
21277
21650
  declare const braintrust_defaultErrorScoreHandler: typeof defaultErrorScoreHandler;
21278
21651
  declare const braintrust_deserializePlainStringAsJSON: typeof deserializePlainStringAsJSON;
21279
21652
  declare const braintrust_devNullWritableStream: typeof devNullWritableStream;
@@ -21316,13 +21689,15 @@ declare const braintrust_withDataset: typeof withDataset;
21316
21689
  declare const braintrust_withExperiment: typeof withExperiment;
21317
21690
  declare const braintrust_withLogger: typeof withLogger;
21318
21691
  declare const braintrust_withParent: typeof withParent;
21692
+ declare const braintrust_wrapAISDK: typeof wrapAISDK;
21319
21693
  declare const braintrust_wrapAISDKModel: typeof wrapAISDKModel;
21320
21694
  declare const braintrust_wrapAnthropic: typeof wrapAnthropic;
21695
+ declare const braintrust_wrapMastraAgent: typeof wrapMastraAgent;
21321
21696
  declare const braintrust_wrapOpenAI: typeof wrapOpenAI;
21322
21697
  declare const braintrust_wrapOpenAIv4: typeof wrapOpenAIv4;
21323
21698
  declare const braintrust_wrapTraced: typeof wrapTraced;
21324
21699
  declare namespace braintrust {
21325
- 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_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_wrapAISDKModel as wrapAISDKModel, braintrust_wrapAnthropic as wrapAnthropic, braintrust_wrapOpenAI as wrapOpenAI, braintrust_wrapOpenAIv4 as wrapOpenAIv4, braintrust_wrapTraced as wrapTraced };
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 };
21326
21701
  }
21327
21702
 
21328
21703
  type EvaluatorManifest = Record<string, EvaluatorDef<unknown, unknown, unknown, BaseMetadata>>;
@@ -28379,4 +28754,4 @@ type EvaluatorDefinitions = z.infer<typeof evaluatorDefinitionsSchema>;
28379
28754
  * @module braintrust
28380
28755
  */
28381
28756
 
28382
- 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 CompiledPrompt, type CompiledPromptParams, type CompletionPrompt, type CreateProjectOpts, type DataSummary, Dataset, 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 ExperimentSummary, type Exportable, ExternalAttachment, type ExternalAttachmentParams, FailedHTTPResponse, type FullInitOptions, type FullLoginOptions, type FunctionEvent, INTERNAL_BTQL_LIMIT, type InitOptions, type InvokeFunctionArgs, type InvokeReturn, LEGACY_CACHED_HEADER, LazyValue, type LogOptions, Logger, type LoginOptions, type MetricSummary, NOOP_SPAN, NOOP_SPAN_PERMALINK, NoopSpan, type ObjectMetadata, 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, 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, wrapAISDKModel, wrapAnthropic, wrapOpenAI, wrapOpenAIv4, wrapTraced };
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 };