> ## Documentation Index
> Fetch the complete documentation index at: https://docs.braintrust.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Traceloop

> Trace LLM calls and workflows from Traceloop OpenLLMetry in Braintrust to debug prompts and monitor production usage

[Traceloop OpenLLMetry](https://www.traceloop.com/docs) is an observability framework for LLM applications. Braintrust captures the LLM calls, workflows, and application traces that Traceloop instruments and logs them to your Braintrust project.

**Python**

## Setup

This integration uses Braintrust's [Python SDK OpenTelemetry configuration](https://docs.braintrust.dev/integrations/sdk-integrations/opentelemetry/send-traces-and-logs.md#python-sdk-configuration). Install Traceloop alongside the Braintrust SDK, then point it at Braintrust's OpenTelemetry endpoint.

**1. Install the packages**

Install Traceloop with the Braintrust SDK's OpenTelemetry support and the OpenAI client:

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
pip install "braintrust[otel]" traceloop-sdk openai
```

**2. Configure environment variables**

Point Traceloop at Braintrust by setting its base URL and headers:

```bash title=".env" theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
TRACELOOP_BASE_URL=https://api.braintrust.dev/otel
TRACELOOP_HEADERS="Authorization=Bearer%20<Your API Key>, x-bt-parent=project_id:<Your Project ID>"
```

> [!NOTE]
>
> When setting the bearer token, encode the space between "Bearer" and your API key using `%20`.

## OpenTelemetry

To send traces to Braintrust, initialize Traceloop. It exports spans to the project named in the `x-bt-parent` header:

```python title="traceloop_braintrust.py" theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
from openai import OpenAI
from traceloop.sdk import Traceloop
from traceloop.sdk.decorators import workflow

Traceloop.init(disable_batch=True)
client = OpenAI()

@workflow(name="story")
def run_story(client):
    response = client.responses.create(
        model="gpt-5-mini",
        input=[{"role": "user", "content": "Tell me a short story about LLM evals."}],
    )
    return response.output_text

print(run_story(client))
```

## Resources

* [Traceloop OpenLLMetry documentation](https://www.traceloop.com/docs).
* [Braintrust OpenTelemetry guide](https://docs.braintrust.dev/integrations/sdk-integrations/opentelemetry/send-traces-and-logs.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.