Example Configurations¶
The examples/ directory contains ready-to-use configurations organized in a numbered, progressive learning path. Each directory builds upon the previous, guiding you from basic concepts to production-ready applications.
π Learning Path¶
The examples follow a natural progression:
01_getting_started β 02_mcp β 03_reranking β 04_genie β 05_memory
β 06_on_behalf_of_user β 07_human_in_the_loop β 08_guardrails β 09_structured_output
β 10_agent_integrations β 11_prompt_engineering β 12_middleware β 13_orchestration
β 14_basic_tools β 99_complete_applications β 15_instructed_retriever
β 16_parallel_tools β 17_visualization β 18_background_agents
β 19_a2a_protocol β 20_lakebase_search
Start at 01_getting_started if you're new, or jump directly to the category that matches your needs.
Quick Reference¶
π New to DAO AI?¶
Start here:
- 01_getting_started/minimal.yaml - Simplest possible agent
- 04_genie/genie_basic.yaml - Natural language to SQL
π§ Need Specific Tools?¶
Explore:
- 02_mcp/ - JIRA, managed/external/custom MCP integrations
- 10_agent_integrations/ - Agent Bricks, Kasal, external agent platforms
- 14_basic_tools/ - SQL execution, Slack, and basic tool patterns
β‘ Optimizing Performance?¶
Check out:
- 04_genie/ - LRU and semantic caching strategies
πΎ Managing State?¶
See:
- 05_memory/ - Conversation history and persistence
π‘οΈ Production Ready?¶
Essential patterns:
- 06_on_behalf_of_user/ - User-level authentication and access control
- 07_human_in_the_loop/ - Approval workflows
- 08_guardrails/ - Safety and compliance
- 09_structured_output/ - Enforce JSON schemas
- 11_prompt_engineering/ - Prompt management and optimization
π‘οΈ Need Validation & Monitoring?¶
Middleware patterns:
- 12_middleware/ - Input validation, logging, performance monitoring
π Visualizations?¶
Charts and graphs:
- 17_visualization/ - Vega-Lite chart generation via custom_outputs
β±οΈ Background Tasks?¶
Background kickoff + poll/stream retrieval (deep research, multi-tool workflows):
- 18_background_agents/ - OpenAI Responses APIβcompatible /v1/responses on Apps + background=true on Model Serving, backed by Lakebase
π Retrieval from Lakebase Postgres?¶
ANN / BM25 / hybrid RRF over a Lakebase table (as a sibling of ai_search):
- 20_lakebase_search/ - type: lakebase_search using the lakebase_vector + lakebase_text extensions, with filter-operator coverage and a UC OTEL trace_location example
ποΈ Complete Solutions?¶
Full applications:
- 99_complete_applications/ - Executive assistant, research agent, reservation system
Using Examples¶
Validate a Configuration¶
Visualize the Workflow¶
Chat with an Agent¶
Deploy to Databricks¶
π Directory Guide¶
01. Getting Started π README¶
Foundation concepts for beginners.
| Example | Description |
|---|---|
minimal.yaml |
Simplest possible agent configuration |
genie_basic.yaml |
Natural language to SQL with Databricks Genie |
Prerequisites: Databricks workspace, basic YAML knowledge
Next: Learn about tools in 02_tools/
02. MCP π README¶
Integrate external services and Databricks capabilities via the Model Context Protocol.
| Example | Description |
|---|---|
custom_mcp.yaml |
Custom MCP integration (JIRA example) |
managed_mcp.yaml |
Managed Model Context Protocol integration |
external_mcp.yaml |
External MCP with Unity Catalog connections |
filtered_mcp.yaml |
MCP tool filtering (security, performance, access control) |
Prerequisites: Credentials for external services, Unity Catalog access
Next: Improve retrieval quality with reranking in 03_reranking/
03. Caching π README¶
Improve performance and reduce costs through intelligent caching.
| Example | Description |
|---|---|
genie_lru_cache.yaml |
LRU (Least Recently Used) caching for Genie |
genie_context_aware_cache.yaml |
Two-tier context-aware caching with PostgreSQL embeddings |
genie_in_memory_context_aware_cache.yaml |
In-memory context-aware caching (no database required) |
Prerequisites: PostgreSQL or Lakebase required for genie_context_aware_cache.yaml only
Next: Add persistence in 05_memory/
05. Memory π README¶
Persistent state management and long-term memory for multi-turn conversations.
| Example | Description |
|---|---|
in_memory_basic.yaml |
In-memory conversation state (no persistence, good for testing) |
postgres_persistence.yaml |
PostgreSQL-backed conversation persistence |
lakebase_persistence.yaml |
Lakebase (Databricks-native) conversation persistence |
conversation_summarization.yaml |
Long conversation summarization with Lakebase store |
All examples support the optional extraction config block for long-term memory with structured schemas, background extraction, and automatic memory injection.
Prerequisites: PostgreSQL or Lakebase database (except in_memory_basic.yaml)
Next: User-level access control in 06_on_behalf_of_user/
06. On-Behalf-Of User π README¶
User-level authentication and access control with Unity Catalog.
| Example | Description |
|---|---|
obo_basic.yaml |
OBO with UC Functions and Genie Spaces |
Prerequisites: Unity Catalog, user credentials
Next: Add approval workflows in 07_human_in_the_loop/
07. Human-in-the-Loop π README¶
Approval workflows for sensitive operations.
| Example | Description |
|---|---|
human_in_the_loop.yaml |
Tool approval workflows and HITL patterns |
Prerequisites: MLflow for HITL checkpointing
Next: Add safety guardrails in 08_guardrails/
08. Guardrails π README¶
Automated safety and validation using MLflow judges (mlflow.genai.judges.make_judge). The prompt determines the evaluation type -- tone, completeness, veracity/groundedness, or any custom criteria. Tool context from the conversation is automatically extracted for veracity checks.
| Example | Description |
|---|---|
guardrails_basic.yaml |
Tone, completeness, and veracity guardrails with MLflow judges |
guardrails_scorers.yaml |
MLflow Scorer-based guardrails (ToxicLanguage, GibberishText) alongside custom judges |
Prerequisites: MLflow with Databricks model endpoints
Next: Enforce schemas in 09_structured_output/
09. Structured Output π README¶
Enforce response format with JSON schema.
| Example | Description |
|---|---|
structured_output.yaml |
Type-safe API responses with automatic validation |
Prerequisites: Basic understanding of JSON schemas
Next: External agents in 10_agent_integrations/
10. Agent Integrations π README¶
Call another agent as a tool using the first-class type: app, type: serving_endpoint, and type: a2a function types.
| Example | Description |
|---|---|
app_first_class.yaml |
type: app β call a Databricks App as a tool (lazy /agent/info probe + explicit api: override) |
serving_endpoint_first_class.yaml |
type: serving_endpoint β call FMAPI (Chat Completions) and UC-registered ResponsesAgent endpoints (task discovery) |
agent_bricks.yaml |
Agent Bricks integration with customer support and product expert agents (type: serving_endpoint) |
kasal.yaml |
Kasal enterprise agents with financial, compliance, and privacy specialists (type: serving_endpoint) |
What You'll Learn:
- First-Class Agent Tools: Use type: app, type: serving_endpoint, and type: a2a to call other agents as tools β no factory boilerplate required
- Wire-Shape Selection: Pick OpenAI Responses vs Chat Completions per tool via api:, or let dao-ai discover it lazily on first invocation
- Per-Target Discovery: Apps probe /agent/info; Model Serving endpoints probe serving_endpoints.get(name).task β both lazy, cached, and offline-safe
- Multi-Agent Orchestration: Coordinate between specialized external agents
- Delegation Patterns: Route tasks to purpose-built specialist agents
Key Concepts: - Hub-and-Spoke Pattern: One orchestrator routes to multiple specialists - Sequential Workflows: Chain specialist agents for compliance and validation - Parallel Consultation: Consult multiple agents simultaneously for multi-perspective analysis
Prerequisites: Target Databricks App or Model Serving endpoint deployed (or an Agent Bricks / Kasal endpoint configured)
Next: Reuse prompts across agents in 11_prompt_engineering/
π See configuration-reference.md β First-Class Agent Tools for the full field reference, discovery rules, and offline-safety guarantees.
11. Prompt Engineering π README¶
Define reusable prompts as first-class config objects and share them across agents.
| Example | Description |
|---|---|
reusable_prompts.yaml |
Reusable inline prompts referenced via YAML anchors |
Prerequisites: None
Next: Add validation and monitoring in 12_middleware/
Common Patterns:
tools:
specialist_tool: &specialist_tool
name: specialist_agent
function:
# First-class type β discovery picks Responses vs Chat Completions
# based on serving_endpoints.get(name).task.
type: serving_endpoint
endpoint: external-agent-endpoint-name
description: |
Detailed description of when to use this agent.
agents:
orchestrator:
name: main_agent
tools:
- *specialist_tool
prompt: |
You coordinate tasks and delegate to specialist agents.
Use the specialist tool for X, Y, Z tasks.
Use Cases: - Customer Service: Route queries to specialized support, product, and escalation agents - Financial Services: Financial analysis with compliance validation and risk assessment - Healthcare: Clinical guidance with HIPAA compliance and privacy validation - Enterprise IT: Multi-domain technical support with security and access control
Real-World Examples:
Agent Bricks - Customer service automation:
# Customer support agent for handling complaints
customer_support_tool:
function:
type: serving_endpoint
endpoint: *agent_bricks_customer_support
description: "Handle customer complaints, returns, and issues"
# Product expert for technical questions
product_expert_tool:
function:
type: serving_endpoint
endpoint: *agent_bricks_product_expert
description: "Technical specs, compatibility, recommendations"
# Main agent routes to specialists
orchestrator:
tools: [customer_support_tool, product_expert_tool]
Kasal - Enterprise governance workflows:
# Financial analyst with compliance checks
enterprise_coordinator:
tools:
- financial_analyst_tool # Data analysis and forecasting
- compliance_checker_tool # Regulatory validation
- privacy_specialist_tool # PII and data privacy
prompt: |
IMPORTANT: For financial decisions, ALWAYS check with
compliance validator before providing recommendations.
For customer data, ALWAYS consult privacy specialist.
Best Practices: - Clear Agent Responsibilities: Give each agent a specific, well-defined role - Effective Prompting: Provide complete context when calling specialist agents - Error Handling: Handle agent timeout and failure scenarios gracefully - Compliance First: Use compliance validators before making regulatory decisions - Performance: Cache agent responses when appropriate, use parallel calls
12. Middleware π README¶
Cross-cutting concerns for production agents: validation, logging, monitoring, limits, retries, and privacy.
| Example | Description |
|---|---|
custom_field_validation.yaml |
Input validation patterns (store numbers, tenant IDs, API keys) |
logging_middleware.yaml |
Request logging, performance monitoring, audit trails |
combined_middleware.yaml |
Production-ready middleware stacks |
limit_middleware.yaml |
Tool call and model call limits to prevent runaway loops |
retry_middleware.yaml |
Automatic retry with exponential backoff for transient failures |
context_management.yaml |
Context editing to prevent token limit issues |
pii_middleware.yaml |
PII detection and protection for privacy compliance |
Key Concepts: - Input Validation: Ensure required context fields (store_num, user_id) are provided - Request Logging: Track all interactions for debugging and auditing - Performance Monitoring: Identify bottlenecks and slow operations - Audit Trails: Comprehensive logging for compliance - Middleware Composition: Combine multiple middleware in the correct order - Tool/Model Limits: Prevent excessive API calls and runaway loops - Retry Logic: Automatic retry with backoff for transient failures - Context Management: Clear older tool outputs to stay within token limits - PII Protection: Detect and handle sensitive personal information
Common Patterns:
middleware:
store_validation: &store_validation
name: dao_ai.middleware.create_custom_field_validation_middleware
args:
fields:
- name: store_num
description: "Your store number"
example_value: "12345"
agents:
my_agent:
middleware:
- *store_validation
prompt: |
Store Number: {store_num}
...
Real-World Example:
The hardware store application uses store number validation to ensure users provide their store location for inventory lookups. See 99_complete_applications/hardware_store/hardware_store.yaml.
Prerequisites: Basic understanding of agents and prompts
Next: Learn multi-agent coordination in 13_orchestration/
13. Orchestration π README¶
Multi-agent coordination patterns.
| Example | Description |
|---|---|
supervisor_pattern.yaml |
Supervisor orchestration pattern |
swarm_pattern.yaml |
Swarm orchestration pattern |
deterministic_handoff_pattern.yaml |
Deterministic handoff pipeline pattern |
Prerequisites: Understanding of multi-agent systems
Next: Try basic tools in 14_basic_tools/
14. Basic Tools π README¶
Simple tool integrations for SQL and data operations.
| Example | Description |
|---|---|
sql_tool_example.yaml |
First-class type: sql execution tools for inventory analysis, including a parameterized statement |
Prerequisites: Databricks SQL warehouse
Next: See complete applications in 99_complete_applications/
15. Complete Applications π README¶
Full-featured, production-ready agent applications.
| Example | Description |
|---|---|
executive_assistant.yaml |
Comprehensive assistant with email, calendar, Slack |
deep_research.yaml |
Multi-step research agent with web search |
reservations_system.yaml |
Restaurant reservation management system |
genie_vector_search_hybrid.yaml |
Combined SQL and AI Search capabilities |
genie_and_genie_mcp.yaml |
Multiple Genie instances via MCP (experimental) |
Prerequisites: All concepts from previous categories
Use: As reference implementations or starting points
18. Visualization π README¶
Generate Vega-Lite chart specs from structured data, delivered to clients via custom_outputs.visualizations.
| Example | Description |
|---|---|
vega_lite_visualization.yaml |
Bar/line/scatter/area/arc/heatmap charts with SQL data source |
Prerequisites: Factory tool pattern (14_basic_tools)
Use: Pair with SQL or Genie tools to turn query results into interactive charts
19. Background Agents π Full docs¶
Responses APIβcompatible kickoff / poll / cancel for agent runs that exceed the ~5 min Model Serving worker timeout or ~120 s Databricks Apps DPAPI timeout. Persists response state + stream events to Lakebase; the background task runs on a persistent daemon thread so it survives the per-request asyncio.run() teardown.
| Example | Description |
|---|---|
background_research.yaml |
Deep-research agent with app.background enabled, deployed to both Databricks Apps and Model Serving |
Prerequisites: Configured Lakebase project
Use: Deep research, multi-agent workflows, or any single inference that may take more than ~2β5 minutes
Customizing Examples¶
Each example is a starting point:
- Copy to your config directory:
cp examples/01_getting_started/minimal.yaml config/my_agent.yaml - Modify prompts, tools, and settings
- Validate:
dao-ai validate -c config/my_agent.yaml - Test locally:
dao-ai chat -c config/my_agent.yaml - Deploy:
dao-ai agent up -c config/my_agent.yaml
For detailed guidance, see the README.md in each category directory.
Contributing Examples¶
Adding a new example? Follow this guide:
- Choose the right category based on the primary feature demonstrated
- Use descriptive names:
tool_name_variant.yaml(e.g.,slack_with_approval.yaml) - Add to the appropriate category (
01_getting_startedthrough13_complete_applications) - Update this file with a table entry
- Test thoroughly before submitting
See Contributing Guide for details.