Braintrust Python SDK
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: installsorjsonfor faster JSON serializationcli: installs optional dependencies used by the Braintrust CLIopenai-agents: installs OpenAI Agents integration supportotel: installs OpenTelemetry integration dependenciestemporal: installs Temporal integration dependenciesall: installs all optional extras
Documentation
- Python SDK docs: https://www.braintrust.dev/docs/reference/sdks/python
- Braintrust docs: https://www.braintrust.dev/docs
- 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
Release files for braintrust 0.40.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| braintrust-0.40.0.tar.gz | 898.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| braintrust-0.40.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.0 MB
Release files / braintrust-0.40.0.tar.gz
| Download URL | braintrust-0.40.0.tar.gz |
|---|---|
| Size | 898.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
04713c481edb8e6f40034e3578973b9255c9cb080aa195d55fccb5c3ecb741be
|
|
BLAKE2b-256 checksum How to use checksums |
0b82a126cff7619b69ff7cfd050f8f36e129e89567aa758b3e3a992169be5426
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency logRelease files / braintrust-0.40.0-py3-none-any.whl
| Download URL | braintrust-0.40.0-py3-none-any.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d6f8d95de628c4ae20e44175ec0ca89578779f810f76a0aada94f4cdf924bd40
|
|
BLAKE2b-256 checksum How to use checksums |
7968809c489e72a44064f3089c991e614fed4f68645841369b6c068e1477961a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency log