API referenceConsole
observability
Polylane watches your Braintrust projects for changes in errors, latency and cost, picks up your alerts, and queries logs and experiments to find the cause.

Connect

Connect Braintrust from the terminal. Pass --help for the flags Braintrust accepts.

Terminal
polylane integration connect --type braintrust

How it works

Braintrust alerts become issues

Your Braintrust time window alerts reach Polylane. Polylane adds its webhook to each one on connect and again every hour, so an alert that you create later gets the webhook within an hour. A firing alert opens an issue, and a recovery marks it recovered. When the same alert fires again while its issue is open, the alert goes to that issue. Polylane investigates each issue.

Braintrust alerts carry no severity. When an alert also has a PagerDuty action, Polylane uses the severity of that action. Other alerts arrive as warnings.

Log alerts send to a single action, so Polylane does not attach to them.

Checks on your projects

Polylane watches each project for changes in errors, latency, tokens, and cost. Every 30 minutes, it reads the 50 newest projects and runs one SQL query over all of them. It then checks seven series for the ten projects with the most root spans:

  • Root-span error rate, p99 duration, and volume
  • LLM spans with an error
  • Estimated cost, prompt tokens, and completion tokens

A clear change opens an issue. If the query fails or Braintrust limits it, Polylane skips that run and tries again, so a failed read never looks like a quiet project. On the integration page, you can change how often the checks run or turn them off.

Braintrust allows 20 SQL queries a minute for each organization. The checks and the agents share that limit and one cache.

Polylane also explores the connection when you connect it and every 12 hours after that, and records what it finds as issues. Every six hours, Polylane checks that the token still belongs to one organization and can read and update all projects.

During an investigation

Read Braintrust logs, traces, and experiments through Polylane, query them with SQL, and request API changes. Agents search traces, open one trace as a span tree, list experiments, and compare the scores of an experiment with a baseline. Changes require safety review and approval.

Braintrust APIs

Polylane uses these Braintrust APIs:

Braintrust APIWhat it unlocks
POST /api/apikey/login, POST /api/self/get_object_infoFinds the organization of the token and checks that it can read and update all projects.
GET /v1/projectLists your projects.
POST /btqlRuns read-only SQL over logs, experiments, and datasets: trace search, trace trees, and the error, latency, token, and cost series per project.
GET /v1/experiment, GET /v1/experiment/{id}/summarizeLists experiments and compares their scores with a baseline.
GET /v1/project_automation, PATCH /v1/project_automation/{id}Finds your time window alerts, adds the Polylane webhook to each one, and removes it when you disconnect.
braintrustApiCalls any other Braintrust API under /v1/. API keys, service tokens, secrets, inserts, the AI proxy, and function invoke are not available.

Disconnecting

Disconnecting removes the Polylane webhook from your alerts and leaves the service token in Braintrust. Remove the token under Settings → Service tokens in Braintrust.

An alert whose only action is the Polylane webhook keeps it, because Braintrust requires one action, and Polylane ignores its deliveries.

Disconnect

Disconnecting stops every sync and check and deletes the credentials Polylane held. Polylane removes what Braintrust's API lets it remove. The following stays until you remove it yourself:

  • Braintrust service token
Terminal
polylane integration disconnect <id>

Tools

7

Operations agents can perform in threads.

List Projects
List Braintrust projects with their IDs and links
Search Traces
Search Braintrust log traces by project, time window, errors and SQL filter
Get Trace
Read one Braintrust trace as a span tree with latency, tokens, cost and errors
Sql
Query Braintrust logs, experiments and datasets with SQL
List Experiments
List Braintrust experiments (eval runs) of a project with commit and dataset
Summarize Experiment
Summarize one Braintrust experiment's scores against a baseline experiment
Api
Call the connected Braintrust REST API