🚀 Socket Launch Week Day 4:Socket MCP Adds Org Alerts, Threat Feed Review, and Package Inspection.Learn more
Sign In

@braintrust/browser

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@braintrust/browser

Braintrust SDK for browser environments with AsyncLocalStorage polyfill

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

Braintrust Browser SDK

npm version

Official browser-only SDK for Braintrust.

This is an integration package that provides browser-optimized builds of the Braintrust SDK with AsyncLocalStorage polyfill support for standard browsers.

This package supports limited functionality in the browser. There is a known CORS limitation when used outside the braintrust.dev domain. If you need this for your own domain, contact support@braintrust.dev.

Installation

npm install @braintrust/browser braintrust
# or
pnpm add @braintrust/browser braintrust
# or
yarn add @braintrust/browser braintrust

Note: Install both packages so your browser integration and main SDK stay on compatible versions.

Requirements

  • braintrust (installed alongside @braintrust/browser)
  • zod (^3.25.34 || ^4.0)

Quickstart

import * as braintrust from "@braintrust/browser";

const experiment = await braintrust.init("BrowserExperiment", {
  apiKey: "YOUR_API_KEY",
});

// Use tracing in browser
const result = await braintrust.traced(
  async () => {
    // Your code here
    return "result";
  },
  { name: "myOperation" },
);

Notes

Use @braintrust/browser when:

  • Building browser-only applications
  • Needing AsyncLocalStorage support in standard browsers

Use braintrust directly when:

  • Building Node.js applications
  • Using Next.js or other full-stack frameworks
  • Needing CLI tools or filesystem access

Browser-compatible features include:

  • Logging and tracing
  • Experiments and datasets
  • Prompt management
  • AI provider wrappers (OpenAI, Anthropic, Google)
  • Evaluation framework
  • OpenTelemetry integration

Documentation

For full documentation, visit https://www.braintrust.dev/docs

License

Apache-2.0

FAQs

Package last updated on 04 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts