Tracing overview

Tip

Optionally, install mlflow/skills for a deeper integration with MLflow.

MLflow Tracing is the observability foundation for GenAI development on Azure Databricks. AI agents run complex, multi-step workflows that combine components such as LLMs, retrievers, tools, and sub-agents. Tracing records the inputs, outputs, latency, token usage, and cost of every intermediate step, mapping the full execution flow so you can see exactly how your agent behaves and identify causes for issues. Tracing is the foundational data layer for agent quality. Debugging, evaluation, and production monitoring all build on the evidence your traces capture.

The Traces tab in the Databricks MLflow UI.

Tracing lets you:

  • Debug and understand your agent.

  • Monitor performance and optimize cost.

  • Monitor production agents.

  • Evaluate and improve agent quality.

Why MLflow Tracing on Azure Databricks

  • The same open-source MLflow, fully managed. You use the standard MLflow SDK and OpenTelemetry — with no tracking server to run and no version to maintain yourself.
  • One platform from development to production. The same traces power debugging, evaluation, and production monitoring, and plug into the rest of the Lakehouse — AI/BI dashboards, alerts, and Lakeflow pipelines.

Get your first trace

Install MLflow and the libraries for the example agent:

%pip install --upgrade "mlflow[databricks]>=3.1.0" "langgraph" "langchain-openai"
dbutils.library.restartPython()

Set an OPENAI_API_KEY so the agent can call a model to avoid an external key:

import os

os.environ["OPENAI_API_KEY"] = "your-api-key"

Run this agent. Autologging captures a trace with a span for each step:

import mlflow
from langchain_core.tools import tool
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent

mlflow.langchain.autolog()  # LangGraph uses LangChain's autolog
mlflow.set_tracking_uri("databricks")
mlflow.set_experiment("/Shared/my-first-trace")

@tool
def get_weather(city: str):
    """Get weather for a city."""
    return f"It might be cloudy in {city}"

agent = create_react_agent(ChatOpenAI(model="gpt-4o-mini"), [get_weather])
agent.invoke({"messages": [("user", "What is the weather in SF?")]})
# Trace appears in the MLflow UI automatically

To view the trace:

  1. In your workspace, go to Experiments.

  2. Find the experiment — here, the one set by mlflow.set_experiment("/Shared/my-first-trace").

  3. Click the Traces tab to see the trace.

  4. Open the trace to see the full span tree (agent → LLM call → tool call).

A trace opened in the MLflow UI, showing its span tree, inputs and outputs, and assessments.

Next steps