GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — braintrust-sdk-python/py at main · braintrustdata/braintrust-sdk-python

Expand file tree

/

py

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

py

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
benchmarks
benchmarks
 
 
scripts
scripts
 
 
src/braintrust
src/braintrust
 
 
tests
tests
 
 
.envrc
.envrc
 
 
.gitignore
.gitignore
 
 
AGENTS.md
AGENTS.md
 
 
CLAUDE.md
CLAUDE.md
 
 
MANIFEST.in
MANIFEST.in
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
_build_hooks.py
_build_hooks.py
 
 
nox_session_constraints.py
nox_session_constraints.py
 
 
noxfile.py
noxfile.py
 
 
pyproject.toml
pyproject.toml
 
 
uv.lock
uv.lock
 
 

README.md

Outline

Braintrust Python SDK

PyPI version

The official Python SDK for logging, tracing, and evaluating AI applications with Braintrust.

Installation

Install the SDK:

pip install braintrust

Quickstart

Save this evaluation as eval_tutorial.py:

from braintrust import Eval


def is_equal(expected, output):
    return expected == output


Eval(
    "Say Hi Bot",
    data=lambda: [
        {"input": "Foo", "expected": "Hi Foo"},
        {"input": "Bar", "expected": "Hello Bar"},
    ],
    task=lambda input: "Hi " + input,
    scores=[is_equal],
)

Install the standalone bt CLI and run:

BRAINTRUST_API_KEY="YOUR_API_KEY" bt eval eval_tutorial.py

Optional Extras

Install extras as needed for specific workflows:

pip install "braintrust[audio]"
pip install "braintrust[cli]"
pip install "braintrust[openai-agents]"
pip install "braintrust[otel]"
pip install "braintrust[temporal]"
pip install "braintrust[all]"

Available extras:

  • audio: installs PyAV for Opus/Ogg session recording on Python 3.12+
  • performance: installs orjson for faster JSON serialization
  • cli: installs optional dependencies used by the Braintrust CLI
  • openai-agents: installs OpenAI Agents integration support
  • otel: installs OpenTelemetry integration dependencies
  • temporal: installs Temporal integration dependencies
  • all: installs all optional extras

The braintrust install commands for AWS CloudFormation are deprecated. Use the CloudFormation guide to manage existing stacks.

Audio encoding

braintrust[audio] requires Python 3.12+ and uses PyAV's bundled FFmpeg codecs. On Python 3.10–3.11, the extra does not install PyAV; use PCM/WAV recording. Each Opus/Ogg segment is an independent file with exact playable duration. Installing the extra does not enable capture; framework adapters still require their audio opt-ins and privacy permission. Without PyAV, default recording warns once and uses raw PCM. Explicit Opus configuration requires the extra. PCM/WAV need no native codecs.

Audio uploads use Attachment.upload() directly. Span customizers and masking apply to trace records published afterward; removing an attachment reference does not prevent or undo its upload.

Documentation

  • Python SDK docs: https://docs.braintrust.dev/sdks/python/versions/latest
  • Braintrust docs: https://docs.braintrust.dev
  • Repo publishing guide: https://github.com/braintrustdata/braintrust-sdk-python/blob/main/docs/publishing.md
  • Source code: https://github.com/braintrustdata/braintrust-sdk-python/tree/main/py

License

Apache-2.0

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.