Building AI Agents with the Mosaic AI Agent Framework

    Who this is for:

    Architecture / Concept Overview: Building AI Agents with the Mosaic AI Agent Framework

    An AI agent orchestrates an LLM, retrieval sources, and tool calls in a reasoning loop to accomplish user tasks.

    %%{init: {"theme":"base","themeVariables":{"background":"#0B0E14","primaryTextColor":"#E0E6ED","lineColor":"#5D6470","darkMode":true,"primaryColor":"#2E4A4A","secondaryColor":"#374151","secondaryTextColor":"#E0E6ED","tertiaryColor":"#111827","tertiaryTextColor":"#E0E6ED","edgeLabelBackground":"#1f2937"}}}%% flowchart LR classDef source fill:#3F4B59,stroke:#9CA3AF,stroke-width:2px,rx:8,ry:8,color:#E0E6ED classDef ingestion fill:#5A4B36,stroke:#C9A86B,stroke-width:2px,rx:8,ry:8,color:#E0E6ED classDef processing fill:#535072,stroke:#8E82B4,stroke-width:2px,rx:8,ry:8,color:#E0E6ED classDef storage fill:#2E4A4A,stroke:#5FAFA8,stroke-width:2px,rx:8,ry:8,color:#E0E6ED classDef serving fill:#3D5550,stroke:#6BB7AA,stroke-width:2px,rx:8,ry:8,color:#E0E6ED classDef governance fill:#5A3F52,stroke:#C28BB0,stroke-width:2px,rx:8,ry:8,color:#E0E6ED USER[User Query] -->|Input| AGENT[Agent Orchestrator] AGENT -->|Reason| LLM[Foundation Model] AGENT -->|Retrieve| VS[Vector Search - RAG] AGENT -->|Call| TOOLS[Unity Catalog Functions] AGENT -->|Guard| GUARD[Guardrails] LLM -->|Plan| AGENT VS -->|Context| AGENT TOOLS -->|Results| AGENT AGENT -->|Response| USER_OUT[User Response] USER:::source AGENT:::processing LLM:::serving VS:::storage TOOLS:::ingestion GUARD:::governance USER_OUT:::source

    *Agent architecture: the orchestrator loops through reasoning, retrieval, and tool execution to produce a grounded response.*

    %%{init: {"theme":"base","themeVariables":{"background":"#0B0E14","primaryTextColor":"#E0E6ED","lineColor":"#5D6470","darkMode":true,"primaryColor":"#2E4A4A","secondaryColor":"#374151","secondaryTextColor":"#E0E6ED","tertiaryColor":"#111827","tertiaryTextColor":"#E0E6ED","edgeLabelBackground":"#1f2937"}}}%% graph TD classDef source fill:#3F4B59,stroke:#9CA3AF,stroke-width:2px,rx:8,ry:8,color:#E0E6ED classDef ingestion fill:#5A4B36,stroke:#C9A86B,stroke-width:2px,rx:8,ry:8,color:#E0E6ED classDef processing fill:#535072,stroke:#8E82B4,stroke-width:2px,rx:8,ry:8,color:#E0E6ED classDef storage fill:#2E4A4A,stroke:#5FAFA8,stroke-width:2px,rx:8,ry:8,color:#E0E6ED classDef serving fill:#3D5550,stroke:#6BB7AA,stroke-width:2px,rx:8,ry:8,color:#E0E6ED classDef governance fill:#5A3F52,stroke:#C28BB0,stroke-width:2px,rx:8,ry:8,color:#E0E6ED LIFECYCLE[Agent Lifecycle] --> BUILD[Build] LIFECYCLE --> EVAL[Evaluate] LIFECYCLE --> DEPLOY[Deploy] LIFECYCLE --> MONITOR[Monitor] BUILD --> DEFINE[Define Tools & Retrieval] BUILD --> PROMPT_ENG[Prompt Engineering] BUILD --> TEST_LOCAL[Local Testing] EVAL --> EVAL_SET[Evaluation Dataset] EVAL --> METRICS[Quality Metrics] EVAL --> REVIEW[Human Review App] DEPLOY --> LOG_MODEL[Log to MLflow] DEPLOY --> SERVE_EP[Serving Endpoint] MONITOR --> TRACES[Inference Traces] MONITOR --> FEEDBACK[User Feedback] LIFECYCLE:::governance BUILD:::processing EVAL:::storage DEPLOY:::serving MONITOR:::ingestion DEFINE:::source PROMPT_ENG:::source TEST_LOCAL:::source EVAL_SET:::source METRICS:::source REVIEW:::source LOG_MODEL:::source SERVE_EP:::source TRACES:::source FEEDBACK:::source

    *Agent lifecycle: build, evaluate, deploy, and monitor.*

    Key Terms

    Prerequisites and Setup

    • Databricks workspace with Unity Catalog and Model Serving.
    • databricks-agents Python package.
    • Foundation Model APIs enabled.
    • Vector Search endpoint for RAG tools.

    Step-by-Step Implementation

      Configuration Reference

      Building AI Agents with the Mosaic AI Agent Framework configuration options
      ParameterDefaultDescription
      model_endpointFoundation model serving endpoint name
      max_tokens500Maximum response tokens
      temperature0.1Low temperature for consistent agent responses
      num_results (retriever)3Documents retrieved per query
      max_iterations5Maximum reasoning loop iterations

      Monitoring, Cost, and Security Considerations

      Common Pitfalls and Recommended Patterns

        Frequently Asked Questions