Application Development · Topic 4 of 4

Agent Frameworks, MLflow and Genie in Multi Agent Systems

Databricks GenAI Engineer: choose LangChain style tools, build agents with MLflow and Agent Framework, evaluation vs monitoring, Genie as a data agent.

  • 5 min
In a nutshell
  • LangChain for simple chains, LangGraph for stateful or multi agent flows.
  • Wrap custom agents in ResponsesAgent; log them as code with their resources.
  • Set the registry URI to databricks-uc and register as catalog.schema.model.

What it is

An agent is an application in which the LLM decides which tools to call, such as a retriever, a Unity Catalog function or a Genie space, and in which order. Open source libraries such as LangChain and LangGraph supply the building blocks.

Mosaic AI Agent Framework and MLflow 3 turn that code into something you can trace, evaluate, log to Unity Catalog and deploy. A multi agent system adds a supervisor that routes each question to a specialist, for example a Genie space for questions over tables.

User questionSupervisor agentroutesGenie agentSQL over tablesAnswerSupervisor agentroutesRetriever agentdocumentsAnswer

How it works

Choosing LangChain or a similar tool

NeedTypical choice
Simple prompt, retriever and LLM chainLangChain
Stateful, branching or multi agent workflowLangGraph
Document heavy RAG with many index and loader optionsLlamaIndex
Optimizing prompts programmaticallyDSPy
Plain Python with an SDK and your own toolsOpenAI Agents SDK or custom code
No code agent for a common patternAgent Bricks (Knowledge Assistant, Multiagent Supervisor, Information Extraction)

The databricks_langchain package connects LangChain to Databricks, for example ChatDatabricks for serving endpoints. MLflow traces these libraries through autologging, such as mlflow.langchain.autolog().

Choose Agent Bricks when the use case matches one of its patterns and speed matters. Choose a custom Agent Framework agent when you need your own logic, tools or framework.

Building with Agent Framework and MLflow

Databricks recommends wrapping a custom agent in the MLflow ResponsesAgent interface, which gives a standard chat request and response schema that works with the Review App, AI Playground and serving. The older ChatAgent interface still exists, but ResponsesAgent is the current recommendation.

The usual steps are:

StepMLflow feature
See each LLM call, tool call and retrievalTracing, through autolog or the @mlflow.trace decorator
Log the agent as code with its dependenciesmlflow.pyfunc.log_model with the agent file and resources
Register to Unity Catalogregistered_model_name="catalog.schema.model"
Version promptsPrompt Registry
Measure qualitymlflow.genai.evaluate with scorers
import mlflow
mlflow.set_registry_uri("databricks-uc")
info = mlflow.pyfunc.log_model(
    name="agent", python_model="agent.py",
    resources=resources,
    registered_model_name="main.support.support_agent")

The agent file ends with mlflow.models.set_model(agent), so MLflow logs the code itself (models from code). The resources list names the endpoints, indexes, functions and Genie spaces the agent uses, so the deployed agent can authenticate to them.

Tools come from Unity Catalog functions, whose COMMENT text becomes the tool description the LLM reads, or from MCP servers: managed MCP servers for Vector Search, Genie spaces and Unity Catalog functions, external MCP servers through connections, and custom MCP servers hosted as Databricks Apps.

Evaluation versus monitoring

EvaluationMonitoring
WhenDevelopment, before and between releasesProduction, after deployment
DataA curated evaluation set, often with ground truthLive traffic, no ground truth
Toolsmlflow.genai.evaluate, Review App labelingProduction traces, inference tables, scorers on sampled traffic
Question answeredIs this version good enough to ship?Is quality, cost or latency drifting?
JudgesGround truth judges such as Correctness, plus othersJudges that need no ground truth, such as Safety and RelevanceToQuery

The same scorers can run in both phases, which keeps the quality definition consistent. Bad production traces are added to the evaluation set, so each new version is tested on real failures.

Genie spaces in multi agent systems

A Genie space (shown as a Genie Agent in newer docs) turns natural language into SQL over a curated set of Unity Catalog tables. Agents use it in three ways:

MethodHow
LangGraph workerGenieAgent from databricks_langchain.genie, with the space ID
MCPThe managed MCP server for the Genie space
RESTThe Genie Conversation API, starting with POST /api/2.0/genie/spaces/{space_id}/start-conversation

Genie runs queries with the caller's Unity Catalog permissions, so the user or service principal needs access to the space and SELECT on its tables. Conversation context is kept by passing the returned conversation ID on the next call. For a no code setup, Agent Bricks Multiagent Supervisor (Supervisor Agent in newer docs, which mark it as legacy) coordinates Genie spaces with other agents.

How the exam asks about this

  • "A supervisor must answer sales figures from governed tables and policy questions from documents." Add a Genie space as the structured data worker and a retriever agent for documents.
  • "Find which tool call made a slow agent slow." Use MLflow Tracing.
  • "Detect quality drift in production where no reference answers exist." Run monitoring with judges that need no ground truth.

What to remember for the exam

  • LangChain for simple chains, LangGraph for stateful or multi agent flows.
  • Wrap custom agents in ResponsesAgent; log them as code with their resources.
  • Set the registry URI to databricks-uc and register as catalog.schema.model.
  • Evaluation is offline with an evaluation set; monitoring is on live traffic.
  • Genie gives agents governed SQL answers over tables through GenieAgent, MCP or the Conversation API.
  • Genie uses the caller's Unity Catalog permissions.
Watch out

Do not point an agent's retriever at raw tables to answer numeric business questions. Text retrieval cannot sum or filter rows reliably; a Genie space generates and runs SQL for that.

Common mistakes

Treating evaluation and monitoring as the same step. Evaluation compares versions before release on a fixed set. Monitoring watches live traffic for drift and feeds new cases back to evaluation.

Leaving out resources when logging. Without the resources list, the deployed agent cannot authenticate to its endpoints, indexes or Genie spaces.

Building a custom LangGraph agent for a standard pattern. If Agent Bricks Knowledge Assistant or Multiagent Supervisor fits, it is faster to build and tune, though newer docs mark both as legacy.

Check yourself

  • Which judges suit production monitoring?

    Judges that need no ground truth, such as Safety, RelevanceToQuery and guidelines judges, since live traffic has no expected answers.

  • How does a LangGraph supervisor use a Genie space?

    It adds a GenieAgent worker built with the space ID, which turns the question into SQL and returns the result.

  • Why log an agent with mlflow.models.set_model in the agent file?

    It marks the agent object for models from code logging, so MLflow stores the code rather than a pickled object.

Topic 4 of 4 in Application Development

Test yourself on Application Development

The full Databricks Generative AI Engineer Associate question bank has 600 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Databricks. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.