Registry / llm-agents / braintrust-core

braintrust-core

JSON →
library0.0.59pypypi✓ verified 23d ago

Braintrust Core is a Python package that provides shared core dependencies for other packages within the Braintrust ecosystem. It is primarily an internal utility library, with user-facing functionality for logging, tracing, evaluations, and CLI workflows typically exposed through the main `braintrust` SDK. The current version is 0.0.59, and it generally follows the release cadence of the broader Braintrust Python SDKs.

pip install braintrust-core
INSTALL
IMPORT
SIG · BRAINTRUST-CORE
B
braintrust-core
llm-agentspythonv0.0.59
Install
1.5s avg
Import
46ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.0.59 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.050s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.042s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Eval
from braintrust_core import score
from braintrust_core import Eval

This quickstart demonstrates the usage of the main `braintrust` SDK for defining and running evaluations. `braintrust-core` is an internal dependency and not typically used directly in user quickstarts. Ensure you also install `autoevals` for scoring functions: `pip install braintrust autoevals`.

import os from autoevals import LevenshteinScorer from braintrust import Eval # Set your Braintrust API key from environment variables # BRAINTRUST_API_KEY='sk-...' (Replace with your actual key or set in environment) api_key = os.environ.get('BRAINTRUST_API_KEY', 'YOUR_API_KEY_HERE') # Define an evaluation eval_run = Eval( "Say Hi Bot", data=lambda: [ {"input": "Foo", "expected": "Hi Foo"}, {"input": "Bar", "expected": "Hello Bar"}, ], task=lambda input: "Hi " + input, scores=[LevenshteinScorer], api_key=api_key # Pass API key here or ensure BRAINTRUST_API_KEY env var is set ) # Run the evaluation # To run this, you would typically execute it via the Braintrust CLI: # BRAINTRUST_API_KEY=YOUR_API_KEY braintrust eval your_script_name.py # Or, to run directly in Python, if your API key is configured: # result = eval_run.run() # print(result) print("To run this evaluation, set BRAINTRUST_API_KEY and use the Braintrust CLI: braintrust eval <your_script.py>")
Debug
Known issues
gotchaThe `braintrust-core` package is primarily an internal dependency. For Braintrust functionality like logging, tracing, evaluations, or CLI interactions, users should typically install and use the main `braintrust` package (e.g., `pip install braintrust autoevals`).
fix
Use `pip install braintrust` and import from `braintrust` for Braintrust features. Only install `braintrust-core` if explicitly required as a dependency by another Braintrust package.
affects: All versions
gotchaFunctionality that might appear in a 'core' package can be subject to refactoring and consolidation into the main `braintrust` SDK. For instance, the `@braintrust/core` (TypeScript) package's functionality was explicitly folded into the main `braintrust` package. While this was for TypeScript, it indicates a pattern that Python users should be aware of regarding `braintrust-core`.
fix
Always refer to the official Braintrust Python SDK documentation for the latest recommended import paths and usage patterns, focusing on the `braintrust` package for user-facing APIs.
affects: All versions
deprecatedDirect imports or reliance on specific modules within `braintrust-core` are not officially supported APIs and may change or be removed without prior notice, as it's an internal utility package.
fix
Avoid directly importing from `braintrust-core`. If you find yourself needing functionality seemingly offered by `braintrust-core`, check the main `braintrust` SDK documentation first, as the desired feature is likely available there.
affects: All versions
Upgrade
Version history
0.0.59latest on PyPI · released May 12, 2025
Audit
Dependencies
pythonrequiredRequired for package operation
Agent activity
36 hits · last 30 days
node
32
OpenAI (training)
1
Resources
braintrust-core — pip install braintrust-core · libregistry