What you will be able to do
- Register and start a scorer so that it continuously evaluates a live agent's traces
- Choose a sample_rate and filter_string that balance coverage against scoring cost
- Configure monitoring for traces stored in Unity Catalog with the right warehouse setting and permissions
- Write a custom scorer that the remote monitoring service can serialize and run
1.The register-then-start pattern
Agent Monitoring, which the MLflow 3 documentation calls production monitoring and which is currently in Beta, keeps judging a deployed agent's quality after launch. You schedule scorers against the MLflow experiment that receives the agent's traces. A monitoring service then evaluates a sample of new traces and attaches each result as feedback on that trace. The scorers can be the ones you used during development, described in MLflow scoring and tracing, so offline and production results are measured the same way.
The scoring runs separately from the endpoint. It is not part of the serving container, not tied to autoscaling, and not a pipeline you build over the inference table. The monitoring service runs in the background, reads traces from the experiment, and runs serialized copies of your scorers remotely. The agent's own response path does not change.
You need four things before you start:
- An MLflow experiment that receives traces. If you don't name one, the active experiment is used.
- A production agent instrumented with MLflow Tracing.
- Scorers already tested against your application's trace format.
- A serverless budget policy set on the experiment, if your workspace does not allow the default policy.
from mlflow.genai.scorers import Safety, ScorerSamplingConfig
# Register and start a built-in judge
safety_judge = Safety().register(name="safety")
safety_judge = safety_judge.start(sampling_config=ScorerSamplingConfig(sample_rate=0.7))This two-step pattern works the same for built-in judges, custom judges, code-based scorers and multi-turn judges. An experiment can have at most 20 scorers associated with it for continuous monitoring at any time. After scheduling, allow 15–20 minutes for initial processing. Then open the experiment's Traces tab to see assessments on individual traces, and use the monitoring dashboards for trends. A multi-turn judge scores a whole conversation, and its assessment is attached to the first trace in each session.
Checkpoint 1 of 5· Exam question
An ML engineer wants continuous quality monitoring for a live agent endpoint without paying the compute cost of scoring every single production interaction. They plan to use MLflow scorers on a recurring schedule against a subset of traffic. Which configuration approach matches this goal?
Correct answer: A — Register the scorers and start them with a ScorerSamplingConfig that sets sample_rate below 1.0, so only a configurable percentage of new traces are evaluated on each scheduled run
- A. Correct. Registering scorers and starting them with a
ScorerSamplingConfigwhosesample_rateis set below 1.0 lets the monitoring job evaluate only a configurable fraction of production traces on each scheduled pass, controlling cost. - B. Incorrect. Scorer scheduling is independent of endpoint autoscaling; there is no mechanism that ties trace evaluation to scale-up events, and doing so would leave low-traffic periods completely unmonitored.
- C. Incorrect. Rescoring the entire inference table every night evaluates 100% of traffic rather than a sampled subset, which defeats the stated goal of reducing the compute cost of exhaustive scoring.
- D. Incorrect. There is no
batch_modeflag that runs scorers inline inside the serving container; production monitoring scorers run as a separate scheduled job against logged traces, not synchronously during inference.
2.Sampling rates and filter strings
sample_rate sets the cost of a scorer. It is the fraction of incoming traces that the scorer evaluates. An LLM judge at 1.0 runs one judge call for every production interaction, while 0.1 evaluates a tenth of them and still shows the trend. The recommended rate depends on what the scorer protects against, not on how much traffic there is.
| Scorer role | sample_rate | Reason |
|---|---|---|
| Critical checks such as safety and security | 1.0 | Every trace is checked |
| Iterative improvement during development | 0.3-0.5 | Moderate coverage at moderate cost |
| Expensive scorers such as complex LLM judges | 0.05-0.2 | Keeps judge compute affordable |
filter_string limits which traces are eligible before sampling is applied. It uses the same syntax as mlflow.search_traces(), and you can combine conditions with AND, for example successful traces newer than a timestamp. A common use is to score only traces that completed, so judges don't spend calls on requests that errored.
from mlflow.genai.scorers import Safety, ScorerSamplingConfig
# Only evaluate traces that completed successfully
safety_judge = Safety().register(name="safety")
safety_judge = safety_judge.start(
sampling_config=ScorerSamplingConfig(
sample_rate=1.0,
filter_string="attributes.status = 'OK'"
),
)If no feedback appears, check these three causes in order. First, make sure traces are logged to the experiment and not to individual runs. Second, at a low sample rate, results can take a while to appear. Third, make sure the filter string actually matches real traces. A filter on an attribute value your agent never produces silently selects nothing.
Run the PII check at 1.0, because it is a critical safety-style check and costs almost nothing. Run the helpfulness judge somewhere in 0.05–0.2, because it is an expensive LLM judge and a small sample is enough to show a quality trend.
Checkpoint 2 of 5· Check yourself
Two hours after starting a Safety judge with sample_rate=1.0 and a filter_string, the experiment's Traces tab shows plenty of new production traces, but none of them carry Safety feedback. What is the most likely cause?
filter_string decides which traces are eligible before sampling is applied. If it filters on an attribute value the agent never produces, it selects nothing and you get no error. A rate of 1.0 is the recommended setting for critical checks like safety, and filter_string only borrows the search_traces() syntax. It does not need a separate call.
“Verify filter string: Ensure your filter_string matches actual traces.”Source: docs.databricks.com
Checkpoint 3 of 5· Fill the gap
This code registers the Safety judge and then starts it on 70% of incoming production traces. Which parameter of ScorerSamplingConfig sets that fraction?
from mlflow.genai.scorers import Safety, ScorerSamplingConfig
# Register and start a built-in judge
safety_judge = Safety().register(name="safety")
safety_judge = safety_judge.start(sampling_config=ScorerSamplingConfig( ? =0.7)).start() takes a ScorerSamplingConfig, and its sample_rate sets the share of new traces the monitoring service scores. sampling_fraction is an inference table column that records down-sampling. It is not a scorer setting.
Sources1
3.Unity Catalog traces and custom scorers
If your traces are stored in Unity Catalog, the monitoring job reads them by running queries through a SQL warehouse. It needs that warehouse ID before you register any scorers. Without it, jobs fail with an error saying the mlflow.monitoring.sqlWarehouseId tag is missing. Set the ID with set_databricks_monitoring_sql_warehouse_id(), which saves it as a tag on the experiment.
from mlflow.tracing import set_databricks_monitoring_sql_warehouse_id
# Set the SQL warehouse ID for monitoring
set_databricks_monitoring_sql_warehouse_id(
sql_warehouse_id="<SQL_WAREHOUSE_ID>",
experiment_id="<EXPERIMENT_ID>" # Optional, uses active experiment if not specified
)Setting MLFLOW_TRACING_SQL_WAREHOUSE_ID in your notebook looks like it should work, but it does not. An environment variable applies only to the process that sets it, and the monitoring job runs in a separate process that reads the experiment tag. Monitoring Unity Catalog traces also requires CAN USE on the warehouse and CAN EDIT on the experiment. Permission on the monitoring job is granted automatically when the first scorer is registered. The job runs as the user who registered the first scorer, so that person's access determines what monitoring can read. Have a person or service principal with stable access register the first scorer, not someone whose access may be revoked.
Custom scorers are serialized and run remotely, which adds rules that offline evaluation does not have:
- Define and register custom
@scorerfunctions from a Databricks notebook, because serialization relies on the notebook environment. - Put every import inside the function body. Variables, modules and objects defined outside the function are not captured.
- Use only
@scorerdecorator functions. Class-basedScorersubclasses cannot be serialized for remote execution. - Leave out type hints that need an import, such as
Listfromtyping, because they break serialization.
@scorer
def well_designed_scorer(inputs, outputs):
# All imports inside the function
import re
import json
# Handle missing data gracefully
response = outputs.get("response", "")
if not response:
return 0.0
# Return consistent types
return float(len(response) > 100)Checkpoint 4 of 5· Check yourself
Your agent's traces are stored in Unity Catalog. A teammate set MLFLOW_TRACING_SQL_WAREHOUSE_ID in their notebook, then registered and started a Safety scorer. The monitoring jobs fail with an error saying the mlflow.monitoring.sqlWarehouseId tag is missing. What fixes this?
An environment variable applies only to the process that sets it. The monitoring job runs separately and reads the warehouse ID from the mlflow.monitoring.sqlWarehouseId experiment tag, and set_databricks_monitoring_sql_warehouse_id() writes that tag. Permissions and the registering identity matter too, but neither one supplies the missing tag.
“It applies only to the process where you set it. The monitoring job runs separately and reads the warehouse ID from the experiment tag.”Source: docs.databricks.com
Checkpoint 5 of 5· Check yourself
During development you evaluated your agent with a custom class MyScorer(Scorer) that defines __call__, and it works in mlflow.genai.evaluate(). Now you want the same check to run on production traces. What do you need to do?
Production monitoring serializes custom scorers and runs them remotely. Only @scorer decorator functions can be serialized, and they must include their own imports. Notebooks are required for this, not a problem, and imports placed outside the function are not captured.
“Only @scorer decorator-based scorers can be registered. Class-based Scorer subclasses cannot be serialized for remote execution.”Source: docs.databricks.com
Sources1
Practise it for real
Put a live agent's Unity Catalog traces under continuous safety monitoring
1.In a Databricks notebook, call set_databricks_monitoring_sql_warehouse_id() with your warehouse ID and the experiment that receives the agent's traces.
Why: Monitoring of Unity Catalog traces queries through a SQL warehouse, and the separate monitoring job reads its ID from the experiment tag.
You should see: The experiment has an mlflow.monitoring.sqlWarehouseId tag.
2.Register the built-in judge with Safety().register(name="safety").
Why: Registration attaches the scorer to the experiment and grants you permission on the monitoring job.
You should see: A scorer named safety is associated with the experiment, and nothing is scored yet.
3.Call .start(sampling_config=ScorerSamplingConfig(sample_rate=1.0, filter_string="attributes.status = 'OK'")).
Why: Safety is a critical check, so it gets full coverage, and the filter skips traces that errored.
You should see: Monitoring is active for successful traces.
4.Send a few requests to the agent, wait 15–20 minutes, then open the experiment's Traces tab.
Why: Initial processing takes 15–20 minutes, and results are attached as feedback on each trace.
You should see: Safety assessments appear on new traces with status OK.
Stuck? Get a nudge
If nothing appears, check whether traces are going to the experiment or to individual runs, and whether the filter string matches any real trace.
Sources
(2)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“You schedule scorers against an MLflow experiment, and the monitoring service evaluates a configurable sample of incoming traces.”
↩︎ The register-then-start pattern“This same two-step pattern works for any scorer type: built-in judges, custom judges, code-based scorers, and multi-turn judges.”
↩︎ The register-then-start pattern“At any given time, at most 20 scorers can be associated with an experiment for continuous quality monitoring.”
↩︎ The register-then-start pattern“For multi-turn judges, assessments are attached to the first trace in each session.”
↩︎ The register-then-start pattern“For expensive scorers, such as complex LLM judges, use lower sample rates (0.05-0.2).”
↩︎ Sampling rates and filter strings“This uses the same filter syntax as mlflow.search_traces().”
↩︎ Sampling rates and filter strings“Ensure that traces are logged to the experiment, not to individual runs.”
↩︎ Sampling rates and filter strings“The monitoring job runs under the identity of the user who first registered a scorer on the experiment.”
↩︎ Unity Catalog traces and custom scorers“All imports must be inline within the function body.”
↩︎ Unity Catalog traces and custom scorers“Custom @scorer functions must be defined and registered from a Databricks notebook.”
↩︎ Unity Catalog traces and custom scorers“The monitoring job runs separately and reads the warehouse ID from the experiment tag.”
↩︎ Exam trap 1“Class-based Scorer subclasses cannot be serialized for remote execution.”
↩︎ Exam trap 2“Register a scorer with your experiment, then start it with a sampling configuration using the .register() and .start() pattern:”
↩︎ Exam trap 3“Monitoring begins the moment you start a scorer.”
↩︎ Prediction“Verify filter string: Ensure your filter_string matches actual traces.”
↩︎ Checkpoint“It applies only to the process where you set it. The monitoring job runs separately and reads the warehouse ID from the experiment tag.”
↩︎ Checkpoint“Only @scorer decorator-based scorers can be registered. Class-based Scorer subclasses cannot be serialized for remote execution.”
↩︎ Checkpoint - 2.
“It closes the loop — the same scorers you built during evaluation now watch production.”
↩︎ The register-then-start pattern