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

# Catch regressions with online scoring

> Score production traces with the scorer from your eval, and get an alert when the problem you fixed starts happening again.

## Score production traces

[Online scoring](https://docs.braintrust.dev/evaluate/score-online.md) evaluates new traces as your app runs, helping you catch problems your test cases missed and detect regressions. It runs in the background without adding latency to your app. Use the scorer from your eval to watch for the problem you fixed.

1. Ask Loop or your coding agent to validate the scorer and [create an online scoring rule](https://docs.braintrust.dev/evaluate/score-online.md#create-scoring-automation-rules):

   ```markdown expandable wrap theme={null}
   Set up online scoring to watch for the problem we just fixed.

   ## Check the scorer

   - Check whether our eval scorer can score production traces without dataset-only expected outputs.
   - If it can't, create a separate production scorer using evidence available in the trace. Preserve the eval scorer. Explain any difference in what the production scorer can verify, and don't invent missing reference data.
   - Test the production scorer on known failing and successful traces. If the traces lack the evidence needed to judge this behavior, explain what the app must log before proceeding.

   ## Create the rule

   - Create an online scoring rule in the same Braintrust project. Choose a scope that supplies the context the scorer needs, and filter to identifiable test requests relevant to this problem.
   - Use 100% sampling for these test requests. Leave the rule paused for review, and explain how to generate requests that match the filter.
   - Link to the scorer and rule, report the test results, and explain the scope and filter. If any settings need to be configured in the UI, give me the exact steps.
   ```

   [Run in Loop](https://www.braintrust.dev/app/~/loop?prompt=Set%20up%20online%20scoring%20to%20watch%20for%20the%20problem%20we%20just%20fixed.%0A%0A%23%23%20Check%20the%20scorer%0A%0A-%20Check%20whether%20our%20eval%20scorer%20can%20score%20production%20traces%20without%20dataset-only%20expected%20outputs.%0A-%20If%20it%20can't%2C%20create%20a%20separate%20production%20scorer%20using%20evidence%20available%20in%20the%20trace.%20Preserve%20the%20eval%20scorer.%20Explain%20any%20difference%20in%20what%20the%20production%20scorer%20can%20verify%2C%20and%20don't%20invent%20missing%20reference%20data.%0A-%20Test%20the%20production%20scorer%20on%20known%20failing%20and%20successful%20traces.%20If%20the%20traces%20lack%20the%20evidence%20needed%20to%20judge%20this%20behavior%2C%20explain%20what%20the%20app%20must%20log%20before%20proceeding.%0A%0A%23%23%20Create%20the%20rule%0A%0A-%20Create%20an%20online%20scoring%20rule%20in%20the%20same%20Braintrust%20project.%20Choose%20a%20scope%20that%20supplies%20the%20context%20the%20scorer%20needs%2C%20and%20filter%20to%20identifiable%20test%20requests%20relevant%20to%20this%20problem.%0A-%20Use%20100%25%20sampling%20for%20these%20test%20requests.%20Leave%20the%20rule%20paused%20for%20review%2C%20and%20explain%20how%20to%20generate%20requests%20that%20match%20the%20filter.%0A-%20Link%20to%20the%20scorer%20and%20rule%2C%20report%20the%20test%20results%2C%20and%20explain%20the%20scope%20and%20filter.%20If%20any%20settings%20need%20to%20be%20configured%20in%20the%20UI%2C%20give%20me%20the%20exact%20steps.)

   Production traces usually lack expected outputs. If your eval scorer requires them, your agent will create and test a separate version that uses the evidence in the trace.

2. Open the rule in ** Settings** > [** Online scoring**](https://www.braintrust.dev/app/~/configuration/automations/online-scoring) and review its settings:

   * **Scope:** Use **Trace** when the scorer needs the whole request, or **Span** for an individual LLM or tool call. For conversations across multiple traces, see [Group scope](https://docs.braintrust.dev/evaluate/score-online.md#configuration-parameters).
   * **Filter:** Limit scoring to identifiable test requests relevant to this problem.
   * **Sampling rate:** Use 100% so every matching test request is selected for scoring.

3. Use **Test automation** to check scores on a failing and a successful trace.

4. Turn on **Enabled** and generate a few requests that match the test filter. Open their traces in [** Logs**](https://www.braintrust.dev/app/~/logs) to inspect the scores. For **Trace** scope, allow for the idle timeout, 30 seconds by default, and scorer execution.

   ![A trace showing an online scoring rule and its scorer's result.](https://mintcdn.com/braintrust/C77HIPSuOnNchzPV/images/evaluate/online-score-in-trace.png?fit=max\&auto=format\&n=C77HIPSuOnNchzPV\&q=85\&s=67ae3960bc468d65ee60ae2ab9be75b6)

5. Once scoring works, update the filter to cover production requests relevant to this problem and choose a sampling rate that fits your traffic and budget. Start with 10% for higher-volume traffic. LLM judges make model calls for each scored request.

## Get alerted when scores drop

[Alerts](https://docs.braintrust.dev/observe/alerts.md) notify your team when scores suggest the problem may be returning.

1. Ask Loop or your coding agent to recommend alert settings and create the alert:

   ```text wrap theme={null}
   Review the production scorer's scale, recent scores, and traffic volume. Recommend a threshold and time window for an alert about this problem, and explain why. Confirm the Slack channel with me, then create the alert using the agreed settings. Link to the alert and explain how to test its delivery.
   ```

   [Run in Loop](https://www.braintrust.dev/app/~/loop?prompt=Review%20the%20production%20scorer's%20scale%2C%20recent%20scores%2C%20and%20traffic%20volume.%20Recommend%20a%20threshold%20and%20time%20window%20for%20an%20alert%20about%20this%20problem%2C%20and%20explain%20why.%20Confirm%20the%20Slack%20channel%20with%20me%2C%20then%20create%20the%20alert%20using%20the%20agreed%20settings.%20Link%20to%20the%20alert%20and%20explain%20how%20to%20test%20its%20delivery.)

2. Follow the delivery test steps and confirm that the notification reaches the selected Slack channel. To configure the alert yourself, see [Create a time window alert](https://docs.braintrust.dev/observe/alerts.md#create-a-time-window-alert).

## Troubleshoot

> [accordion] Scores haven't appeared?
>
> Confirm that the rule is enabled and the new requests match its filter. At sampling rates below 100%, some requests won't receive a score. For testing, use 100% sampling with a filter limited to your test traffic.
>
> A trace-scoped rule waits until the trace has been idle for its **Idle timeout**, 30 seconds by default, before running the scorer. Allow time for the scorer to finish, then check [rule activity](https://docs.braintrust.dev/evaluate/score-online.md#monitor-rule-activity) for errors.

## Next steps

Use new scores and traces to check whether the problem declines. As Patterns finds other issues, add new failures to your dataset and repeat the workflow to strengthen your tests and monitoring.

> [card] [Explore more capabilities](https://docs.braintrust.dev/quickstart-next-steps.md)
>
> Choose what to try next with Loop, playgrounds, human review, and more.


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