{"id":4459,"library":"braintrust-langchain","title":"braintrust-langchain","description":"This library provided LangChain integration for Braintrust, a platform for evaluating and managing LLMs. It is now deprecated as of version 0.3.0. The LangChain integration has been moved into the main `braintrust` package. Users should install and use `braintrust` instead, which is actively developed with frequent releases.","status":"deprecated","version":"0.3.0","language":"en","source_language":"en","source_url":"https://github.com/braintrustdata/braintrust-sdk-python","tags":["braintrust","langchain","llm","tracing","ai","deprecated"],"install":[{"cmd":"pip install braintrust","lang":"bash","label":"Install the replacement package"},{"cmd":"pip uninstall braintrust-langchain","lang":"bash","label":"Uninstall the deprecated package"}],"dependencies":[{"reason":"This is the successor package where LangChain integration now resides.","package":"braintrust","optional":false},{"reason":"Required for core LangChain functionalities when using the integration.","package":"langchain-core","optional":false},{"reason":"Example dependency for using OpenAI models with LangChain.","package":"langchain-openai","optional":true}],"imports":[{"note":"The global handler for LangChain is now part of the main `braintrust` package via `auto_instrument()`.","wrong":"from braintrust_langchain import set_global_handler","symbol":"auto_instrument","correct":"from braintrust import auto_instrument"},{"note":"The `BraintrustCallbackHandler` class has moved from `braintrust_langchain` to `braintrust.langchain`.","wrong":"from braintrust_langchain import BraintrustCallbackHandler","symbol":"BraintrustCallbackHandler","correct":"from braintrust.langchain import BraintrustCallbackHandler"}],"quickstart":{"code":"import os\nfrom braintrust import init_logger, auto_instrument\nfrom langchain_core.prompts import ChatPromptTemplate\nfrom langchain_openai import ChatOpenAI\n\n# Ensure your Braintrust API key is set\nos.environ['BRAINTRUST_API_KEY'] = os.environ.get('BRAINTRUST_API_KEY', 'YOUR_BRAINTRUST_API_KEY')\n\n# Initialize the logger with your project name (required)\n# and auto-instrument LangChain\ninit_logger(project=\"My LangChain Project\")\nauto_instrument()\n\nprompt = ChatPromptTemplate.from_template(\"What is 1 + {number}?\")\nmodel = ChatOpenAI(model=\"gpt-3.5-turbo\")\n\nchain = prompt | model\n\nresponse = chain.invoke({\"number\": \"2\"})\nprint(response.content)\n\n# The LangChain interaction will be automatically traced and logged to Braintrust.","lang":"python","description":"This quickstart demonstrates how to use Braintrust's LangChain integration with the main `braintrust` package. It initializes the Braintrust logger, enables automatic LangChain instrumentation, and then executes a simple LangChain example. All interactions will be automatically logged to your Braintrust project."},"warnings":[{"fix":"Uninstall `braintrust-langchain` (`pip uninstall braintrust-langchain`) and `pip install braintrust` instead. All future updates and features will be in the main `braintrust` package.","message":"This `braintrust-langchain` package is deprecated. Its functionality has been migrated to the main `braintrust` SDK.","severity":"breaking","affected_versions":"0.3.0 and later for `braintrust-langchain` (as it became a stub/deprecated package)."},{"fix":"Update imports to use `from braintrust import auto_instrument` for global instrumentation, or `from braintrust.langchain import BraintrustCallbackHandler` for manual callback handling. Refer to the `braintrust` SDK documentation for the latest usage.","message":"LangChain integration imports have changed. Direct imports from `braintrust_langchain` are no longer valid.","severity":"breaking","affected_versions":"Functionality moved into `braintrust` SDK versions >= 0.12.0. Any code relying on `braintrust-langchain` will fail."},{"fix":"Ensure the `BRAINTRUST_API_KEY` environment variable is set before running your application. Alternatively, pass the `api_key` argument directly to `braintrust.init_logger()` or `braintrust.set_api_key()`.","message":"Braintrust requires an API key for authentication. If not provided, tracing and logging will not function.","severity":"gotcha","affected_versions":"All versions of Braintrust SDKs."}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}