Complete guide for deploying the multi-agent system to Databricks Model Serving.
This guide covers deploying both the ETL pipeline and the agent system to Databricks.
ETL must be deployed and run before deploying the agent system.
Options:
See ETL Deployment section below.
After ETL completes, deploy the agent to Model Serving.
See Agent Deployment section below.
Setup:
# 1. Upload ETL notebooks to Databricks workspace
databricks workspace import-dir etl /Workspace/etl --overwrite
# 2. Create job configuration
# Use config/jobs/job_config_etl.json as template
# 3. Create job via CLI or UI
databricks jobs create --json-file config/jobs/job_config_etl.json
# 4. Run job
databricks jobs run-now --job-id <job-id>
Job Configuration (config/jobs/job_config_etl.json):
{
"name": "Multi-Agent ETL Pipeline",
"tasks": [
{
"task_key": "export_genie_spaces",
"notebook_task": {
"notebook_path": "/Workspace/etl/01_export_genie_spaces"
}
},
{
"task_key": "enrich_metadata",
"depends_on": [{"task_key": "export_genie_spaces"}],
"notebook_task": {
"notebook_path": "/Workspace/etl/02_enrich_table_metadata"
}
},
{
"task_key": "build_vector_index",
"depends_on": [{"task_key": "enrich_metadata"}],
"notebook_task": {
"notebook_path": "/Workspace/etl/03_build_vector_search_index"
}
}
]
}
For one-time setup or testing:
01_export_genie_spaces.py02_enrich_table_metadata.py03_build_vector_search_index.pyAfter ETL completes, verify:
-- Check enriched metadata table
SELECT COUNT(*) FROM {catalog}.{schema}.enriched_genie_docs;
-- Check chunks table
SELECT COUNT(*) FROM {catalog}.{schema}.enriched_genie_docs_chunks;
-- Check vector search index
-- Go to UI: Compute → Vector Search → Check index status
Before deploying the agent:
# 1. Sync agent code to Databricks
databricks workspace import-dir src/multi_agent /Workspace/src/multi_agent --overwrite
# 2. Upload notebooks
databricks workspace import notebooks/deploy_agent.py /Workspace/notebooks/deploy_agent
databricks workspace import notebooks/agent.py /Workspace/notebooks/agent
# 3. Update prod_config.yaml
# Edit prod_config.yaml with production values:
# - Production Genie space IDs
# - Production SQL Warehouse ID
# - Production Lakebase instance
# - Production LLM endpoints
# 4. Upload configuration
databricks workspace upload prod_config.yaml /Workspace/prod_config.yaml
Open notebooks/deploy_agent.py in Databricks
prod_config.yaml pathThe deployment notebook does:
# Key deployment code (around line 5627)
logged_agent_info = mlflow.pyfunc.log_model(
name="super_agent_hybrid_with_memory",
python_model="./agent.py", # MLflow wrapper
code_paths=["../src/multi_agent"], # 🎯 Packages modular code
input_example=input_example,
resources=resources, # All Databricks resources
model_config="../prod_config.yaml", # Production config
pip_requirements=[...]
)
# Register to Unity Catalog
uc_model_info = mlflow.register_model(
model_uri=logged_agent_info.model_uri,
name=f"{catalog}.{schema}.super_agent_hybrid"
)
# Deploy to Model Serving
deployment_info = agents.deploy(
f"{catalog}.{schema}.super_agent_hybrid",
uc_model_info.version,
scale_to_zero=True,
workload_size="Small"
)
# Test endpoint via CLI
databricks serving-endpoints query \
--endpoint-name multi-agent-genie-endpoint \
--data '{
"input": [{"role": "user", "content": "Show me patient data"}],
"custom_inputs": {"thread_id": "test-123"}
}'
Or test in AI Playground:
The agent requires these Databricks resources (automatically logged):
All resources are declared in deploy_agent.py and logged with MLflow.
dev_config.yaml)notebooks/test_agent_databricks.pyprod_config.yaml)notebooks/deploy_agent.pyconfig.py + .env)See CONFIGURATION.md for complete guide.
# In deploy_agent.py:
# 1. Make code changes in src/multi_agent/
# 2. Sync to Databricks
# 3. Run deployment cells again
# This creates a new model version
If only configuration changed:
# 1. Edit prod_config.yaml
# 2. Redeploy (creates new version with new config)
# Get endpoint details
databricks serving-endpoints get --name multi-agent-genie-endpoint
# View logs
databricks serving-endpoints logs --name multi-agent-genie-endpoint
View in MLflow UI:
Check AI Gateway inference tables:
SELECT * FROM system.ai_gateway.inference_logs
WHERE endpoint_name = 'multi-agent-genie-endpoint'
ORDER BY timestamp DESC
LIMIT 100;
from databricks import agents
# List versions
# Find previous working version
# Deploy previous version
agents.deploy(
"catalog.schema.super_agent_hybrid",
previous_version_number,
scale_to_zero=True,
workload_size="Small"
)
Problem: ResourceNotFound: Genie space not found
Solution:
prod_config.yaml existdeploy_agent.pyProblem: ModuleNotFoundError: No module named 'multi_agent'
Solution:
code_paths=["../src/multi_agent"] in deploy_agent.pysrc/multi_agent/ was synced to DatabricksProblem: Endpoint returns errors or timeouts
Solution:
Problem: Agent using wrong configuration
Solution:
model_config="../prod_config.yaml" pathStart with Small and scale up based on usage:
Small: Development/testing, low trafficMedium: Moderate trafficLarge: High traffic, complex queriesEnable with scale_to_zero=True:
dev_config.yaml with smaller modelsprod_config.yaml with optimal modelsReady to deploy? Follow the steps above and monitor your deployment! 🚀