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

# Active observability with Loop

> Use Loop to investigate project data, edit Braintrust objects, and detect recurring patterns through interactive and scheduled analysis.

<Note>
  **Preview** - This is an early preview of Loop's expanded agentic capabilities. The behavior, tools, and limits described here can change. To try it, reach out to your Braintrust team.
</Note>

## What's new

* **Runs as a backend agent.** Loop executes in a Braintrust-managed runtime instead of only your browser, so it's more capable and your threads persist for you to resume later.
* **Works across your whole project.** Loop uses the context it's opened in, such as a specific experiment or trace, but can also inspect logs, experiments, and datasets across the project.
* **Takes action, not just analyzes.** Loop can create and edit Braintrust objects directly, including patterns, prompts, scorers, facets, preprocessors, datasets, custom views, and dashboards.
* **Asks before changing anything.** Actions that create or modify objects pause for your approval, unless you turn on auto-accept. Each approval dialog includes a short model-written description of the specific action, so you can see what will change before you allow it.
* **Previews changes in a workspace.** Loop renders the objects it creates or edits, including patterns, prompts, scorers, facets, preprocessors, dashboards, datasets, traces, automations, and experiment runs, in a workspace beside the chat, so you can preview changes without leaving Loop.
* **Runs in an isolated sandbox.** Each active thread gets its own sandbox, where Loop can run commands to inspect trace files directly.
* **Detects patterns in your project data.** Loop searches your project for recurring problems and trends, then saves patterns with evidence from your traces.
* **Runs on a schedule.** Loop can work without being asked, on a schedule and an instruction you configure.

## Get started

There are two ways to use Loop: interactively, or through [scheduled automations](#run-loop-automatically).

To start an interactive Loop thread:

1. **Open Loop.** The new dedicated [**<Icon icon="blend" /> Loop**](https://www.braintrust.dev/app/~/loop) page gives you a full-page experience and saves your threads so you can revisit or resume them. You can also start a thread from the prompt box on the project overview page. Braintrust creates the thread and opens it on the Loop page.
2. **Choose a harness, model, and reasoning effort.**
   * **Harness.** Choose **Native** for direct use of Loop's built-in tools or **Codex** for deeper, code-driven investigation.
   * **Model.** Pick from the models available to Loop in your project. Models come from your organization and project [AI providers](/docs/admin/ai-providers).
   * **Reasoning effort.** For supported models, choose a level from **Low** to **Max**. Available levels depend on the model. The menu marks each model's default, and the selector shows the active effort next to the model name. Loop remembers the effort you choose for each thread.
3. **Add context and attach files.** Loop uses the current page's data automatically. To point it elsewhere, select **<Icon icon="file-plus-2" /> Add context**. To attach a file, select **<Icon icon="paperclip" /> Attach files** or drag files into the composer. Loop accepts images, audio, video, PDF, text, and JSON, up to 8 files per message, 20 MB per file, and 40 MB per message.
4. **Ask, approve, and iterate.** Type a question and press Enter. Loop runs read-only work without interruption and pauses for approval before it creates or edits anything. Approve or reject each action in the chat, and keep refining. To skip approvals, turn on **Auto-accept edits** in <Icon icon="settings-2" /> settings. To show per-response metrics, turn on **Show turn metrics** in the same menu. The footer includes duration, TTFT, input and output token counts, cache hit rate, and estimated turn and session cost.

As Loop works, results become available in a workspace beside the chat. You can open objects Loop creates, edits, or references, such as a pattern, prompt, scorer, facet, preprocessor, dashboard, dataset, trace, automation, or a set of experiment runs, and keep multiple objects in workspace tabs while the thread continues. Hold Cmd, Ctrl, or Shift while selecting an object to open it in a new browser tab instead.

## What Loop can do

Loop has its own tools for driving playgrounds, custom views, dataset snapshots, and the workspace, and it can also call the read and write tools that the [Braintrust MCP](/docs/integrations/developer-tools/mcp) server exposes to coding agents. Loop chains several of them in one turn. For example, it can find a failure pattern in your logs, write a scorer for it, and open that scorer in the workspace for you to review.

### <Icon icon="search" /> Explore your data

Loop can query your logs, experiments, and datasets with SQL, inspect the schema of a data source, and read, search, and list files in a sandbox, or run commands there, to dig through large or complex traces. When Loop resolves a trace or generates a permalink, you can open that trace in the workspace and inspect it alongside the thread.

Loop can also write a query into the [**<Icon icon="asterisk" /> SQL sandbox**](https://www.braintrust.dev/app/~/sql) and run it there, so you keep the query to refine by hand. Across projects, Loop can pull project rows with their usage metrics to compare projects.

Example prompts:

<AccordionGroup>
  <Accordion title="Summarize logs and suggest next steps">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Look through my logs, explain what you find, and recommend the best next steps for my project.
    ```
  </Accordion>

  <Accordion title="Break down cost by model">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Show me the cost of traces named X over the last week, broken down by model. Include total, average, p50, p95, and p99 cost.
    ```
  </Accordion>

  <Accordion title="Graph caching and usage metrics">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Find the metrics related to prompt caching and LLM usage, then graph cache-hit rate and the number of LLM calls per trace.
    ```
  </Accordion>

  <Accordion title="Hand off a query to the SQL sandbox">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Write that query into the SQL sandbox and run it there so I can keep refining it.
    ```
  </Accordion>

  <Accordion title="Compare projects by usage">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Which of my projects logged the most traces this month, and what did each one cost?
    ```
  </Accordion>
</AccordionGroup>

### <Icon icon="sparkles" /> Analyze traces

Loop can analyze complex traces, making it easier to understand what happened across many LLM and tool calls.

On the [**<Icon icon="activity" /> Logs**](https://www.braintrust.dev/app/~/logs) page, open a trace in the **Timeline** view and click **Analyze trace** in the timeline header. Loop groups meaningful LLM and tool spans into a **Work** view and explains what each part of the trace contributed. If the trace already has a work analysis, click **Reanalyze** to run it again.

The **Debugger** view on the [**<Icon icon="activity" /> Logs**](https://www.braintrust.dev/app/~/logs) page focuses on failure analysis. Click **Run debugger** to have Loop identify likely failure modes, cite evidence from spans, tool calls, and model outputs, and suggest next steps. If a debugger report already exists, click **Rerun debugger** to refresh it.

### <Icon icon="scan-search" /> Find patterns

Most Braintrust projects contain more traces than a team can review by hand. Loop can search logs and raw trace data for recurring problems and trends that are not already captured by a scorer, such as a failure mode that affects one cohort of users or a recurring LLM call whose cost increased. It records each recurring problem or trend as a **pattern**: a saved result with the evidence behind it, rather than a single trace.

Example prompts:

<AccordionGroup>
  <Accordion title="Record a failure you suspect">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    I think our tool calls are failing more often since last week. Dig into it, and if you find something, record it as a pattern.
    ```
  </Accordion>

  <Accordion title="Turn an investigation into a tracked pattern">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Look through this project's recent logs, find a recurring failure, and record it as a pattern with the supporting traces.
    ```
  </Accordion>

  <Accordion title="Ask how a pattern was found">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    How did you derive this pattern, and what would make it more accurate?
    ```
  </Accordion>
</AccordionGroup>

When Loop records a pattern, it appears on the [**<Icon icon="scan-search" /> Patterns**](https://www.braintrust.dev/app/~/patterns) page alongside patterns found by scheduled automation runs. When new evidence points to a pattern Loop already recorded, it updates that pattern instead of adding a new one.

<AccordionGroup>
  <Accordion title="Review and act on a pattern">
    Patterns are scoped to a single project. To review a pattern and its evidence, go to [**<Icon icon="scan-search" /> Patterns**](https://www.braintrust.dev/app/~/patterns), directly below [**<Icon icon="blend" /> Loop**](https://www.braintrust.dev/app/~/loop) in the left sidebar, and select the pattern from the list.

    The list shows open patterns by default. Click <Icon icon="list-filter" /> **Filter patterns** above the list to switch between **Open**, **Closed as resolved**, **Closed as not useful**, and **Closed without reason**. Each option shows how many patterns it contains.

    The pattern detail shows:

    * **Description and recommended next step.** What Loop found, the context behind it, and the next investigation or fix Loop recommends.
    * **Evidence.** Monitor charts can track matching traces over time, and trace evidence shows the traces themselves with Loop's notes quoted inline. Select a trace to open it in the **Debugger** view on the [**<Icon icon="activity" /> Logs**](https://www.braintrust.dev/app/~/logs) page. The trace scrolls to the span field the evidence came from and highlights the quoted terms.
    * **How to monitor.** When Loop cannot attach a useful monitor chart, the pattern can instead recommend a scorer, classification, or facet you could create to measure it later. Click <Icon icon="blend" /> **Create classifier** or <Icon icon="blend" /> **Create scorer** next to the recommendation, depending on what Loop recommended, to open Loop with a pre-filled prompt that adds the evaluator to the pattern, determines a backfill strategy with you, and creates a monitor chart for it.
    * **Lifecycle.** Click <Icon icon="archive" /> **Close** in the pattern header to mark a pattern inactive. Selecting an outcome is optional: choose **Resolved** if the problem is fixed, addressed, or no longer happening, or **Not useful** if the pattern is noise, transient, or unimportant. You can also add free-text feedback, which Loop uses to improve future findings. The header then reads **Closed as resolved**, **Closed as not useful**, or **Closed without outcome**, and a banner on the detail attributes the closure to the person who closed it and shows their feedback. Click <Icon icon="archive-restore" /> **Reopen** to set a closed pattern back to active. Loop can also update status when it changes an existing pattern. Treat a closed pattern as Loop's judgment about the available evidence, not as proof that the underlying problem was fixed.

    To continue, share, or close a pattern:

    * **Keep investigating.**
      * On the [**<Icon icon="scan-search" /> Patterns**](https://www.braintrust.dev/app/~/patterns) page, open a pattern and select **Continue in Loop**. Braintrust starts a thread with the pattern attached as a context badge showing its name, so you can see what Loop is working from.
      * To work out why a scheduled run did or did not produce a given pattern, open the automation, select the **Past runs** tab, and select the run. Then select <Icon icon="git-fork" /> **Continue** to fork the read-only transcript into a private, editable thread.
    * **Hand it off.** On the [**<Icon icon="scan-search" /> Patterns**](https://www.braintrust.dev/app/~/patterns) page, open a pattern and click <Icon icon="clipboard" /> **Copy pattern as prompt** in the pattern header. Braintrust copies a Markdown brief with the pattern's status and close outcome, description, recommended next step, evidence trace IDs, and [`bt` CLI](/docs/reference/cli/quickstart) commands for pulling the full traces.
    * **Close it.** On the [**<Icon icon="scan-search" /> Patterns**](https://www.braintrust.dev/app/~/patterns) page, open a pattern and click <Icon icon="archive" /> **Close**. Closed patterns leave the **Open** list and move to **Closed as resolved**, **Closed as not useful**, or **Closed without reason**, and can be reopened at any time.

    Closing and reopening a pattern requires update permission on the project's patterns dataset.
  </Accordion>
</AccordionGroup>

<Note>
  Loop can also find patterns on a schedule. See [Run Loop automatically](#run-loop-automatically).
</Note>

### <Icon icon="pentagon" /> Configure Topics

Loop can configure the whole [Topics](/docs/observe/topics) pipeline, not just test individual facets. Given a goal, Loop works through the pipeline in stages:

* **Check the preprocessor.** Loop inspects your project's effective default preprocessor and runs it on real traces to confirm it returns usable conversation text. If the default returns nothing, Loop writes a custom preprocessor for your trace shape, tests it, and can set it as the project default.
* **Confirm the scope.** Loop looks for a grouping key such as `metadata.conversation_id` and recommends whether to analyze a span, a trace, or a group of related traces.
* **Validate the facets.** Loop runs a facet on up to ten representative traces and shows you the results inline for review, so you can correct its reading before it commits to a prompt. Build up a set of traces worth checking, then have Loop re-run the facet against that same set as you refine it. For a larger set, Loop runs the facet as an eval instead.
* **Evaluate candidates.** Loop runs evals over candidate facet prompts to measure quality before anything is saved.
* **Enable the automation.** Loop creates the facets and turns on the Topics automation, then offers to rewind it over a historical window.

<Note>
  Rewinding a Topics automation processes historical traces and draws from your monthly [model credits](/docs/plans-and-limits#model-credits). Loop estimates the volume and asks for approval before it rewinds.
</Note>

Example prompts:

<AccordionGroup>
  <Accordion title="Set up Topics from scratch">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Set up Topics for my project.
    ```
  </Accordion>

  <Accordion title="Configure Topics with a custom preprocessor">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Help me configure Topics with a custom preprocessor. My traces don't store conversation text on LLM spans.
    ```
  </Accordion>

  <Accordion title="Discover error categories">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    I want to discover the kinds of errors my users hit. Build a facet for that, validate it on real traces, and enable it.
    ```
  </Accordion>
</AccordionGroup>

### <Icon icon="chart-no-axes-column" /> Build views and dashboards

Loop can create and edit [custom views](/docs/annotate/custom-views) for both trace and dataset row data, and it can create dashboards. When Loop creates or updates a dashboard, you can open it in the workspace to review the result alongside the thread.

Example prompts:

<AccordionGroup>
  <Accordion title="Suggest trace visualizations">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    What are some useful trace visualizations you can make for me? I'll choose a few and you can create custom trace views.
    ```
  </Accordion>

  <Accordion title="Build a custom dataset view">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Build a custom view for this dataset that renders the input and expected output side by side.
    ```
  </Accordion>

  <Accordion title="Build a daily cost dashboard">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Create a dashboard for daily cost analysis.
    ```
  </Accordion>

  <Accordion title="Investigate an error spike">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    This topic or error spike looks interesting. Show me which customers and interactions are affected, inspect representative traces, and explain the likely root cause.
    ```
  </Accordion>

  <Accordion title="Share a dashboard with your team">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Turn this Loop analysis into a shareable dashboard my team and executives can use to understand the result and monitor it over time.
    ```
  </Accordion>
</AccordionGroup>

### <Icon icon="radio" /> Manage automations and alerts

Loop can set up recurring work and notifications from what it finds, so a problem you just investigated becomes something you get told about, or something Loop rechecks on a schedule.

* **Alerts.** Loop can create an alert on individual matching logs, on an aggregate that crosses a threshold over a recent window, or on environment updates.
* **Automations.** Loop can create a scheduled Loop job with its own instruction and schedule. It can also list the project's existing automations, including online scoring rules, alerts, exports, retention policies, and Topics automations, and return each one's full configuration, which helps when you're working out why a scheduled run behaves the way it does.
* **Status.** Loop can pause an automation or set it back to active.
* **Updates.** Loop can change an alert or a Loop automation, including a Loop automation's instruction and schedule, by rewriting it under its existing name. A rewrite replaces the whole configuration rather than patching a single field, so ask Loop to read the current configuration first, then check what it proposes before you approve. Scheduled exports and retention policies are inspect-only.

You can also edit any automation directly in **<Icon icon="settings-2" /> Settings** > [**<Icon icon="radio" /> Automations**](https://www.braintrust.dev/app/~/configuration/automations).

Example prompts:

<AccordionGroup>
  <Accordion title="Alert on the errors you just found">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Create an alert that notifies me when the error you just found shows up in my logs again.
    ```
  </Accordion>

  <Accordion title="Alert on a quality regression">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Alert me when the average score for this scorer drops below 0.8 over any six hour window.
    ```
  </Accordion>

  <Accordion title="Alert on cost growth">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Watch my daily spend and alert me when it goes more than 20% above last week's average.
    ```
  </Accordion>

  <Accordion title="Audit what's configured">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    What automations are configured in this project, and which ones are paused?
    ```
  </Accordion>

  <Accordion title="Work out why a scheduled run found nothing">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Show me the configuration for my pattern discovery automation, then explain why yesterday's run didn't record anything.
    ```
  </Accordion>
</AccordionGroup>

Alerts and automations Loop creates appear alongside the ones you configure by hand. See [Alerts](/docs/observe/alerts) for delivery channels and tuning, and [Run Loop automatically](#run-loop-automatically) for configuring a scheduled run yourself.

### <Icon icon="triangle" /> Author prompts and evaluators

Loop can suggest evaluators grounded in your application's real behavior, then create and save them, not just describe them. An evaluator is either a scorer, which returns a number, or a classifier, which returns a label. Loop can also create and update prompts directly. New and updated evaluators open in the workspace so you can review them inline.

Example prompts:

<AccordionGroup>
  <Accordion title="Suggest scorers for my project">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Suggest useful scorers for my project.
    ```
  </Accordion>

  <Accordion title="Write a scorer for known errors">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Write a scorer that detects the errors I just identified, then create and test it on a few traces.
    ```
  </Accordion>

  <Accordion title="Create a helpfulness judge">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Create an LLM-as-a-judge scorer for helpfulness based on these logs.
    ```
  </Accordion>

  <Accordion title="Set up online scoring">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Set up online scoring with the scorer I just created, and verify it runs automatically on new traces.
    ```
  </Accordion>
</AccordionGroup>

### <Icon icon="beaker" /> Run evaluations

Loop runs evaluations two ways:

* **In a playground or experiment.** Loop can edit the task prompt or code, add or modify scorers, and re-run the evaluation to show the effect of a change.
* **As a new experiment.** Loop can run an experiment from a dataset, from rows it supplies inline, or from a prior experiment, using a saved or inline task and any scorers you choose. When a prior experiment supplies the data, its outputs become the expected values.

When Loop starts an evaluation, the runs open in an **Experiments** panel in the workspace that lists each run's progress and scores, so you can compare results without leaving the chat.

<Note>
  Loop runs evaluations through Braintrust rather than by writing an `Eval()` script. To keep evaluations in your own repository and run them in CI, see [Run evaluations in code](/docs/evaluate/run-in-code).
</Note>

Example prompts:

<AccordionGroup>
  <Accordion title="Build a dataset and run an experiment">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Build a dataset from the traces where my agent gave a wrong answer, then run an experiment on it with my current prompt and scorers, and show me which cases still fail.
    ```
  </Accordion>

  <Accordion title="Evaluate an agent decision">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Evaluate whether this agent made the right decision, but only use the relevant messages, reasoning, and tool calls from these very large traces.
    ```
  </Accordion>

  <Accordion title="Compare a cheaper model">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Evaluate whether we can switch this workflow to a cheaper candidate model. Compare quality, cost, and latency, and tell me whether it is safe to roll out.
    ```
  </Accordion>
</AccordionGroup>

### <Icon icon="database" /> Curate datasets

Loop can generate datasets from log patterns and edit rows in an existing dataset. When Loop edits dataset rows, the dataset opens as a read-only table in the workspace panel. Select a row to inspect its trace inline, and the table refreshes as Loop makes further edits.

Loop can also manage dataset versions and the environments that point at them:

* **Snapshots.** Loop can save a [snapshot](/docs/annotate/datasets/manage#save-snapshots) of a dataset before it changes anything, list the existing snapshots along with their environment tags and current head version, and restore the dataset to a snapshot. Restoring uses the same confirmation flow as the dataset UI, and can save the current state first.
* **Environments.** Loop can point an [environment](/docs/deploy/environments) such as `production` or `staging` at a specific snapshot, or clear that mapping so consumers no longer resolve the dataset by it. It can list the organization's environments to check available slugs, and create one that doesn't exist yet.

<Warning>
  Restoring a dataset to a snapshot replaces its current rows, and retagging an environment changes which dataset state your applications resolve. Review the snapshot Loop proposes before you approve either action.
</Warning>

Example prompts:

<AccordionGroup>
  <Accordion title="Generate a dataset from errors">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Generate a dataset from logs with errors.
    ```
  </Accordion>

  <Accordion title="Add traces to a dataset">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Add these traces to my regression dataset and set the expected output.
    ```
  </Accordion>

  <Accordion title="Snapshot before editing">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Snapshot this dataset before you change anything, then remove the rows that no longer reflect our current behavior.
    ```
  </Accordion>

  <Accordion title="Review and restore a version">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    What snapshots exist for this dataset, and which one is production pointing at? Restore the one from before yesterday's edits.
    ```
  </Accordion>

  <Accordion title="Promote a dataset version">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Point the staging environment at the snapshot you just saved, and tell me which environments exist first.
    ```
  </Accordion>
</AccordionGroup>

### <Icon icon="book-open" /> Search docs and find objects

Loop can search the Braintrust documentation, resolve object names and URLs, list recent objects, summarize an experiment's metrics against a baseline, and generate shareable links to objects it creates.

Example prompts:

<AccordionGroup>
  <Accordion title="Look up how to set up human review">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    How do I set up human review?
    ```
  </Accordion>

  <Accordion title="Compare experiments">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Summarize my latest experiment compared to the previous one.
    ```
  </Accordion>

  <Accordion title="Get a shareable link">
    ```text wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    Give me a shareable link to the dashboard you just made.
    ```
  </Accordion>
</AccordionGroup>

## What Loop cannot do

Loop works inside your permissions, on one project at a time. Loop cannot:

* **Reach another organization's data.** A thread is scoped to the project you opened it in, and Loop resolves objects only within your organization.
* **Delete Braintrust objects.** Loop can create and update prompts, scorers, facets, preprocessors, datasets, views, and automations, but it has no tool to delete them. It can delete dataset rows, and it can close a pattern, which marks the pattern inactive rather than removing it.
* **Change organization settings.** Members, permission groups, API keys, AI providers, and billing are out of reach. Loop can list and create environments for dataset versioning, but it can't delete one.
* **See another user's threads.** Threads are private to the person who created them.
* **Act without approval.** Every action that creates or modifies an object pauses for your approval, unless you turn on auto-accept.
* **Change your application.** Loop works on the data and objects in Braintrust, not on your codebase or your deployments.

## Run Loop automatically

Use Loop automations for recurring work that should run without someone starting and managing a chat.

A Loop automation is a scheduled Loop run with an instruction, model, write tool permissions, and optional destinations. The instruction defines the job for each run, and the default query range controls how much recent project data Loop inspects.

For example, you can use Loop automations to:

* Find patterns in recent traces.
* Review cost or latency on a schedule.
* Check whether quality is degrading.
* Summarize recent errors.
* Review logs using the filters from a dashboard.
* Send a Slack or webhook digest after each run.

Each run creates a read-only thread with the work Loop did. To find it, open the automation and select the **Past runs** tab, then select a run. Automation run threads stay with their automation and don't appear in the thread list on the [**<Icon icon="blend" /> Loop**](https://www.braintrust.dev/app/~/loop) page. To ask follow-up questions from one of those transcripts, select <Icon icon="git-fork" /> **Continue**, which forks the run into a private, editable thread.

Loop automations use the model selected in the automation, and cost depends on that model and how much data the run inspects. Keep the instruction focused: a run that reads a broad set of traces can cost more than one that reviews a narrower slice. Models served by your configured [AI providers](/docs/admin/ai-providers) bill to those providers.

To create a Loop automation, go to **<Icon icon="settings-2" /> Settings** > [**<Icon icon="radio" /> Automations**](https://www.braintrust.dev/app/~/configuration/automations), click **+ Rule**, and select **Loop**.

### Configure a Loop automation

Each automation has its own instruction, frequency, model, query range, write permissions, and destinations. Use the configuration panel to control what the run investigates, how often it runs, and what it is allowed to change.

| Field                      | What it controls                                                                                                                                                                                                                                                                |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Name**                   | The automation name shown in **<Icon icon="settings-2" /> Settings** > [**<Icon icon="radio" /> Automations**](https://www.braintrust.dev/app/~/configuration/automations).                                                                                                     |
| **Description**            | Optional context for what the automation is for.                                                                                                                                                                                                                                |
| **Active**                 | Available when editing a saved automation. Turn this off to pause scheduled runs without deleting the automation.                                                                                                                                                               |
| **Frequency**              | How often the automation runs. Choose **Daily**, **Weekly**, **Interval**, or **Custom (cron)**. Daily and weekly schedules also include a run time and show the next scheduled run. Custom cron schedules use five fields: minute, hour, day of month, month, and day of week. |
| **Instruction**            | What Loop should do during the run: what to look at, how deeply to look, and when to stop.                                                                                                                                                                                      |
| **Agent configuration**    | The model, harness, and reasoning effort for the Loop run.                                                                                                                                                                                                                      |
| **Default query range**    | The time range Loop should query by default, such as 3 hours, 6 hours, 12 hours, 1 day, 3 days, 7 days, or a custom range. Runs do not only inspect traces created since the previous run.                                                                                      |
| **Write tool permissions** | What this run is permitted to change. See **Write tool permissions** below.                                                                                                                                                                                                     |
| **Destinations**           | Slack channels or webhooks for run digests. See **Destinations** below.                                                                                                                                                                                                         |

To stop a Loop automation, pause or delete it.

<Note>
  To run a saved automation immediately, open the automation and click **Run now**. Braintrust queues the run and shows a link to the Loop thread when it is ready.
</Note>

<AccordionGroup>
  <Accordion title="Write tool permissions">
    In a Loop thread, actions that change something pause for your approval. A scheduled run has nobody to ask, so it relies on the automation's **Write tool permissions** configuration.

    * Read-only tools do not require approval, so the run can inspect project data such as traces, existing patterns, experiments, and datasets.
    * By default, automations created from the [**<Icon icon="scan-search" /> Patterns**](https://www.braintrust.dev/app/~/patterns) page can create and update pattern records. A pattern record can include trace evidence, monitor chart configurations, and recommendations for how to measure the pattern later. Creating scorers, facets, or other project objects requires the corresponding write tools.
    * To let a Loop automation create or modify project objects, add the corresponding tools. The dropdown lists the available tools and what each one permits.
    * Objects a run creates are not linked back to the pattern. If a pattern's monitor chart measures a scorer or facet the run created, deleting it stops new data from reaching that chart.

    Enabling a tool lets scheduled runs make that kind of change without asking for approval during the run. Choose only the tools the automation needs.

    <Warning>
      Allowing a run to create or update online scoring rules can start work that continues after the run ends. Online scoring rules score production traffic continuously and can keep costing money.
    </Warning>
  </Accordion>

  <Accordion title="Destinations">
    To send Loop automation results to a destination outside Braintrust, add a destination in the configuration panel. Click **+ Destination**, then choose **Send to webhook** or **Send to Slack**.

    * **Slack.** Select a Slack channel to post a text digest to Slack. Slack destinations require a [connected Slack workspace](/docs/admin/organizations#enable-slack-integration). Use the destination's **Formatting prompt** to tell Loop how to format the message.
    * **Webhook.** Enter a webhook URL to send run results to an external service. Use the destination's **Formatting prompt** to describe the JSON payload Loop should produce.

    Patterns recorded from an interactive Loop chat do appear in the Patterns list, but they do not trigger Slack or webhook destinations. Destinations belong to automation runs rather than to the Patterns list itself.
  </Accordion>
</AccordionGroup>

### Pattern discovery

Braintrust provides a shortcut for creating a Loop automation that looks for patterns. On the [**<Icon icon="scan-search" /> Patterns**](https://www.braintrust.dev/app/~/patterns) page:

* Enable automatic pattern discovery by clicking **Enable patterns**. Braintrust opens the **Introducing Patterns** dialog, where you can optionally choose a Slack workspace and channel to be notified in when Loop finds patterns. Click **Enable patterns** to confirm. Braintrust creates one default **Pattern discovery** automation that runs every 24 hours, uses a 30-day default query range, and has permission to create and update patterns. After you enable it, **Enable patterns** changes to **Settings**.
* Configure an existing automation by clicking **Settings** and selecting the automation you want to edit.
* Create another automation by selecting **Settings** > **New automation**. Braintrust opens a prefilled automation you can review and save.

Loop automations created from the [**<Icon icon="scan-search" /> Patterns**](https://www.braintrust.dev/app/~/patterns) page are still ordinary Loop automations. You can also view and configure them in **<Icon icon="settings-2" /> Settings** > [**<Icon icon="radio" /> Automations**](https://www.braintrust.dev/app/~/configuration/automations). When you create a pattern automation, keep the instruction framed around finding or updating patterns, even when the automation focuses on a specific area such as latency, cost, quality, or sentiment.

Enabling pattern discovery queues an initial analysis run right away, and patterns appear once that run finishes. While a run is in progress, the [**<Icon icon="scan-search" /> Patterns**](https://www.braintrust.dev/app/~/patterns) page shows an **Analyzing traces...** indicator. When a project has no patterns yet, click **Analyze patterns** to queue another run without waiting for the schedule.

## Manage threads

To delete a thread, select the <Icon icon="ellipsis" /> menu on the thread header or on any thread in the sidebar, select **Delete session**, then confirm.

<Warning>
  Deleting a session is permanent and cannot be undone.
</Warning>

You can't delete a session while it's running. Automation run threads are read-only and can't be deleted this way.

## Limits and caveats

Loop runs in an isolated, per-user sandbox.

**When a sandbox starts.** Loop starts a sandbox for a thread the first time you send a message in it, not when you open the [**<Icon icon="blend" /> Loop**](https://www.braintrust.dev/app/~/loop) page or revisit a saved thread. One active thread uses one sandbox.

**When a sandbox stops counting.** After 15 minutes without activity, the sandbox goes to sleep, and a sleeping sandbox doesn't count toward your concurrent limit. Send another message in that thread and it resumes automatically, with the thread's history intact. The concurrent limit therefore applies to the threads you're working in at the same time, not to the total number of threads you've created.

| Limit                        | Value                                                                                                       |
| ---------------------------- | ----------------------------------------------------------------------------------------------------------- |
| Concurrent running sandboxes | 1 on Free and Starter plans; up to 50 on other hosted plans, counted per user across all your organizations |
| Sleep after inactivity       | 15 minutes, then resumes automatically on your next message                                                 |
| Maximum sandbox lifetime     | 8 hours, including time asleep                                                                              |

**When you reach the limit.** If you send a message while all your sandboxes are running, Loop makes room by reclaiming the thread that has been quiet longest, and your message proceeds. You only see an error if every sandbox is actively working, such as several threads running long investigations at once. Wait for one to finish, then send the message again.

When a sandbox reaches its maximum lifetime, Loop starts a fresh one for your next message. Your thread and its history are unaffected.

Additional caveats during the preview:

* This is a preview feature enabled per organization. Capabilities and limits can change.
* Loop threads are private to the user who created them. Sharing and cross-user access are not yet available.

## Share feedback

The preview is an active area of development, and your feedback shapes it. Tell your Braintrust team what worked, what didn't, and what you'd want Loop to do next. You can also ask Loop to file a support ticket directly from the chat.
