Skip to main content
Issue: Your application runs successfully, but LLM calls do not appear in Braintrust.Cause: auto_instrument() must run after init_logger() and before creating AI provider clients. Clients created first may not be patched for tracing.Fix: Initialize Braintrust as early as possible during application startup, then create your provider clients.
Issue: A script, notebook cell, background job, or CLI finishes but some events never appear in Braintrust.Cause: The SDK buffers logs before sending them. A short-lived process can exit before the buffer flushes.Fix: Call logger.flush() before the process exits.
Issue: Logging fails with an authentication error, or traces do not appear in the expected organization.Cause: BRAINTRUST_API_KEY is missing from the environment of the process that runs your Python code.Fix: Set BRAINTRUST_API_KEY in the same shell, service, notebook, container, or deployment environment that starts your app.
Issue: A trace appears but is missing final values, or a manually-created span never finishes.Cause: A process can exit before logs flush, or an exception can bypass the end of a manually-created span.Fix: Prefer traced, which handles span lifecycle for you. If you create spans manually, make sure they are ended and flushed even when an exception occurs.