{"id":3423,"library":"braintrust-core","title":"Braintrust Core","description":"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.","status":"active","version":"0.0.59","language":"en","source_language":"en","source_url":"https://github.com/braintrustdata/braintrust-sdk-python","tags":["AI observability","LLM evaluation","tracing","internal dependency"],"install":[{"cmd":"pip install braintrust-core","lang":"bash","label":"Install Braintrust Core"}],"dependencies":[{"reason":"Required for package operation","package":"python","optional":false}],"imports":[{"note":"For core Braintrust evaluation functionality, import from the main `braintrust` package, not `braintrust-core`.","symbol":"Eval","correct":"from braintrust import Eval"},{"note":"For initializing Braintrust logging and experiments, import from the main `braintrust` package.","symbol":"init","correct":"from braintrust import init"}],"quickstart":{"code":"import os\nfrom autoevals import LevenshteinScorer\nfrom braintrust import Eval\n\n# Set your Braintrust API key from environment variables\n# BRAINTRUST_API_KEY='sk-...' (Replace with your actual key or set in environment)\napi_key = os.environ.get('BRAINTRUST_API_KEY', 'YOUR_API_KEY_HERE')\n\n# Define an evaluation\neval_run = Eval(\n    \"Say Hi Bot\",\n    data=lambda: [\n        {\"input\": \"Foo\", \"expected\": \"Hi Foo\"},\n        {\"input\": \"Bar\", \"expected\": \"Hello Bar\"},\n    ],\n    task=lambda input: \"Hi \" + input,\n    scores=[LevenshteinScorer],\n    api_key=api_key # Pass API key here or ensure BRAINTRUST_API_KEY env var is set\n)\n\n# Run the evaluation\n# To run this, you would typically execute it via the Braintrust CLI:\n# BRAINTRUST_API_KEY=YOUR_API_KEY braintrust eval your_script_name.py\n# Or, to run directly in Python, if your API key is configured:\n# result = eval_run.run() \n# print(result)\n\nprint(\"To run this evaluation, set BRAINTRUST_API_KEY and use the Braintrust CLI: braintrust eval <your_script.py>\")","lang":"python","description":"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`."},"warnings":[{"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.","message":"The `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`).","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"Functionality 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`.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"Direct 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.","severity":"deprecated","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}