Multi-Agent System
Overview
Section titled “Overview”Build a multi-agent customer service system where a Supervisor Agent intelligently routes questions between a Genie Space (for SQL-based data queries) and a Knowledge Assistant (for document-based policy answers). Deploy the system behind a Gradio chat interface on Databricks Apps.
Skills used: databricks-genie, databricks-agent-bricks, databricks-model-serving, databricks-app-python
MCP tools used: create_or_update_genie, manage_ka, manage_mas, query_serving_endpoint, create_or_update_app
Prerequisites
Section titled “Prerequisites”- A Databricks workspace with Unity Catalog and Model Serving enabled
- Tables for the Genie Space (e.g.
main.sales.transactions,main.sales.customers) - PDF or text documents for the Knowledge Assistant (e.g. company policies in a Volume)
- A SQL warehouse for Genie Space queries
-
Create a Genie Space for data queries
Set up the SQL-based agent that handles product, order, and revenue questions.
Create a Genie Space called "Sales Explorer" that connects tomain.sales.transactions and main.sales.customers with sample questions:"What was total revenue last month?", "Who are our top 10 customers?","Show monthly revenue trends". -
Create a Knowledge Assistant for documents
Set up the RAG-based agent that handles policy and FAQ questions.
Create a Knowledge Assistant that answers questions about our company'spolicies using documents stored in /Volumes/main/support/policy_docs/.Add instructions to always cite the specific document and section inits answers. -
Build a Supervisor Agent
Create the orchestration layer that routes questions to the right specialist.
Create a Supervisor Agent that routes questions to:1. A "Sales Analyst" Genie Space for revenue, order, and customer questions2. A "Policy Assistant" Knowledge Assistant for company policy, HR, andFAQ questionsGive the supervisor instructions to identify the question type before routing,and to combine information from both agents when a question spans both domains. -
Verify the agent endpoint
Test the Supervisor Agent is online and routing correctly.
Check the status of my Supervisor Agent endpoint. Once it's online, test itwith these questions:- "What was our top-selling product last quarter?" (should route to Genie)- "What is our return policy?" (should route to KA)- "How do refunds affect our revenue numbers?" (should use both) -
Deploy as a Gradio chat app
Build a user-friendly chat interface for the multi-agent system.
Build a Gradio app on Databricks that provides a chat interface to mySupervisor Agent endpoint. Include:- A chat window with message history- An indicator showing which agent is answering each question- A sidebar with suggested questions for each agent type
What You Get
Section titled “What You Get”- Genie Space that converts natural language to SQL against your sales tables
- Knowledge Assistant that answers questions from your policy documents with citations
- Supervisor Agent that intelligently routes questions to the right specialist
- Gradio app with a chat UI deployed on Databricks Apps
Next Steps
Section titled “Next Steps”- Add MLflow Evaluation to measure routing accuracy and answer quality
- Expand with additional agents: a Model Serving endpoint for product recommendations
- Store conversation history in Lakebase for analytics
- Use Vector Search for a custom embedding index with more control over retrieval