Contributed by Max Kern on 2026-08-19
This cookbook shows you how to collect traces from your team’s coding agents in a single Braintrust project and use a Loop automation to periodically analyze those traces, spot recurring problems, and surface Patterns for you to review.
For example, you might find that agents repeatedly resend large amounts of context, increasing model usage, or that file operations fail because of stale paths or imprecise replacement text. You might also find agents repeatedly checking whether long-running commands have finished, or tracing issues that combine unrelated work or reprocess the same sessions.
This guide describes how to:
- Create a Braintrust project for your team’s coding-agent traces.
- Configure Claude Code, Codex, OpenCode, or Pi to send sessions to the project.
- Use the
btCLI to add three facets and a daily Loop automation to the project. - Collect new traces and import useful Codex or Claude Code sessions from earlier work.
- Run the automation manually to verify that it can review the sessions, then review any recurring problems it saves as patterns.
- Optionally refine the facets and automation or send automation reports to Slack.
Prerequisites
Before you begin, you’ll need:- A Braintrust account with permission to create a project and project-level
Read,Create, andUpdatepermissions. Members of the Owners and Engineers permission groups have these permissions by default. - Access to an organization owner who can enable Topics if it is not already enabled for the project.
- An AI provider with access to
gpt-5.6-sol, configured under Settings > AI providers. - At least one supported coding agent installed on macOS or Linux: Claude Code, Codex, OpenCode, or Pi.
1. Create a project for your traces
One person should create a dedicated Braintrust project for your team’s coding-agent sessions. This project will contain the traces, Topics facet values, Loop automation, and patterns you create in this cookbook.- Go to your organization overview.
- Open the project dropdown and click + Create project.
- Enter
coding-agent-insightsas the project name. - Optionally add a description, then click Create.
coding-agent-insights in the project dropdown. If the project already exists, use it instead of creating another one. Before continuing, make sure every teammate whose sessions you want to collect can access the project.
2. Configure your coding agents
Everyone whose sessions should appear incoding-agent-insights, including you, must complete this step on each computer where they use a supported coding agent.
1
Install bt
2
Authenticate with Braintrust
Run Complete the browser flow. The CLI creates or updates an OAuth profile so the tracing plugins can authenticate without putting an API key in your shell history.
bt status --all to check your saved logins. If you already have a valid OAuth profile that can access the organization and project where you’ll save traces, continue to the next step below. Otherwise, sign in:Authenticate with a self-hosted deployment
Authenticate with a self-hosted deployment
To authenticate If your organization also uses a Braintrust app URL other than
bt and send coding-agent traces to a self-hosted Braintrust deployment, you need to know which URLs it uses:- API URL:
btuses this URL to start and refresh OAuth. Coding-agent tracing uses it to send traces. Find it under Settings > Data plane, or ask your Braintrust administrator for it. - Braintrust app URL:
btuses this URL to find the organizations you can access. The default ishttps://www.braintrust.dev.
export BRAINTRUST_API_URL="<YOUR_API_URL>" in the current shell. Add the export to your shell startup file or repeat it in each shell where you start a coding agent so its tracing process inherits the URL.Then sign in:https://www.braintrust.dev, include that URL:bt saves the URLs in your OAuth profile for authentication. Keep BRAINTRUST_API_URL set whenever you start a coding agent so its tracing process sends traces to your self-hosted API. Later commands include --prefer-profile to prevent an ambient BRAINTRUST_API_KEY from taking precedence over the profile.3
Configure your coding agents
Run the commands for the coding agents you use on this computer:After setup:
- Claude Code
- Codex
- OpenCode
- Pi
- Restart Claude Code to load the tracing configuration.
- Run
bt trace doctor claude. - Confirm that
Enabledistrue,Authisready, and the displayed organization and destination project are correct. - If the organization or project is incorrect, rerun
bt trace setup claudewith the correct--organd--projectvalues.
4
Verify tracing
Confirm that each configured agent sends sessions to the shared project:
- Start a new session in each configured coding agent and ask it to complete a small task. Ask participating teammates to do the same.
- Go to Logs, select
coding-agent-insights, and confirm that each new session appears as a root trace.
bt trace doctor command and resolve any authentication or routing problems it reports. For Codex, also run /hooks and confirm that the Braintrust hooks are trusted. If needed, review the tracing setup for Claude Code, Codex, OpenCode, or Pi.3. Configure Topics and Loop
If Topics is not already enabled, an organization owner must enable it. After that, any teammate with project-levelRead, Create, and Update permissions can use bt and the prebuilt JSON file to set up the automated analysis.
1
Enable Topics
Skip this step if Topics is already enabled for
coding-agent-insights. Otherwise, ask an organization owner to:- In
coding-agent-insights, go to Topics. - Make sure Task is selected. You can leave the other built-in facets off.
- Choose whether to Apply to existing traces.
- Click Enable topics.
2
Download the configuration file
3
Configure your project
Pass the JSON file to At the confirmation prompt, verify the organization, project, three facets, one Loop automation, and Topics wiring. Then confirm the push. The command should report that it successfully pushed all four resources.
bt, which can use it to configure your coding-agent-insights project.4
Review the installed resources
Review the Topics facets
Review the Topics facets
Confirm that the template added the facets to the project and attached them to the Topics automation:
- In the
coding-agent-insightsproject, go to Topics. Confirm that cards appear for Coding agent context debt, Primary failure mode, and Skills analysis. - Click Automation and select Topics. Expand Active facets and confirm that it includes the same three custom facets.
Review the Loop automation
Review the Loop automation
Confirm that the template created an active daily automation with the expected analysis window and pattern permissions:
- Go to Settings > Automations. Confirm that Coding Agent Improvements Discovery shows Every 24 hours and Active.
- Click Coding Agent Improvements Discovery to open it. On the Edit tab, confirm that:
- Agent configuration shows GPT-5.6 Sol with Extra high reasoning effort.
- Default query range shows Custom,
30days. - Write tool permissions shows 2 allowed. Open it and confirm that
new_patternandupdate_patternare selected.
4. Collect coding-agent traces
Accumulate traces across tasks, teammates, and coding agents. Each session gives the automation more evidence to distinguish recurring problems from one-off difficulties. You can also import useful saved sessions from earlier Codex or Claude Code work. To do this, find the session ID using the instructions for your agent, then run the import command:- Claude Code
- Codex
- Use
claude --resumeto reopen the session you want to import. - Run
/statusand copy its session ID. - Import the session:
bt trace import supports saved sessions from Codex and Claude Code. It does
not support OpenCode or Pi, so collect those sessions through live tracing.5. Verify the automation
After collecting some traces, run Coding Agent Improvements Discovery manually to confirm that it can review them:- Go to Settings > Automations and click Coding Agent Improvements Discovery to open it.
- Click Run now. You’ll see a Starting Loop automation… notification, followed by a Loop automation started notification.
- In the second notification, click Open Loop. Alternatively, open Past runs and click the newest Coding Agent Improvements Discovery run. Either route opens the Loop thread, where you can watch the run.
6. Customize the workflow (optional)
After verifying the automation, experiment with changes in an interactive Loop thread or send its reports to Slack or a webhook.Experiment with changes in Loop
Experiment with changes in Loop
If you’d like to refine the facets or change what the scheduled automation analyzes, start in an interactive Loop thread. You can try different analyses against recent sessions before updating the project’s facets or scheduled automation.Ask Loop to suggest changes. Go to Loop and enter this prompt:Continue the thread to refine and test its suggestions. Leave proposed changes unapproved while you experiment.Try your own analysis. If you already know what you want to try, describe the revised analysis in a new Loop thread and ask Loop to run it against recent sessions. Adjust your instructions and rerun the analysis until you’re satisfied with the results.Apply a change. When you’re satisfied, either approve a change that Loop proposed or update the automation manually. To update the automation yourself, go to Settings > Automations and click Coding Agent Improvements Discovery to open it. Make the change and click Save. Approving or saving a change updates the existing facet or automation.
Send reports to Slack or a webhook
Send reports to Slack or a webhook
To send the result of each successful automation run to Slack or a webhook, add a destination. Go to Settings > Automations and click Coding Agent Improvements Discovery to open it.Test the destination. Save the automation and click Run now. When the run finishes, confirm that the Slack channel or webhook endpoint received the formatted report.Adding a destination does not change the automation’s daily schedule or 30-day lookback window.
- Slack
- Webhook
1
Connect Slack
Go to Settings > Integrations and connect your Slack workspace.
2
Add the destination
Under Destinations, click + Destination and select Send to Slack. Then choose the workspace and channel.Braintrust prepopulates a suggested Formatting prompt. Review it and adjust it as needed for your team.
Troubleshooting
The template download fails
The template download fails
If the
curl command for downloading the configuration file returns an HTTP error:- Confirm that the URL is
https://www.braintrust.dev/docs/assets/active-observability-config.json. - Retry from a network that can reach
www.braintrust.dev.
A facet or automation already exists
A facet or automation already exists
If
bt observability template push reports that a matching facet or Loop automation already exists, it stops before the confirmation prompt:- If you intend to restore the template configuration, rerun the same command with
--forceand confirm the replacements. - A new project does not need
--force.
Codex cannot clone the plugin marketplace
Codex cannot clone the plugin marketplace
If
bt trace setup codex reports a marketplace clone timeout:- Run the command again.
- If it repeatedly reports
fatal: early EOF, troubleshoot the network connection rather than the Braintrust project configuration.
Traces do not appear
Traces do not appear
If a test session does not appear in Logs after you configure tracing:
- Restart the coding agent and run another test task.
- For a self-hosted deployment, run
printenv BRAINTRUST_API_URLin the shell where you start the coding agent. If it is empty or incorrect, export the API URL shown under Settings > Data plane, restart the agent from that shell, and run another test task. - If the trace still does not appear, run
bt trace doctor <AGENT>, replacing<AGENT>withclaude,codex,opencode, orpi. - Confirm that
Enabledistrue,Authisready, and the displayed organization and destination project are correct. - If
Authis notready, runbt login --oauth, then run the doctor command again. - If the organization or destination project is wrong, rerun
bt trace setupfor that agent with the correct--organd--projectvalues.
A saved session cannot be imported
A saved session cannot be imported
If
bt trace import cannot find a Codex or Claude Code session:- Confirm that the command names the agent that created the session. Use
bt trace import codexfor Codex orbt trace import claudefor Claude Code. - Run the command from the same user account and computer where that agent saved the session.
The automation cannot call its model
The automation cannot call its model
If Coding Agent Improvements Discovery fails because it cannot call
gpt-5.6-sol:- Configure
gpt-5.6-solunder AI providers, or select an available model in the automation editor. - Run the automation again.
Cleanup
Choose what to keep or remove:-
Delete the downloaded configuration file: After pushing the template, run
rm /tmp/active-observability-config.json. -
Keep collecting traces in
coding-agent-insights: No action is required. -
Send future traces to another project: Rerun the appropriate
bt trace setupcommand for each configured coding agent with the new--organd--projectvalues. -
Stop collecting coding-agent traces: Run
bt trace disable <AGENT>for each configured agent, replacing<AGENT>withclaude,codex,opencode, orpi. This removes the Braintrust tracing integration and its saved configuration. -
Delete
coding-agent-insights: First stop tracing or send future traces to another project. Then follow the instructions below if you no longer need the project’s data. To delete the project:- Go to Settings > General.
- Click Delete project.
- Enter
coding-agent-insightsand click Delete.
Recap
Your team now has a shared view of its coding-agent work in Braintrust. Three facets classify each session for common problems, and a daily Loop automation reviews the past 30 days to identify problems that recur across sessions. When it finds enough evidence, it creates or updates a pattern that your team can investigate, address, and monitor over time. As your needs change, you can refine what the facets and automation look for and send run reports to Slack or a webhook.Next steps
- Learn how to review and act on patterns.
- Configure Loop automations to change their schedule, permissions, and destinations.
- Create and test Topics facets for other problems your team wants to track.
- Explore the
btCLI commands for querying and managing project data.