Skip to content
Open

v4 #2406

Show file tree
Hide file tree
Changes from all commits
Commits
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
  •  
  •  
  •  
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
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-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
16 changes: 2 additions & 14 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,10 @@ 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"
echo "Copied js/dist and js/util/dist to baseline"

git checkout "$CURRENT_REF"

Expand Down Expand Up @@ -473,17 +472,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
15 changes: 15 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
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,17 @@ Eval("Say Hi Bot", {
Run it:

```bash
BRAINTRUST_API_KEY=<YOUR_API_KEY> npx braintrust eval tutorial.eval.ts
BRAINTRUST_API_KEY=<YOUR_API_KEY> npx 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, 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/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`

Expand Down
4 changes: 2 additions & 2 deletions e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Wrapper scenarios often create a root span with `testRunId` metadata and then le
- Find the scenario root span first.
- Scope raw payload snapshots by `root_span_id` using `payloadRowsForRootSpan(...)`.
- Prefer normalized span-tree snapshots from `matchSpanTreeSnapshot(...)`. The `.json` sibling is the structural contract, and the `.txt` sibling is the ASCII tree for review; both are asserted and should be updated together.
- If the wrapper has an explicit support matrix, reuse one shared test across version-specific scenario entries instead of duplicating the assertions. The AI SDK wrapper scenario uses this for supported v3-v6 package combinations.
- If the wrapper has an explicit support matrix, reuse one shared test across version-specific scenario entries instead of duplicating the assertions. The AI SDK wrapper scenario uses this for its supported package combinations.

### Runner-wrapper scenario pattern

Expand Down Expand Up @@ -188,7 +188,7 @@ After any successful record run, stale cassette variants are cleaned only inside

These scenarios have cassette wiring in place and will use cassettes once they're recorded:

`anthropic-bedrock-instrumentation`, `anthropic-instrumentation`, `openai-instrumentation`, `openai-codex-instrumentation`, `ai-sdk-instrumentation`, `ai-sdk-otel-export`, `claude-agent-sdk-instrumentation`, `cohere-instrumentation`, `cursor-sdk-instrumentation`, `github-copilot-instrumentation`, `google-adk-instrumentation`, `google-genai-instrumentation`, `groq-instrumentation`, `huggingface-instrumentation`, `mistral-instrumentation`, `ollama-instrumentation`, `openrouter-agent-instrumentation`, `openrouter-instrumentation`, `wrap-langchain-js-traces`.
`anthropic-bedrock-instrumentation`, `anthropic-instrumentation`, `openai-instrumentation`, `openai-codex-instrumentation`, `ai-sdk-instrumentation`, `ai-sdk-otel-export`, `claude-agent-sdk-instrumentation`, `cohere-instrumentation`, `cursor-sdk-instrumentation`, `github-copilot-instrumentation`, `google-adk-instrumentation`, `google-genai-instrumentation`, `groq-instrumentation`, `huggingface-instrumentation`, `mistral-instrumentation`, `ollama-instrumentation`, `openrouter-agent-instrumentation`, `openrouter-instrumentation`.

### Cassette format

Expand Down
35 changes: 1 addition & 34 deletions e2e/config/pr-comment-scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -531,14 +531,6 @@
"label": "AI SDK Instrumentation",
"metadataScenario": "ai-sdk-instrumentation",
"variants": [
{
"variantKey": "ai-sdk-v3",
"label": "v3 pinned"
},
{
"variantKey": "ai-sdk-v3-latest",
"label": "v3 latest"
},
{
"variantKey": "ai-sdk-v4",
"label": "v4 pinned"
Expand Down Expand Up @@ -623,14 +615,6 @@
"label": "Flue Instrumentation",
"metadataScenario": "flue-instrumentation",
"variants": [
{
"variantKey": "flue-v0-8-0",
"label": "v0.8 pinned"
},
{
"variantKey": "flue-v0-8-latest",
"label": "v0.8 latest"
},
{
"variantKey": "flue-v1-0-0-beta-3",
"label": "v1 pinned"
Expand All @@ -654,9 +638,7 @@
"label": "Eve Instrumentation",
"metadataScenario": "eve-instrumentation",
"variants": [
{ "variantKey": "eve-v0", "label": "v0 pinned" },
{ "variantKey": "eve-v0-provider", "label": "v0 provider minimum" },
{ "variantKey": "eve-v0-latest-pinned", "label": "v0 latest pinned" },
{ "variantKey": "eve-v0", "label": "v0.34 pinned" },
{ "variantKey": "eve-v0-latest", "label": "v0 latest" }
]
},
Expand Down Expand Up @@ -762,20 +744,5 @@
"variantKey": "vitest-evals-reporter"
}
]
},
{
"scenarioDirName": "wrap-langchain-js-traces",
"label": "LangChain JS Wrapper Traces",
"metadataScenario": "wrap-langchain-js-traces",
"variants": [
{
"variantKey": "wrap-langchain-js-traces-v1",
"label": "v1 pinned"
},
{
"variantKey": "wrap-langchain-js-traces-v1-latest",
"label": "v1 latest"
}
]
}
]
1 change: 0 additions & 1 deletion e2e/helpers/prod-forwarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export async function initializeProdForwarding(): Promise<void> {
const logger = initLogger({
apiKey,
appUrl: process.env.BRAINTRUST_APP_URL,
asyncFlush: false,
forceLogin: true,
projectName,
});
Expand Down
2 changes: 1 addition & 1 deletion e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"test:e2e:record": "node ./scripts/run-record-tests.mjs"
},
"devDependencies": {
"@braintrust/browser": "workspace:^",
"@braintrust/deepseek-harness": "workspace:^",
"@braintrust/langchain-js": "workspace:^",
"@braintrust/otel": "workspace:^",
"@braintrust/seinfeld": "workspace:^",
"@opentelemetry/api": ">=1.9.0",
Expand Down
Loading