Skip to content
Open

v4 #2406

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f41cad9
ref(v4)!: Remove flue pre-v1 support (#2380)
lforst Aug 19, 2026
5aa890d
feat(v4)!: Add Node Engine to package json (#2378)
lforst Aug 19, 2026
ded0424
ref(v4)!: Remove JS Braintrust CLI (#2377)
lforst Aug 19, 2026
ac1fde4
ref(eve)!: Bump minimum eve version to `0.34.0` (#2385)
lforst Aug 20, 2026
4cd71d1
ref!: Remove Zod derived types from public SDK declarations (#2404)
lforst Aug 26, 2026
55dd6c9
ref!: Remove plugins as part of public API (#2386)
lforst Aug 26, 2026
34bff9d
ref!: Remove `flushAsync` option (#2409)
lforst Aug 31, 2026
51bef8c
ref!: Reduce API to a minimum that makes sense (#2429)
lforst Sep 4, 2026
af89d9f
Merge main into v4
codex Sep 7, 2026
c4d0533
ref(ai-sdk)!: Remove AI SDK v3 support (#2474)
lforst Sep 14, 2026
5ed64b2
chore!: Remove deprecated packages (langchain, openai agents, ai sdk)…
lforst Sep 14, 2026
d3daacd
ref!: Simplify Eval type definitions (#2516)
lforst Sep 23, 2026
9dc5212
ref!: Don't make generated types part of public api (#2517)
lforst Sep 24, 2026
5b037de
ref!: Remove packaged `bt` binary from `braintrust` package (#2520)
lforst Sep 24, 2026
10a52b7
Merge main into v4
lforst Oct 12, 2026
7c2b0ac
Merge pull request #2608 from braintrustdata/lforst/merge-main-into-v4
lforst Oct 13, 2026
fb38418
feat!: Add `BRAINTRUST_CAPTURE_ATTACHMENTS` env var option and `captu…
lforst Oct 14, 2026
8037b72
build(sdk)!: Migrate to Vite+ and tree-shakeable ESM (#2626)
lforst Oct 16, 2026
c5bb877
fix(instrumentation): Initialize tracing automatically in bundles (#2…
lforst Oct 16, 2026
eca72fa
refactor(sdk)!: Rename automatic attachment capture options (#2636)
lforst Oct 19, 2026
c9a54f9
Merge origin/main into v4
lforst Oct 27, 2026
f01391c
chore: remove unused exports left by v4 merge
lforst Oct 27, 2026
4950cdb
Merge latest main into v4 (#2680)
lforst Oct 27, 2026
5b8b374
Merge main into v4
lforst Oct 29, 2026
0d21cc3
fix(ci): align audio tests with v4 Node versions
lforst Oct 29, 2026
dce8614
Merge main into v4 (#2694)
lforst Oct 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .agents/skills/instrumentation/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Map the change before editing:
- Pass `Error` objects directly as `span.log({ error })` values. The SDK serializes errors correctly, so do not add local helpers that manually turn errors into message/stack strings unless an external API requires a non-`Error` representation.
- Log only the useful surface. Prefer narrow, stable payloads over dumping full request/response objects; exclude redundant or overly large data when possible.
- Automatic capture of inline multimodal bytes as Braintrust attachments must be opt-in.
Guard attachment creation and binary observation with `BRAINTRUST_CAPTURE_ATTACHMENTS`, and enable them only when its value is `1` or `true`.
Guard attachment creation and binary observation with `BRAINTRUST_AUTO_CAPTURE_ATTACHMENTS`, and enable them only when its value is `1` or `true`.
Audio/video recordings may contain personal data and are separately controlled with their own explicit flags (`BRAINTRUST_CAPTURE_USER_AUDIO_ATTACHMENTS`, `BRAINTRUST_CAPTURE_AGENT_AUDIO_ATTACHMENTS`): enabling the shared flag for other media never records audio/video without these being enabled.
Preserve useful text, metadata, metrics, and remote references when attachment capture is disabled, and omit inline bytes from logged payloads.
- Segmentable streaming media must use the shared `configureInstrumentation({ streamingAttachmentBufferBytes })` setting instead of provider-specific chunk-size or time-based controls.
Expand Down
5 changes: 5 additions & 0 deletions .changeset/add-node-engine.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"braintrust": major
---

feat(v4)!: Add Node Engine to package json
10 changes: 10 additions & 0 deletions .changeset/breezy-lines-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@braintrust/browser": major
"@braintrust/deepseek-harness": major
"@braintrust/otel": major
"@braintrust/templates-nunjucks-js": major
"@braintrust/temporal": major
"braintrust": major
---

build(sdk)!: Migrate to Vite+ and tree-shakeable ESM
5 changes: 5 additions & 0 deletions .changeset/chilly-ends-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"braintrust": patch
---

fix(instrumentation): Initialize tracing automatically in bundles
6 changes: 6 additions & 0 deletions .changeset/light-plants-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@braintrust/deepseek-harness": major
"braintrust": major
---

feat!: Add `BRAINTRUST_CAPTURE_ATTACHMENTS` env var option and `captureAttachments` logger option for all integrations
8 changes: 8 additions & 0 deletions .changeset/reduce-api-to-a-minimum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"braintrust": major
"@braintrust/otel": major
"@braintrust/browser": patch
"@braintrust/temporal": patch
---

ref!: Reduce API to a minimum that makes sense
5 changes: 5 additions & 0 deletions .changeset/remove-ai-sdk-v3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"braintrust": major
---

ref(ai-sdk)!: Remove AI SDK v3 support
5 changes: 5 additions & 0 deletions .changeset/remove-eve-pre-034.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"braintrust": major
---

ref(eve)!: Bump minimum eve version to `0.34.0`
5 changes: 5 additions & 0 deletions .changeset/remove-flue-pre-v1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"braintrust": major
---

ref(v4)!: Remove flue pre-v1 support
5 changes: 5 additions & 0 deletions .changeset/remove-flush-async.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"braintrust": major
---

ref!: Remove `flushAsync` option
5 changes: 5 additions & 0 deletions .changeset/remove-js-braintrust-cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"braintrust": major
---

ref(v4)!: Remove JS Braintrust CLI
5 changes: 5 additions & 0 deletions .changeset/remove-packaged-bt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"braintrust": major
---

ref!: Remove packaged `bt` binary from `braintrust` package
5 changes: 5 additions & 0 deletions .changeset/remove-plugins-public-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"braintrust": major
---

ref!: Remove plugins as part of public API
5 changes: 5 additions & 0 deletions .changeset/remove-zod-derived-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"braintrust": major
---

ref!: Remove Zod derived types from public SDK declarations
6 changes: 6 additions & 0 deletions .changeset/shy-parents-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"braintrust": major
"@braintrust/deepseek-harness": major
---

refactor(sdk)!: Rename automatic attachment capture options
5 changes: 5 additions & 0 deletions .changeset/simplify-eval-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"braintrust": major
---

ref!: Simplify Eval type definitions
5 changes: 5 additions & 0 deletions .changeset/simplify-public-sdk-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"braintrust": major
---

ref!: Don't make generated types part of public api
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ updates:
- "eslint"
- "@typescript-eslint/*"
- "prettier"
- "turbo"
- "typescript"
- "tsup"
- "tsx"
- "vitest"
- "vite"
- "vite-plus"
- "@voidzero-dev/*"
- "vite-tsconfig-paths"
- "rollup"
- "webpack"
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/npm-download-stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ async function main() {
method: "POST",
headers: {
"Content-Type": "application/json",
"DD-API-KEY": ddApiKey,
"DD-API-KEY": ddApiKey!,
},
body: JSON.stringify(payload),
});
Expand Down
49 changes: 14 additions & 35 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ jobs:
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint
run: pnpm run lint
- name: Static checks
run: pnpm run check

check-typings:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -88,9 +88,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-2025-vs2026]
node-version: [20, 22, 24, 26]
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: ${{ matrix.node-version == 20 && 'true' || '' }}
node-version: [22.18.0, 24, 26]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
Expand Down Expand Up @@ -226,9 +224,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [20]
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: "true"
node-version: [22.18.0]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand Down Expand Up @@ -267,11 +263,13 @@ jobs:
pnpm install --frozen-lockfile || { echo "Baseline install failed"; git checkout "$CURRENT_REF"; exit 0; }
pnpm run build || { echo "Baseline build failed"; git checkout "$CURRENT_REF"; exit 0; }

mkdir -p "$BASELINE_DIR/js/dev" "$BASELINE_DIR/js/util"
mkdir -p "$BASELINE_DIR/js/util"
cp -R js/dist "$BASELINE_DIR/js/"
cp -R js/dev/dist "$BASELINE_DIR/js/dev/"
cp -R js/util/dist "$BASELINE_DIR/js/util/"
echo "Copied js/dist, js/dev/dist, and js/util/dist to baseline"
cp js/package.json "$BASELINE_DIR/js/"
if [ -d js/util/dist ]; then
cp -R js/util/dist "$BASELINE_DIR/js/util/"
fi
echo "Copied package metadata and build outputs to baseline"

git checkout "$CURRENT_REF"

Expand Down Expand Up @@ -395,9 +393,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [20, 22, 24, 26]
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: ${{ matrix.node-version == 20 && 'true' || '' }}
node-version: [22.18.0, 24, 26]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
Expand All @@ -423,9 +419,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [20, 22, 24, 26]
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: ${{ matrix.node-version == 20 && 'true' || '' }}
node-version: [22.18.0, 24, 26]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
Expand All @@ -451,9 +445,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [20, 22, 24, 26]
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: ${{ matrix.node-version == 20 && 'true' || '' }}
node-version: [22.18.0, 24, 26]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
Expand All @@ -479,10 +471,8 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [20, 22, 24, 26]
node-version: [22.18.0, 24, 26]
test-dir: [otel-v1, otel-v2]
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: ${{ matrix.node-version == 20 && 'true' || '' }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Docker Buildx
Expand Down Expand Up @@ -532,17 +522,6 @@ jobs:
- name: Run hermetic tests
working-directory: ./js
run: pnpm run test:checks
- name: Run zod v3 tests
if: matrix.zod-version == '3.25.34'
working-directory: ./js
run: |
pnpm test:zod-v3
- name: Run zod v4 tests
if: matrix.zod-version == '4.2.1'
working-directory: ./js
run: |
pnpm test:zod-v4

checks-passed:
name: checks-passed
needs:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ tsconfig.tsbuildinfo
# Auto-generated by @sentry/dotagents — do not commit these files.
agents.lock
.agents/.gitignore

# Local bundle reports and before/after build artifacts.
.context/
.vite/
17 changes: 0 additions & 17 deletions .prettierignore

This file was deleted.

4 changes: 0 additions & 4 deletions .prettierrc

This file was deleted.

17 changes: 17 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@ mise install # Install toolchain and dependencies
pnpm run build # Build all workspace packages (from repo root)
```

## Public TypeScript APIs

Do not derive SDK-owned public TypeScript types from Zod schemas (for example,
with `z.infer`, `z.input`, `z.output`, or equivalent schema-derived aliases).
Define public API types explicitly with interfaces, type aliases, or generated
plain types. Generic APIs may still infer types from caller-provided schemas.
When exporting a runtime validator, give it a compact public type such as
`z.ZodType<PublicType>` and test that the validator and public type stay in sync.

Zod-derived public declarations can expand into large schema implementation
graphs. Those declarations are expensive for downstream TypeScript consumers to
parse, instantiate, and type-check, increasing compile time, declaration size,
and memory usage. They also expose validation-library implementation details as
part of the SDK's API surface.

## Public API

Keep public exports minimal. Generally, export only the requested runtime APIs and do not export types unless explicitly requested.
Expand Down Expand Up @@ -55,6 +70,8 @@ Span names should generally remain stable across calls and versions. Do not incl

Uses Vitest. Prefer running the **narrowest relevant test** rather than the full suite.

Generally, do not add tests for build or linting code or their configuration. Validate tooling changes by running the relevant build or lint commands instead.

**From `js/` directory:**

```bash
Expand Down
22 changes: 10 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,25 @@ Eval("Say Hi Bot", {
});
```

Run it:
Install the `bt` CLI separately using the standalone installation instructions in the [CLI quickstart](https://www.braintrust.dev/docs/reference/cli/quickstart), then run it:

```bash
BRAINTRUST_API_KEY=<YOUR_API_KEY> npx braintrust eval tutorial.eval.ts
BRAINTRUST_API_KEY=<YOUR_API_KEY> bt eval tutorial.eval.ts
```

## Packages

| Package | Purpose | npm | Docs |
| --------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------- |
| `braintrust` | Core JavaScript/TypeScript SDK for logging, tracing, evals, and CLI. | [![npm: braintrust](https://img.shields.io/npm/v/braintrust.svg)](https://www.npmjs.com/package/braintrust) | [js/README.md](js/README.md) |
| `@braintrust/browser` | Browser-focused SDK integration with AsyncLocalStorage polyfill support. | [![npm: @braintrust/browser](https://img.shields.io/npm/v/%40braintrust%2Fbrowser.svg)](https://www.npmjs.com/package/@braintrust/browser) | [integrations/browser-js/README.md](integrations/browser-js/README.md) |
| `@braintrust/langchain-js` | Deprecated; use the LangChain integration in `braintrust` instead. | [![npm: @braintrust/langchain-js](https://img.shields.io/npm/v/%40braintrust%2Flangchain-js.svg)](https://www.npmjs.com/package/@braintrust/langchain-js) | [integrations/langchain-js/README.md](integrations/langchain-js/README.md) |
| `@braintrust/openai-agents` | Deprecated; use the OpenAI Agents integration in `braintrust` instead. | [![npm: @braintrust/openai-agents](https://img.shields.io/npm/v/%40braintrust%2Fopenai-agents.svg)](https://www.npmjs.com/package/@braintrust/openai-agents) | [integrations/openai-agents-js/README.md](integrations/openai-agents-js/README.md) |
| `@braintrust/otel` | OpenTelemetry span processor and compatibility helpers for Braintrust tracing. | [![npm: @braintrust/otel](https://img.shields.io/npm/v/%40braintrust%2Fotel.svg)](https://www.npmjs.com/package/@braintrust/otel) | [integrations/otel-js/README.md](integrations/otel-js/README.md) |
| `@braintrust/temporal` | Temporal client/worker plugin and workflow interceptors for Braintrust tracing. | [![npm: @braintrust/temporal](https://img.shields.io/npm/v/%40braintrust%2Ftemporal.svg)](https://www.npmjs.com/package/@braintrust/temporal) | [integrations/temporal-js/README.md](integrations/temporal-js/README.md) |
| Package | Purpose | npm | Docs |
| ---------------------- | ------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| `braintrust` | Core JavaScript/TypeScript SDK for logging, tracing, and evals. | [![npm: braintrust](https://img.shields.io/npm/v/braintrust.svg)](https://www.npmjs.com/package/braintrust) | [js/README.md](js/README.md) |
| `@braintrust/browser` | Browser-focused SDK integration with AsyncLocalStorage polyfill support. | [![npm: @braintrust/browser](https://img.shields.io/npm/v/%40braintrust%2Fbrowser.svg)](https://www.npmjs.com/package/@braintrust/browser) | [integrations/browser-js/README.md](integrations/browser-js/README.md) |
| `@braintrust/otel` | OpenTelemetry span processor and compatibility helpers for Braintrust tracing. | [![npm: @braintrust/otel](https://img.shields.io/npm/v/%40braintrust%2Fotel.svg)](https://www.npmjs.com/package/@braintrust/otel) | [integrations/otel-js/README.md](integrations/otel-js/README.md) |
| `@braintrust/temporal` | Temporal client/worker plugin and workflow interceptors for Braintrust tracing. | [![npm: @braintrust/temporal](https://img.shields.io/npm/v/%40braintrust%2Ftemporal.svg)](https://www.npmjs.com/package/@braintrust/temporal) | [integrations/temporal-js/README.md](integrations/temporal-js/README.md) |

## CLI `bt`

The `bt` cli is installed alongside `braintrust`, use it with `npx bt` or `pnpm exec bt`.
See the [documentation](https://www.braintrust.dev/docs/reference/cli/quickstart).
The `bt` CLI is installed separately from `braintrust`.
See the standalone installation instructions in the [CLI quickstart](https://www.braintrust.dev/docs/reference/cli/quickstart).

## Documentation

Expand Down
18 changes: 9 additions & 9 deletions dev-packages/seinfeld/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,33 @@
"type": "module",
"license": "MIT",
"engines": {
"node": ">=18"
"node": ">=22.18.0"
},
"main": "./dist/index.cjs",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
"default": "./dist/index.js"
}
},
"files": [
"dist"
],
"scripts": {
"build": "tsup",
"build": "vp run compile",
"check:typings": "tsc --noEmit",
"dev": "tsup --watch",
"dev": "vp pack --watch",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"zod": "^3.23.8"
},
"devDependencies": {
"@types/node": "^22.10.0",
"tsup": "^8.5.1",
"typescript": "^5.7.2"
}
"typescript": "^5.7.2",
"vite-plus": "catalog:"
},
"sideEffects": false
}
Loading
Loading