@mastra/braintrust 1.3.10-alpha.0 → 1.3.10-alpha.2

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.
Files changed (2) hide show
  1. package/README.md +12 -78
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @mastra/braintrust
2
2
 
3
- Braintrust AI Observability exporter for Mastra applications.
3
+ Export Mastra traces to Braintrust for LLM evaluation and monitoring with zero-config environment variables or explicit project configuration.
4
4
 
5
5
  ## Installation
6
6
 
@@ -10,97 +10,31 @@ npm install @mastra/braintrust
10
10
 
11
11
  ## Usage
12
12
 
13
- ### Zero-Config Setup
14
-
15
- The exporter automatically reads credentials from environment variables:
16
-
17
- ```bash
18
- # Required
19
- BRAINTRUST_API_KEY=sk-...
20
-
21
- # Optional
22
- BRAINTRUST_ENDPOINT=https://api.braintrust.dev
23
- ```
24
-
25
13
  ```typescript
14
+ import { Mastra } from '@mastra/core/mastra';
15
+ import { Observability } from '@mastra/observability';
26
16
  import { BraintrustExporter } from '@mastra/braintrust';
27
17
 
28
- const mastra = new Mastra({
29
- ...,
30
- observability: {
18
+ export const mastra = new Mastra({
19
+ observability: new Observability({
31
20
  configs: {
32
21
  braintrust: {
33
22
  serviceName: 'my-service',
34
23
  exporters: [new BraintrustExporter()],
35
24
  },
36
25
  },
37
- },
38
- });
39
- ```
40
-
41
- ### Explicit Configuration
42
-
43
- You can also pass credentials directly:
44
-
45
- ```typescript
46
- import { BraintrustExporter } from '@mastra/braintrust';
47
-
48
- const mastra = new Mastra({
49
- ...,
50
- observability: {
51
- configs: {
52
- braintrust: {
53
- serviceName: 'my-service',
54
- exporters: [
55
- new BraintrustExporter({
56
- apiKey: 'sk-...',
57
- projectName: 'mastra-tracing', // Optional, defaults to 'mastra-tracing'
58
- endpoint: 'https://api.braintrust.dev', // Optional
59
- }),
60
- ],
61
- },
62
- },
63
- },
26
+ }),
64
27
  });
65
28
  ```
66
29
 
67
- ### Configuration Options
68
-
69
- | Option | Type | Description |
70
- | ------------------ | ----------------------------------- | -------------------------------------------------------------- |
71
- | `apiKey` | `string` | Braintrust API key. Defaults to `BRAINTRUST_API_KEY` env var |
72
- | `endpoint` | `string` | Custom endpoint URL. Defaults to `BRAINTRUST_ENDPOINT` env var |
73
- | `projectName` | `string` | Project name. Defaults to `'mastra-tracing'` |
74
- | `braintrustLogger` | `BraintrustLogger` | Optional compatible Braintrust logger for context integration |
75
- | `currentSpan` | `() => BraintrustSpan \| undefined` | Optional resolver from the app's Braintrust package instance |
76
- | `tuningParameters` | `Record<string,any>` | Support tuning parameters |
77
-
78
- ## Features
30
+ ## Documentation
79
31
 
80
- ### Tracing
32
+ - [Braintrust](https://mastra.ai/integrations/observability/braintrust)
81
33
 
82
- - **Automatic span mapping**: Root spans become Braintrust traces
83
- - **Type-specific metadata**: Extracts relevant metadata for each span type (agents, tools, workflows)
84
- - **Error tracking**: Automatic error status and message tracking
85
- - **Hierarchical traces**: Maintains parent-child relationships
86
- - **Event span support**: Zero-duration spans for event-type traces
87
- - **Context integration**: Attach to existing Braintrust spans from `logger.traced()` or `Eval()`
34
+ ## Changelog
88
35
 
89
- ### Braintrust eval context
36
+ See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/observability/braintrust/CHANGELOG.md) for version history and release notes.
90
37
 
91
- When using Braintrust `Eval()` or `logger.traced()`, pass the `currentSpan` function from the same `braintrust` import that creates the eval or traced span. This lets Mastra attach traces to the active Braintrust span even when the app and `@mastra/braintrust` resolve different installed copies of the Braintrust SDK.
38
+ ## Support
92
39
 
93
- ```typescript
94
- import { currentSpan, initLogger } from 'braintrust';
95
- import { BraintrustExporter } from '@mastra/braintrust';
96
-
97
- const logger = initLogger({
98
- projectName: 'my-project',
99
- apiKey: process.env.BRAINTRUST_API_KEY,
100
- });
101
-
102
- const exporter = new BraintrustExporter({
103
- braintrustLogger: logger,
104
- currentSpan,
105
- });
106
- ```
40
+ We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/braintrust",
3
- "version": "1.3.10-alpha.0",
3
+ "version": "1.3.10-alpha.2",
4
4
  "description": "Braintrust observability provider for Mastra - includes tracing and future observability features",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -24,7 +24,7 @@
24
24
  "license": "Apache-2.0",
25
25
  "dependencies": {
26
26
  "braintrust": "^3.24.0",
27
- "@mastra/observability": "1.17.5-alpha.0"
27
+ "@mastra/observability": "1.17.5-alpha.2"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "22.20.1",
@@ -35,9 +35,9 @@
35
35
  "typescript": "^7.0.2",
36
36
  "vitest": "4.1.10",
37
37
  "@internal/types-builder": "0.0.104",
38
- "@mastra/core": "1.64.0-alpha.2",
39
- "@internal/lint": "0.0.129",
40
- "@observability/test-utils": "0.1.0"
38
+ "@mastra/core": "1.64.0-alpha.8",
39
+ "@observability/test-utils": "0.1.0",
40
+ "@internal/lint": "0.0.129"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@mastra/core": ">=1.16.0-0 <2.0.0-0",