Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

braintrust

FreeNo executable scriptsNot checked

Braintrust is a hosted platform for evaluating and tracing LLM applications: it runs a task over a dataset, scores the outputs, stores each run as an…

TerminalSkillsby TerminalSkills★ 221 GitHub stars

About this skill

Braintrust — AI Evaluation and Observability

Overview

Braintrust measures the quality of LLM applications. An evaluation has three parts — data (test cases with input and expected), a task (the function under test) and scores (functions that grade each output from 0 to 1). Every run is stored as an experiment that can be compared with earlier runs. The same SDK logs production traces, and the bt CLI runs eval files, queries logs and manages datasets from a terminal. The platform is a hosted service (free Starter plan, self-hosting on Enterprise); the SDKs (braintrust), the scorer library (autoevals) and the CLI are open source. Official SDKs also exist for Go, Ruby, Java and C#; this skill covers TypeScript and Python.

Instructions

Install

npm install braintrust autoevals@latest openai   # TypeScript SDK, scorers, provider client
npm install --save-dev @braintrust/bt tsx        # bt CLI plus a TypeScript runner
pip install braintrust autoevals openai          # Python 3.10+

Keep @latest on autoevals: 0.3.0 declares a pnpm-only engines field, so a bare npm install autoevals silently resolves to the older 0.0.132 (with @latest npm prints an EBADENGINE warning and installs 0.3.0). npx bt --version prints bt 0.22.1 or later. bt needs a runner for TypeScript files and picks the first it finds of tsx, vite-node, ts-node, deno; for Python it uses the active virtualenv.

Authenticate

Create a key under Settings > API keys in the Braintrust app and export it. The SDKs and bt read it automatically; nothing has to be passed in code.

export BRAINTRUST_API_KEY="..."         # from your secret manager, never committed
export OPENAI_API_KEY="..."             # only if the task or an LLM scorer calls OpenAI
npx bt status                           # shows the active org and project

For interactive use bt login stores a profile instead (bt login --oauth opens the browser).

Write and run an eval (TypeScript)

Name eval files *.eval.ts so bt eval discovers them. The first argument of Eval is the project name.

// evals/support-bot.eval.ts
import { Eval } from "braintrust";
import { Factuality, Levenshtein } from "autoevals";
import OpenAI from "openai";

const openai = new OpenAI();

async function answerQuestion(question: string): Promise<string> {
  const res = await openai.chat.completions.create({
    model: "gpt-5-mini",
    messages: [
      { role: "system", content: "You are the support assistant for Parcelwise, a shipping-label app." },
      { role: "user", content: question },
    ],
  });
  return res.choices[0].message.content ?? "";
}

// Custom scorer: receives one object, returns a number in [0, 1] or { name, score }
const mentionsPrice = ({ output, expected }: { output: string; expected?: string }) => ({
  name: "mentions_price",
  score: /\$\d+/.test(output) === /\$\d+/.test(expected ?? "") ? 1 : 0,
});

Eval("support-bot", {
  experimentName: "gpt-5-mini-baseline",
  data: () => [
    { input: "How do I reset my password?", expected: "Go to Settings > Security > Reset password" },
    { input: "What does the Team plan cost?", expected: "The Team plan is $49 per month" },
  ],
  task: answerQuestion,
  scores: [Factuality, Levenshtein, mentionsPrice],
  metadata: { model: "gpt-5-mini", prompt_version: "v2" },
  trialCount: 3,        // run each case 3 times and average
  maxConcurrency: 5,
});
npx bt eval evals/support-bot.eval.ts        # run one file, upload the experiment
npx bt eval evals/                           # every *.eval.ts (or eval_*.py) under evals/; one language per run
npx bt eval --watch evals/support-bot.eval.ts
npx bt eval --first 20 evals/                # smoke run on the first 20 cases, marked non-final
npx bt eval --no-send-logs evals/            # run locally, upload nothing
npx bt eval --list evals/                    # list evaluators without running them

bt does not load .env files by itself: export the variables or pass --env-file .env. For TypeScript files bt eval auto-instruments supported LLM clients, so each model call inside the task appears as a span in the experiment.

Write and run an eval (Python)

Name files eval_*.py. Custom scorers take input, output, expected as arguments.

# evals/eval_support_bot.py
from autoevals import Factuality, Levenshtein
from braintrust import Eval, Score
from openai import OpenAI

client = OpenAI()

def answer_question(question: str) -> str:
    res = client.chat.completions.create(
        model="gpt-5-mini",
        messages=[{"role": "user", "content": question}],
    )
    return res.choices[0].message.content or ""

def mentions_price(input, output, expected):
    return Score(name="mentions_price", score=1 if ("$" in output) == ("$" in expected) else 0)

Eval(
    "support-bot",
    experiment_name="gpt-5-mini-baseline",
    data=lambda: [
        {"input": "How
Full SKILL.md on GitHub

Install braintrust in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

_scores.json

FAQ

What does the braintrust skill do?

Braintrust is a hosted platform for evaluating and tracing LLM applications: it runs a task over a dataset, scores the outputs, stores each run as an experiment and logs production traces. Use when a user asks to write or run a Braintrust eval, score LLM outputs with autoevals, compare prompt or model versions as experiments, run evals in CI and fail on regressions, trace OpenAI or Anthropic calls with Braintrust, manage evaluation datasets, or use the bt CLI.

How do I install the braintrust skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the braintrust skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare braintrust with