Complete guide for developing the multi-agent system locally.
venv or similar)# 1. Clone the repository
git clone <repo-url>
cd KUMC_POC_hlsfieldtemp # Or multi-agent-genie after rename
# 2. Create virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# 3. Install dependencies
pip install -r requirements.txt
pip install -r requirements-dev.txt # For testing
# 4. Configure environment
cp .env.example .env
# Edit .env with your Databricks credentials and configuration
# See "Configuration" section below
# 5. Verify installation
python -c "from src.multi_agent import *; print('✓ Installation successful')"
# 6. Run tests to verify setup
pytest tests/unit/ # Fast unit tests
# 7. Run the agent locally
python -m src.multi_agent.main --query "Show me patient data"
Edit .env file with your credentials:
# Databricks Connection
DATABRICKS_HOST=https://your-workspace.cloud.databricks.com
DATABRICKS_TOKEN=your-personal-access-token
# Unity Catalog
CATALOG_NAME=your_catalog
SCHEMA_NAME=your_schema
# LLM Endpoints (use your workspace endpoints)
LLM_ENDPOINT=databricks-claude-sonnet-4-5
LLM_ENDPOINT_CLARIFICATION=databricks-claude-haiku-4-5
LLM_ENDPOINT_PLANNING=databricks-claude-sonnet-4-5
# ... (see .env.example for all endpoints)
# Genie Configuration
GENIE_SPACE_IDS=space_id_1,space_id_2,space_id_3
SQL_WAREHOUSE_ID=your_warehouse_id
# Vector Search
VS_ENDPOINT_NAME=genie_multi_agent_vs
EMBEDDING_MODEL=databricks-gte-large-en
# Lakebase (state management)
LAKEBASE_INSTANCE_NAME=your-lakebase-instance
Get these values:
DATABRICKS_TOKEN: Settings → User Settings → Access TokensSQL_WAREHOUSE_ID: SQL Warehouses → Your warehouse → Copy ID from URLGENIE_SPACE_IDS: Genie UI → Space settings → Copy space ID# 1. Create a feature branch
git checkout -b feature/my-new-feature
# 2. Edit code in src/multi_agent/
# Example: Modify an agent
vim src/multi_agent/agents/supervisor.py
# 3. Test your changes
pytest tests/unit/test_supervisor.py -v
# 4. Run agent locally to verify
python -m src.multi_agent.main --query "test query"
# 5. Run integration tests (requires Databricks)
pytest tests/integration/ -v
# 6. Commit changes
git add .
git commit -m "feat: Add new feature"
# 7. Push and create PR
git push origin feature/my-new-feature
| File/Directory | Purpose | Edit Frequency |
|---|---|---|
src/multi_agent/ |
All agent code - main development area | ⭐ High |
.env |
Local configuration & secrets | Once (setup) |
config.py |
Config loader (rarely needs changes) | Low |
tests/ |
Unit & integration tests | High |
src/multi_agent/main.py |
CLI entry point | Medium |
# Run all tests
pytest
# Run specific test file
pytest tests/unit/test_agents.py -v
# Run specific test function
pytest tests/unit/test_agents.py::test_supervisor_agent -v
# Run with coverage
pytest --cov=src.multi_agent tests/
# Run only unit tests (fast)
pytest tests/unit/
# Run only integration tests (requires Databricks)
pytest tests/integration/
# Format code with Black
black src/ tests/
# Sort imports
isort src/ tests/
# Lint code
flake8 src/ tests/
# Type checking
mypy src/
# Basic query
python -m src.multi_agent.main --query "Show me patient demographics"
# With debug logging
DEBUG=1 python -m src.multi_agent.main --query "test"
# Interactive mode
python -m src.multi_agent.main --interactive
# With conversation ID (multi-turn)
python -m src.multi_agent.main --query "Follow up question" --thread-id conv-123
# Run with verbose logging
python -m src.multi_agent.main --query "test" --verbose
# Run with Python debugger
python -m pdb -m src.multi_agent.main --query "test"
# Use ipdb for better debugging
pip install ipdb
# Add breakpoint in code: import ipdb; ipdb.set_trace()
python -m src.multi_agent.main --query "test"
notebooks/deploy_agent.py - Only for deploymentdev_config.yaml / prod_config.yaml - Only for Databrickssrc/multi_agent/ - All agent code.env - Your local configurationconfig.py - Config loadertests/fixtures/)src/multi_agent/agents/my_new_agent.pyfrom langchain_core.messages import HumanMessage
from typing import TypedDict
def my_new_agent(state: dict) -> dict:
"""New agent implementation."""
# Your agent logic here
return {"messages": [HumanMessage(content="response")]}
src/multi_agent/core/graph.pyfrom multi_agent.agents.my_new_agent import my_new_agent
# Add to graph
graph.add_node("my_new_agent", my_new_agent)
Add tests: tests/unit/test_my_new_agent.py
Test locally:
pytest tests/unit/test_my_new_agent.py -v
python -m src.multi_agent.main --query "test new agent"
src/multi_agent/agents/supervisor.py)pytest tests/unit/test_supervisor.py -vpytest tests/python -m src.multi_agent.main --query "test"The config.py file provides type-safe configuration classes:
from config import get_config
# Get configuration
config = get_config()
# Access values
catalog = config.unity_catalog.catalog_name
llm_endpoint = config.llm.endpoint_name
warehouse_id = config.table_metadata.sql_warehouse_id
# Reload configuration (if .env changed)
config = get_config(reload=True)
After local development, test in Databricks before deploying:
# 1. Sync code to Databricks
databricks workspace import-dir src/multi_agent /Workspace/src/multi_agent --overwrite
# 2. Open notebooks/test_agent_databricks.py in Databricks
# 3. Run notebook to test with real services
See ../notebooks/README.md for complete Databricks testing guide.
Problem: ModuleNotFoundError: No module named 'multi_agent'
Solution:
# Make sure you're in repo root
cd /path/to/KUMC_POC_hlsfieldtemp
# Run with proper module path
python -m src.multi_agent.main
Problem: ValueError: DATABRICKS_HOST must be set
Solution:
.env file existsconfig = get_config(reload=True)Problem: DatabricksError: Authentication failed
Solution:
DATABRICKS_TOKEN is valid (not expired)DATABRICKS_HOST includes https://databricks workspace ls /Problem: Integration tests failing
Solution:
pytest tests/unit/.env.example.env to gitpytest tests/unit/pytest tests/black src/ tests/
isort src/ tests/
After setting up local development:
Happy coding! 🚀 For questions, see CONTRIBUTING.md or open a discussion.