> ## 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.

# Tracing quickstart

> Instrument your AI application with a coding agent and verify that traces appear in Braintrust.

## Setup

> [tab] Prompt
>
> In your project directory, give this prompt to your coding agent:
>
> ```markdown expandable wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
> # Trace an AI application with Braintrust
>
> Set up Braintrust tracing in this working directory. Follow these steps in order.
>
> ## Step 1: Set up Braintrust access
>
> Check whether `BRAINTRUST_API_KEY` is set in the environment. If it is, skip this step.
>
> If it isn't, ask the user to do the following, then stop and wait for the user to confirm. Do not guess, invent, or hardcode an API key.
>
> 1. Sign up or sign in at https://www.braintrust.dev/signup
> 2. Create an API key at https://www.braintrust.dev/app/~/configuration/api-keys
> 3. Set `BRAINTRUST_API_KEY` (the value starts with `sk-`) as an environment variable in the shell the user will run the app from, for example `export BRAINTRUST_API_KEY="sk-..."`. If the app loads a `.env` file, add it there instead. The user should not commit the key to version control.
>
> Once the user confirms, continue. If the key isn't visible in your own environment, that's expected when the user set it in a separate shell or in a `.env` file that only the app loads. Don't block on it.
>
> ## Step 2: Detect the SDK
>
> Look at the workspace and determine the right Braintrust SDK(s) to use. If the project spans more than one language, instrument each one. If the project is a monorepo, check the git root to get oriented, but only instrument applications in or below the current working directory.
>
> ## Step 3: Follow the SDK's configure tracing guide
>
> For each SDK, read the matching page and follow its "Configure tracing" section. Do not follow any other Braintrust setup docs.
>
> | SDK | Guide |
> | --- | ------|
> | Python | https://docs.braintrust.dev/sdks/python/install-and-instrument.md |
> | TypeScript | https://docs.braintrust.dev/sdks/typescript/install-and-instrument.md |
> | Go | https://docs.braintrust.dev/sdks/go/install-and-instrument.md |
> | Java | https://docs.braintrust.dev/sdks/java/install-and-instrument.md |
> | Ruby | https://docs.braintrust.dev/sdks/ruby/install-and-instrument.md |
> | C# | https://docs.braintrust.dev/sdks/csharp/install-and-instrument.md |
>
> ## Step 4: Install and configure the SDK
>
> - Install the SDK with the package manager the project already uses. Use the latest version: look it up and install that version rather than pinning to `latest`. Verify the install succeeded.
> - Prefer auto-instrumentation over manual wrappers.
> - Set the project name in the SDK initialization to the repository or application name. If the user has a specific Braintrust project in mind, use that instead.
>
> ## Rules
>
> - Add only tracing. Do not add evals or anything else.
> - Make only the code changes needed to add tracing. Do not run application code, and do not break or meaningfully modify existing code.
> - Do not use the Braintrust CLI (`bt`).
>
> Full documentation: https://docs.braintrust.dev/llms.txt
> ```
>
> This sets up access to Braintrust, then uses a coding agent to inspect your project, install the Braintrust SDK, and configure tracing.
>
> No coding agent installed? [Install and instrument manually](https://docs.braintrust.dev/instrument/trace-llm-calls.md).

> [tab] Wizard
>
> In your project directory, run the agent-assisted setup wizard:
>
> ```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
> curl -fsSL https://braintrust.dev/wizard/setup.sh | sh -s -- --from docs_tracing_quickstart
> ```
>
> This sets up access to Braintrust, then uses a coding agent to inspect your project, install the Braintrust SDK, and configure tracing.
>
> No coding agent installed? [Install and instrument manually](https://docs.braintrust.dev/instrument/trace-llm-calls.md).

## Verify tracing

Run your app and make an AI call. A trace will show up in your [** Logs**](https://www.braintrust.dev/app/~/logs) within seconds. Click into any trace to see the complete input and output, token counts, latency, cost, model configuration, and metadata.

> [!TIP]
>
> If traces appear in Braintrust, you've successfully set up tracing.

If your traces don't appear in Braintrust, see [Troubleshoot](#troubleshoot) below.

## Enable Patterns

Enable [** Patterns**](https://www.braintrust.dev/app/~/patterns) to have Loop find recurring problems and trends in your traces, with evidence and suggested fixes. See the [setup guide](https://docs.braintrust.dev/observe/patterns/enable.md) for details.

![Pattern](https://mintcdn.com/braintrust/Mpah3XDvMklMcbs-/images/observe/patterns.png?fit=max\&auto=format\&n=Mpah3XDvMklMcbs-\&q=85\&s=6f229a579369b58a877bcbe6d6edb33a)

## Troubleshoot

> [accordion] Not seeing traces in the UI?
>
> * Verify `BRAINTRUST_API_KEY` is set and starts with `sk-` (`echo $BRAINTRUST_API_KEY`).
> * Check that the project name in your code matches the project in the UI.
> * Check your console for errors. Common causes are an invalid API key, network connectivity, or a firewall blocking `api.braintrust.dev`.

> [accordion] SDK-specific issues?
>
> See the troubleshooting guide for your SDK: [Python](https://docs.braintrust.dev/sdks/python/troubleshooting.md), [TypeScript](https://docs.braintrust.dev/sdks/typescript/troubleshooting.md), [Go](https://docs.braintrust.dev/sdks/go/troubleshooting.md), [Java](https://docs.braintrust.dev/sdks/java/troubleshooting.md), [Ruby](https://docs.braintrust.dev/sdks/ruby/troubleshooting.md), or [C#](https://docs.braintrust.dev/sdks/csharp/troubleshooting.md).

> [accordion] Need help?
>
> * Join our [Discord](https://discord.gg/6G8s47F44X)
> * Email us at [support@braintrust.dev](mailto:support@braintrust.dev)
> * Use the [Loop](https://docs.braintrust.dev/loop.md) agent in the Braintrust UI

## Next steps

* Explore the full [Braintrust workflow](https://docs.braintrust.dev/workflow.md)
* Go deeper with tracing:
  * [Explore integrations](https://docs.braintrust.dev/integrations.md) with AI providers, SDKs, and developer tools
  * [Trace application logic](https://docs.braintrust.dev/instrument/trace-application-logic.md) for application logic
  * [Capture user feedback](https://docs.braintrust.dev/instrument/user-feedback.md) like thumbs up/down
  * [Analyze logs](https://docs.braintrust.dev/observe/view-logs.md) for patterns and issues


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