Let’s Get Certified
Module 09 / 15 · Application development

Trace and route an agent across knowledge sources

Use MLflow traces, offline evaluation, live monitoring and a governed Genie specialist.

Trace and route an agent across knowledge sources

Work through the decision

A maintenance question asks for the policy and the total labor cost last quarter. The document assistant gives a plausible currency amount with no query behind it. Which specialist should own that part?

Check your reasoning

Route the policy portion to an authorized document retriever and the numerical portion to a curated Genie space or its conversational API. Carry a precise fiscal-period definition and the caller’s effective privileges. Attach evidence for each part before composing the final answer.

Watch the source lesson at 1:01:30

Compare the choices

MLflow trace
Follow spans within one request, including tool calls, retrieval and model outputs, under appropriate access and retention controls.
Genie specialist
Use governed structured data and vetted business definitions for quantitative questions. Preserve filters, audience and execution permissions.
Offline evaluation
Score a fixed representative dataset before promotion. Preserve reference outputs, configurations and per-case outcomes.
Production monitoring
Observe real traffic and track drift, quality, latency, errors and cost over time. Investigate with governed samples.

Test the decision

Use trace spans to inspect routing, tool inputs and outputs, and generation. Offline evaluation checks a controlled case before release. Live monitoring detects changes in real usage. Move representative production failures into the regression suite after privacy review and adjudication.

Inspect a nested MLflow trace

In a Databricks notebook with MLflow 3.1 or later and an experiment selected, trace the route decision separately from the parent request. Start with a synthetic request. By default, tracing records function inputs and outputs, so decide which fields are appropriate to capture before enabling it on user data.

Databricks · manual and custom tracing

Instrument a routing decision

import mlflow

@mlflow.trace
def choose_route(has_order_id):
    return "order_lookup" if has_order_id else "policy_search"

@mlflow.trace
def handle_request(request):
    return {"route": choose_route(bool(request.get("order_id")))}

print(handle_request({"order_id": "DEMO-17"}))
Check the result

The response names order_lookup. The parent span calls a child span for choose_route. Repeat with an empty dictionary and compare those spans. A wrong route can be diagnosed before changing retrieval or generation settings.

Practice the guide skills

  1. A multi-stage application answers incorrectly after a tool call. Watch 1:01:30 · Continue at 1:02:38
    Check your answer

    Use MLflow traces and Agent Framework integration to capture the request, retrieval and tool spans, their outputs and the final response under suitable data controls. Version the logged application before comparison.

  2. When should offline evaluation give way to live monitoring? Watch 1:05:00 · Continue at 1:06:17
    Check your answer

    Run repeatable labeled cases before promotion. After release monitor real traffic, latency, error and quality signals and send representative failures through the offline suite again.

  3. A question asks for last quarter’s actual repair cost as well as policy text. Watch 1:03:38 · Continue at 1:03:48
    Check your answer

    Route the governed numerical question to a curated Genie space or its conversational API and the policy part to a document specialist. Preserve caller permissions, time filters and source provenance when composing the response.

Official objectives for this lesson

Related lesson · Benchmark a Genie agent against trusted answers

Knowledge check

Trace and route an agent across knowledge sources quiz

Answer 3 questions. Check each answer for an explanation.