Skip to main content

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

Run a simple evaluation:

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],
)

Then run:

BRAINTRUST_API_KEY=<YOUR_API_KEY> braintrust eval tutorial_eval.py

Optional Extras

Install extras as needed for specific workflows:

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

Available extras:

  • 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

Documentation

License

Apache-2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

braintrust-0.33.0.tar.gz (782.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

braintrust-0.33.0-py3-none-any.whl (911.3 kB view details)

Uploaded Python 3

File details

Details for the file braintrust-0.33.0.tar.gz.

File metadata

  • Download URL: braintrust-0.33.0.tar.gz
  • Upload date:
  • Size: 782.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for braintrust-0.33.0.tar.gz
Algorithm Hash digest
SHA256 df8c2deeb5f943dbeb07dd69792444bda0d423f68045c1160e653989b0669f5c
MD5 de58e385207f15d33437168cd54ea4f5
BLAKE2b-256 5123838574fbb77fea47e9cb961a16ed907535dfb68104b3439d9fe7cd62c52a

See more details on using hashes here.

Provenance

The following attestation bundles were made for braintrust-0.33.0.tar.gz:

Publisher: publish-py-sdk.yaml on braintrustdata/braintrust-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file braintrust-0.33.0-py3-none-any.whl.

File metadata

  • Download URL: braintrust-0.33.0-py3-none-any.whl
  • Upload date:
  • Size: 911.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for braintrust-0.33.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c855154cdbec6ba2a91ac38f88ce06a9f6d6879442bda7284b4d648a6485c21c
MD5 a10be37e854464f94427cf477327a3f1
BLAKE2b-256 36060e88b372ce2c746b5e6c1a42a5d15e809cb793c54a5e1333552aaa78f159

See more details on using hashes here.

Provenance

The following attestation bundles were made for braintrust-0.33.0-py3-none-any.whl:

Publisher: publish-py-sdk.yaml on braintrustdata/braintrust-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page