CertSafari
    Databricks Certified Generative AI Engineer Associate· Lessons

    Domain 6 · Lesson 52/56

    Agent Monitoring: scheduled scorers on production traces

    Use inference tables and Agent Monitoring to track a live LLM endpoint

    11 min read
    1.2% of exam
    2 sources
    Published 22 Oct 2026
    Docs as of 17 Oct 2026

    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.
    Register a built-in judge on the experiment, then start it on 70% of incoming tracespython
    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?

    Sources12

    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.

    Recommended sample_rate by scorer role
    Scorer rolesample_rateReason
    Critical checks such as safety and security1.0Every trace is checked
    Iterative improvement during development0.3-0.5Moderate coverage at moderate cost
    Expensive scorers such as complex LLM judges0.05-0.2Keeps 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.

    Score only successful traces with a filter_stringpython
    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.

    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?

    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))

    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.

    Store the monitoring SQL warehouse ID on the experimentpython
    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 @scorer functions 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 @scorer decorator functions. Class-based Scorer subclasses cannot be serialized for remote execution.
    • Leave out type hints that need an import, such as List from typing, because they break serialization.
    A custom scorer that serializes cleanly: inline imports, graceful handling of missing data, consistent return typepython
    @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?

    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?

    Sources1

    Practise it for real

    Put a live agent's Unity Catalog traces under continuous safety monitoring

    1. 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. 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. 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. 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. 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. 2.
      “It closes the loop — the same scorers you built during evaluation now watch production.”
      ↩︎ The register-then-start pattern

    Spotted a mistake, or was something unclear? Tell us.