Databricks AI Agents

An AI agent is a program that uses a language model to decide what to do next. The agent reads a request, chooses a tool, reads the tool's result, and repeats the loop until it can give a final answer. Agents handle tasks that need several steps, such as checking an order, calculating a refund, and drafting a reply.

The Personal Assistant Analogy

A plain language model resembles a friend who answers questions from memory. An agent resembles a capable assistant with a phone, a calendar, and access to company records. When you ask the assistant to rebook a delayed delivery, the assistant looks up the order, checks the schedule, and reports back. The language model acts as the brain, and the tools act as the hands.

THE AGENT LOOP
──────────────────────────────────────────────────────────
User request
     │
     ▼
┌──────────────────┐   needs info    ┌──────────────┐
│ Language model   │ ──────────────► │ Call a tool  │
│ (decides)        │ ◄────────────── │ (look up,    │
└──────────────────┘   tool result   │  calculate)  │
     │                               └──────────────┘
     │ enough information
     ▼
Final answer

Parts of an Agent

Language Model

The model reads the request and decides which tool to use.

Tools

A tool is a function that performs one action, such as a database lookup, a calculation, or a document search. Retrieval over a vector index counts as a tool.

Instructions

A system prompt describes the agent's role, limits, and tone.

Memory

Conversation history gives the agent context about earlier messages.

Build Tools with Unity Catalog Functions

Databricks lets you register tools as Unity Catalog functions. A function carries a description that tells the model when to use it, and Unity Catalog permissions control who can run it.

CREATE OR REPLACE FUNCTION main.tools.get_order_status(order_id BIGINT)
RETURNS STRING
COMMENT 'Returns the delivery status for a given order number.'
RETURN (
  SELECT status
  FROM main.shop.orders
  WHERE orders.order_id = get_order_status.order_id
  LIMIT 1
);

The COMMENT line matters. The model reads that description to decide whether the function fits the user's request.

Agent Framework Workflow

FROM IDEA TO LIVE AGENT
──────────────────────────────────────────────────────────
1. Define tools          (Unity Catalog functions, vector search)
2. Write the agent       (model + tools + instructions)
3. Log with MLflow       (version the agent and its settings)
4. Evaluate              (test questions with approved answers)
5. Deploy                (Model Serving endpoint)
6. Monitor               (traces, feedback, cost)

Tracing: See Every Step

MLflow Tracing records each model call and tool call inside an agent run. A trace shows the question, the chosen tool, the tool result, and the final answer. Developers read traces to find where an agent went wrong, such as picking the wrong tool or misreading a result.

SAMPLE TRACE
──────────────────────────────────────────────────────────
Step 1  User: "Where is order 4521?"
Step 2  Model chooses tool: get_order_status
Step 3  Tool returns: "Out for delivery"
Step 4  Model writes: "Order 4521 is out for delivery today."

Single Agent and Multi-Agent Designs

A single agent handles all tools and suits small projects. A multi-agent design assigns separate agents to separate domains, such as billing, shipping, and returns, and a supervisor routes each request to the right specialist. Specialists stay simple, and teams test each one on its own.

MULTI-AGENT DESIGN
──────────────────────────────────────────────────────────
              Supervisor agent
          ┌─────────┼──────────┐
          ▼         ▼          ▼
     Billing     Shipping    Returns
      agent       agent       agent

Safety Rules for Agents

  • Give each agent the smallest set of tools that its job requires.
  • Use read-only tools for lookups, and require approval for actions that change data or spend money.
  • Limit the number of steps an agent can take in one run.
  • Keep a human reviewer for sensitive decisions.
  • Log every tool call for later audit.

Evaluate Agents

Create a set of realistic requests with expected outcomes. Score each run for correct tool choice, correct final answer, and safe behavior. Run the same set again after each change. Agents can behave differently from one run to the next, so repeat important tests several times.

MeasureWhat It Reveals
Tool selectionWhether the agent picks the right tool
Answer qualityWhether the final reply is correct and clear
Step countWhether the agent wastes effort
SafetyWhether the agent respects its limits

Example: Delivery Help Agent

A delivery company builds an agent for its help chat. One tool looks up order status. A second tool searches the shipping policy. A third tool creates a support ticket for a human when the agent cannot solve the problem. Customers ask a question, and the agent answers in a few seconds or hands the case to a person.

DELIVERY HELP AGENT
──────────────────────────────────────────────────────────
Customer: "My parcel is late. What can I do?"
      │
      ├── Tool 1: get_order_status      → "Delayed by weather"
      ├── Tool 2: search_policy         → "Refund after 5 days"
      └── Reply: "Your parcel is delayed by weather. You can request
                 a refund if it arrives after 5 days."

Key Points

  • An agent uses a language model to choose tools and complete multi-step tasks.
  • Unity Catalog functions and vector search act as governed tools.
  • The Agent Framework supports logging, evaluation, deployment, and monitoring.
  • MLflow Tracing records every step for debugging.
  • Multi-agent designs split work across specialist agents.
  • Limited tools, approvals, and human review keep agents safe.