dao-ai 0.0.34__py3-none-any.whl → 0.0.36__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dao_ai/config.py +38 -4
- dao_ai/genie/__init__.py +59 -0
- dao_ai/genie/cache/__init__.py +44 -0
- dao_ai/genie/cache/base.py +122 -0
- dao_ai/genie/cache/lru.py +306 -0
- dao_ai/genie/cache/semantic.py +638 -0
- dao_ai/providers/databricks.py +14 -7
- dao_ai/tools/__init__.py +3 -0
- dao_ai/tools/genie/__init__.py +236 -0
- dao_ai/tools/genie.py +65 -15
- dao_ai/tools/unity_catalog.py +5 -2
- dao_ai/tools/vector_search.py +4 -2
- dao_ai/utils.py +27 -3
- dao_ai-0.0.36.dist-info/METADATA +951 -0
- {dao_ai-0.0.34.dist-info → dao_ai-0.0.36.dist-info}/RECORD +18 -12
- dao_ai-0.0.34.dist-info/METADATA +0 -1169
- {dao_ai-0.0.34.dist-info → dao_ai-0.0.36.dist-info}/WHEEL +0 -0
- {dao_ai-0.0.34.dist-info → dao_ai-0.0.36.dist-info}/entry_points.txt +0 -0
- {dao_ai-0.0.34.dist-info → dao_ai-0.0.36.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,951 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dao-ai
|
|
3
|
+
Version: 0.0.36
|
|
4
|
+
Summary: DAO AI: A modular, multi-agent orchestration framework for complex AI workflows. Supports agent handoff, tool integration, and dynamic configuration via YAML.
|
|
5
|
+
Project-URL: Homepage, https://github.com/natefleming/dao-ai
|
|
6
|
+
Project-URL: Documentation, https://natefleming.github.io/dao-ai
|
|
7
|
+
Project-URL: Repository, https://github.com/natefleming/dao-ai
|
|
8
|
+
Project-URL: Issues, https://github.com/natefleming/dao-ai/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/natefleming/dao-ai/blob/main/CHANGELOG.md
|
|
10
|
+
Author-email: Nate Fleming <nate.fleming@databricks.com>, Nate Fleming <nate.fleming@gmail.com>
|
|
11
|
+
Maintainer-email: Nate Fleming <nate.fleming@databricks.com>
|
|
12
|
+
License: MIT
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Keywords: agents,ai,databricks,langchain,langgraph,llm,multi-agent,orchestration,vector-search,workflow
|
|
15
|
+
Classifier: Development Status :: 3 - Alpha
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Intended Audience :: Science/Research
|
|
18
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
25
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
26
|
+
Classifier: Topic :: System :: Distributed Computing
|
|
27
|
+
Requires-Python: >=3.11
|
|
28
|
+
Requires-Dist: databricks-agents>=1.8.2
|
|
29
|
+
Requires-Dist: databricks-langchain>=0.11.0
|
|
30
|
+
Requires-Dist: databricks-mcp>=0.3.0
|
|
31
|
+
Requires-Dist: databricks-sdk[openai]>=0.67.0
|
|
32
|
+
Requires-Dist: ddgs>=9.9.3
|
|
33
|
+
Requires-Dist: flashrank>=0.2.8
|
|
34
|
+
Requires-Dist: gepa>=0.0.17
|
|
35
|
+
Requires-Dist: grandalf>=0.8
|
|
36
|
+
Requires-Dist: langchain-mcp-adapters>=0.2.1
|
|
37
|
+
Requires-Dist: langchain-tavily>=0.2.11
|
|
38
|
+
Requires-Dist: langchain>=1.1.3
|
|
39
|
+
Requires-Dist: langgraph-checkpoint-postgres>=3.0.2
|
|
40
|
+
Requires-Dist: langgraph-supervisor>=0.0.31
|
|
41
|
+
Requires-Dist: langgraph-swarm>=0.1.0
|
|
42
|
+
Requires-Dist: langgraph>=1.0.4
|
|
43
|
+
Requires-Dist: langmem>=0.0.30
|
|
44
|
+
Requires-Dist: loguru>=0.7.3
|
|
45
|
+
Requires-Dist: mcp>=1.23.3
|
|
46
|
+
Requires-Dist: mlflow>=3.7.0
|
|
47
|
+
Requires-Dist: nest-asyncio>=1.6.0
|
|
48
|
+
Requires-Dist: openevals>=0.0.19
|
|
49
|
+
Requires-Dist: openpyxl>=3.1.5
|
|
50
|
+
Requires-Dist: psycopg[binary,pool]>=3.3.2
|
|
51
|
+
Requires-Dist: pydantic>=2.12.0
|
|
52
|
+
Requires-Dist: python-dotenv>=1.1.0
|
|
53
|
+
Requires-Dist: pyyaml>=6.0.2
|
|
54
|
+
Requires-Dist: rich>=14.0.0
|
|
55
|
+
Requires-Dist: scipy<=1.15
|
|
56
|
+
Requires-Dist: sqlparse>=0.5.3
|
|
57
|
+
Requires-Dist: tomli>=2.3.0
|
|
58
|
+
Requires-Dist: unitycatalog-ai[databricks]>=0.3.2
|
|
59
|
+
Provides-Extra: databricks
|
|
60
|
+
Requires-Dist: databricks-connect>=15.0.0; extra == 'databricks'
|
|
61
|
+
Requires-Dist: databricks-vectorsearch>=0.63; extra == 'databricks'
|
|
62
|
+
Requires-Dist: pyspark>=3.5.0; extra == 'databricks'
|
|
63
|
+
Provides-Extra: dev
|
|
64
|
+
Requires-Dist: mypy>=1.0.0; extra == 'dev'
|
|
65
|
+
Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
|
|
66
|
+
Requires-Dist: pytest>=8.3.5; extra == 'dev'
|
|
67
|
+
Requires-Dist: ruff>=0.11.11; extra == 'dev'
|
|
68
|
+
Provides-Extra: docs
|
|
69
|
+
Requires-Dist: mkdocs-material>=9.0.0; extra == 'docs'
|
|
70
|
+
Requires-Dist: mkdocs>=1.5.0; extra == 'docs'
|
|
71
|
+
Requires-Dist: mkdocstrings[python]>=0.24.0; extra == 'docs'
|
|
72
|
+
Provides-Extra: test
|
|
73
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'test'
|
|
74
|
+
Requires-Dist: pytest-mock>=3.10.0; extra == 'test'
|
|
75
|
+
Requires-Dist: pytest>=8.3.5; extra == 'test'
|
|
76
|
+
Description-Content-Type: text/markdown
|
|
77
|
+
|
|
78
|
+
# DAO: Declarative Agent Orchestration
|
|
79
|
+
|
|
80
|
+
**Production-grade AI agents defined in YAML, powered by LangGraph, deployed on Databricks.**
|
|
81
|
+
|
|
82
|
+
DAO is an **infrastructure-as-code framework** for building, deploying, and managing multi-agent AI systems. Instead of writing boilerplate Python code to wire up agents, tools, and orchestration, you define everything declaratively in YAML configuration files.
|
|
83
|
+
|
|
84
|
+
```yaml
|
|
85
|
+
# Define an agent in 10 lines of YAML
|
|
86
|
+
agents:
|
|
87
|
+
product_expert:
|
|
88
|
+
name: product_expert
|
|
89
|
+
model: *claude_sonnet
|
|
90
|
+
tools:
|
|
91
|
+
- *vector_search_tool
|
|
92
|
+
- *genie_tool
|
|
93
|
+
prompt: |
|
|
94
|
+
You are a product expert. Answer questions about inventory and pricing.
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Why DAO?
|
|
100
|
+
|
|
101
|
+
### For Newcomers to AI Agents
|
|
102
|
+
|
|
103
|
+
**What is an AI Agent?**
|
|
104
|
+
An AI agent is more than a chatbot. While a chatbot just responds to messages, an *agent* can:
|
|
105
|
+
- **Reason** about what steps to take
|
|
106
|
+
- **Use tools** (databases, APIs, search) to gather information
|
|
107
|
+
- **Make decisions** about which actions to perform
|
|
108
|
+
- **Coordinate** with other agents on complex tasks
|
|
109
|
+
|
|
110
|
+
**What is Databricks?**
|
|
111
|
+
Databricks is a unified data and AI platform that provides:
|
|
112
|
+
- **Unity Catalog**: Governed data access and permissions
|
|
113
|
+
- **Model Serving**: Deploy ML models as APIs
|
|
114
|
+
- **Vector Search**: Semantic similarity search for RAG
|
|
115
|
+
- **Genie**: Natural language to SQL for business users
|
|
116
|
+
- **MLflow**: Model tracking, versioning, and deployment
|
|
117
|
+
|
|
118
|
+
DAO brings these capabilities together into a cohesive agent framework.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## DAO vs. Databricks Agent Bricks
|
|
123
|
+
|
|
124
|
+
Databricks offers two approaches to building AI agents. Understanding when to use each is crucial:
|
|
125
|
+
|
|
126
|
+
| Aspect | **DAO** (This Framework) | **Databricks Agent Bricks** |
|
|
127
|
+
|--------|--------------------------|----------------------------|
|
|
128
|
+
| **Configuration** | YAML files (infrastructure-as-code) | GUI-based AI Playground |
|
|
129
|
+
| **Target Users** | ML Engineers, Platform Teams | Citizen Developers, Analysts |
|
|
130
|
+
| **Customization** | Full control over every component | Guided templates and wizards |
|
|
131
|
+
| **Version Control** | Git-native, full CI/CD support | Limited versioning |
|
|
132
|
+
| **Orchestration** | Multiple patterns (Supervisor, Swarm) | Single-agent or simple routing |
|
|
133
|
+
| **Tool Types** | Python, Factory, UC, MCP, Custom | Unity Catalog functions |
|
|
134
|
+
| **Caching** | LRU + Semantic (pg_vector) | None built-in |
|
|
135
|
+
| **Memory** | PostgreSQL, In-Memory, Custom | Basic checkpointing |
|
|
136
|
+
| **Deployment** | Databricks Asset Bundles, MLflow | One-click deployment |
|
|
137
|
+
| **Best For** | Production multi-agent systems | Rapid prototyping, POCs |
|
|
138
|
+
|
|
139
|
+
### When to Use DAO
|
|
140
|
+
|
|
141
|
+
✅ You need **multiple specialized agents** working together
|
|
142
|
+
✅ You want **version-controlled, reviewable** agent configurations
|
|
143
|
+
✅ You require **custom tools** beyond Unity Catalog functions
|
|
144
|
+
✅ You need **advanced caching** for cost optimization
|
|
145
|
+
✅ You're building a **production system** with CI/CD
|
|
146
|
+
✅ You need **human-in-the-loop** approval workflows
|
|
147
|
+
|
|
148
|
+
### When to Use Agent Bricks
|
|
149
|
+
|
|
150
|
+
✅ You're **prototyping** a new agent idea quickly
|
|
151
|
+
✅ You prefer a **no-code/low-code** approach
|
|
152
|
+
✅ Your use case fits **standard templates** (extraction, Q&A)
|
|
153
|
+
✅ You want **automated optimization** without manual tuning
|
|
154
|
+
✅ You have a **single agent** with simple tool needs
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Architecture
|
|
159
|
+
|
|
160
|
+
### High-Level Overview
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
164
|
+
│ YAML Configuration │
|
|
165
|
+
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────────────┐ │
|
|
166
|
+
│ │ Schemas │ │ Resources│ │ Tools │ │ Agents │ │ Orchestration │ │
|
|
167
|
+
│ └─────────┘ └─────────┘ └─────────┘ └─────────┘ └─────────────────┘ │
|
|
168
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
169
|
+
│
|
|
170
|
+
▼
|
|
171
|
+
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
172
|
+
│ DAO Framework (Python) │
|
|
173
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ │
|
|
174
|
+
│ │ Config │ │ Graph │ │ Nodes │ │ Tool Factory │ │
|
|
175
|
+
│ │ Loader │ │ Builder │ │ Factory │ │ │ │
|
|
176
|
+
│ └─────────────┘ └─────────────┘ └─────────────┘ └─────────────────┘ │
|
|
177
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
178
|
+
│
|
|
179
|
+
▼
|
|
180
|
+
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
181
|
+
│ LangGraph Runtime │
|
|
182
|
+
│ ┌─────────────────────────────────────────────────────────────────────┐ │
|
|
183
|
+
│ │ Compiled State Graph │ │
|
|
184
|
+
│ │ ┌─────────┐ ┌─────────────┐ ┌─────────────────────────┐ │ │
|
|
185
|
+
│ │ │ Message │───▶│ Supervisor/ │───▶│ Specialized Agents │ │ │
|
|
186
|
+
│ │ │ Hook │ │ Swarm │ │ (Product, Orders, DIY) │ │ │
|
|
187
|
+
│ │ └─────────┘ └─────────────┘ └─────────────────────────┘ │ │
|
|
188
|
+
│ └─────────────────────────────────────────────────────────────────────┘ │
|
|
189
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
190
|
+
│
|
|
191
|
+
▼
|
|
192
|
+
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
193
|
+
│ Databricks Platform │
|
|
194
|
+
│ ┌─────────┐ ┌─────────────┐ ┌─────────────┐ ┌──────────┐ ┌─────────┐ │
|
|
195
|
+
│ │ Model │ │ Unity │ │ Vector │ │ Genie │ │ MLflow │ │
|
|
196
|
+
│ │ Serving │ │ Catalog │ │ Search │ │ Spaces │ │ │ │
|
|
197
|
+
│ └─────────┘ └─────────────┘ └─────────────┘ └──────────┘ └─────────┘ │
|
|
198
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Orchestration Patterns
|
|
202
|
+
|
|
203
|
+
DAO supports two orchestration patterns for multi-agent coordination:
|
|
204
|
+
|
|
205
|
+
#### 1. Supervisor Pattern
|
|
206
|
+
A central supervisor agent routes queries to specialized agents based on the request content.
|
|
207
|
+
|
|
208
|
+
```yaml
|
|
209
|
+
orchestration:
|
|
210
|
+
supervisor:
|
|
211
|
+
model: *router_llm
|
|
212
|
+
prompt: |
|
|
213
|
+
Route queries to the appropriate specialist agent.
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
┌─────────────┐
|
|
218
|
+
│ Supervisor │
|
|
219
|
+
└──────┬──────┘
|
|
220
|
+
┌───────────────┼───────────────┐
|
|
221
|
+
▼ ▼ ▼
|
|
222
|
+
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
223
|
+
│ Product │ │ Orders │ │ DIY │
|
|
224
|
+
│ Agent │ │ Agent │ │ Agent │
|
|
225
|
+
└─────────────┘ └─────────────┘ └─────────────┘
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
#### 2. Swarm Pattern
|
|
229
|
+
Agents can hand off to each other directly, enabling more fluid multi-step workflows.
|
|
230
|
+
|
|
231
|
+
```yaml
|
|
232
|
+
orchestration:
|
|
233
|
+
swarm:
|
|
234
|
+
model: *default_llm
|
|
235
|
+
default_agent: *general_agent
|
|
236
|
+
handoffs:
|
|
237
|
+
product_agent: [orders_agent, diy_agent]
|
|
238
|
+
orders_agent: [product_agent]
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
┌─────────────┐ handoff ┌─────────────┐
|
|
243
|
+
│ Product │◄───────────────▶│ Orders │
|
|
244
|
+
│ Agent │ │ Agent │
|
|
245
|
+
└──────┬──────┘ └──────┬──────┘
|
|
246
|
+
│ handoff │
|
|
247
|
+
└──────────────┬────────────────┘
|
|
248
|
+
▼
|
|
249
|
+
┌─────────────┐
|
|
250
|
+
│ DIY │
|
|
251
|
+
│ Agent │
|
|
252
|
+
└─────────────┘
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Key Capabilities
|
|
258
|
+
|
|
259
|
+
### 1. Multi-Tool Support
|
|
260
|
+
|
|
261
|
+
DAO supports five types of tools, each suited for different use cases:
|
|
262
|
+
|
|
263
|
+
| Tool Type | Use Case | Example |
|
|
264
|
+
|-----------|----------|---------|
|
|
265
|
+
| **Python** | Custom business logic | `dao_ai.tools.current_time_tool` |
|
|
266
|
+
| **Factory** | Complex initialization with config | `create_vector_search_tool(retriever=...)` |
|
|
267
|
+
| **Unity Catalog** | Governed SQL functions | `catalog.schema.find_product_by_sku` |
|
|
268
|
+
| **MCP** | External services via Model Context Protocol | GitHub, Slack, custom APIs |
|
|
269
|
+
| **Agent Endpoint** | Call other deployed agents as tools | Chaining agent systems |
|
|
270
|
+
|
|
271
|
+
```yaml
|
|
272
|
+
tools:
|
|
273
|
+
# Python function - direct import
|
|
274
|
+
time_tool:
|
|
275
|
+
function:
|
|
276
|
+
type: python
|
|
277
|
+
name: dao_ai.tools.current_time_tool
|
|
278
|
+
|
|
279
|
+
# Factory - initialized with config
|
|
280
|
+
search_tool:
|
|
281
|
+
function:
|
|
282
|
+
type: factory
|
|
283
|
+
name: dao_ai.tools.create_vector_search_tool
|
|
284
|
+
args:
|
|
285
|
+
retriever: *products_retriever
|
|
286
|
+
|
|
287
|
+
# Unity Catalog - governed SQL function
|
|
288
|
+
sku_lookup:
|
|
289
|
+
function:
|
|
290
|
+
type: unity_catalog
|
|
291
|
+
name: find_product_by_sku
|
|
292
|
+
schema: *retail_schema
|
|
293
|
+
|
|
294
|
+
# MCP - external service integration
|
|
295
|
+
github_mcp:
|
|
296
|
+
function:
|
|
297
|
+
type: mcp
|
|
298
|
+
transport: streamable_http
|
|
299
|
+
connection: *github_connection
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### 2. Advanced Caching (Genie Queries)
|
|
303
|
+
|
|
304
|
+
DAO provides **two-tier caching** for Genie natural language queries, dramatically reducing costs and latency. Unlike simple response caching, DAO caches the **generated SQL** and re-executes it against your warehouse—ensuring you always get **fresh data** while avoiding the cost of repeated Genie API calls.
|
|
305
|
+
|
|
306
|
+
```yaml
|
|
307
|
+
genie_tool:
|
|
308
|
+
function:
|
|
309
|
+
type: factory
|
|
310
|
+
name: dao_ai.tools.create_genie_tool
|
|
311
|
+
args:
|
|
312
|
+
genie_room: *retail_genie_room
|
|
313
|
+
|
|
314
|
+
# L1: Fast O(1) exact match lookup
|
|
315
|
+
lru_cache_parameters:
|
|
316
|
+
warehouse: *warehouse
|
|
317
|
+
capacity: 100 # Max cached queries
|
|
318
|
+
time_to_live_seconds: 86400 # 1 day (use -1 for never expire)
|
|
319
|
+
|
|
320
|
+
# L2: Semantic similarity search via pg_vector
|
|
321
|
+
semantic_cache_parameters:
|
|
322
|
+
database: *postgres_db
|
|
323
|
+
warehouse: *warehouse
|
|
324
|
+
embedding_model: *embedding_model
|
|
325
|
+
similarity_threshold: 0.85 # 0.0-1.0, higher = stricter matching
|
|
326
|
+
time_to_live_seconds: 86400 # 1 day (use -1 for never expire)
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
#### Cache Architecture
|
|
330
|
+
|
|
331
|
+
```
|
|
332
|
+
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
333
|
+
│ Two-Tier Cache Flow │
|
|
334
|
+
├─────────────────────────────────────────────────────────────────────────────┤
|
|
335
|
+
│ │
|
|
336
|
+
│ Question: "What products are low on stock?" │
|
|
337
|
+
│ │ │
|
|
338
|
+
│ ▼ │
|
|
339
|
+
│ ┌──────────────────────────────────────┐ │
|
|
340
|
+
│ │ L1: LRU Cache (In-Memory) │ ◄── O(1) exact string match │
|
|
341
|
+
│ │ • Capacity: 100 entries │ Fastest lookup │
|
|
342
|
+
│ │ • Hash-based lookup │ │
|
|
343
|
+
│ └──────────────────────────────────────┘ │
|
|
344
|
+
│ │ Miss │
|
|
345
|
+
│ ▼ │
|
|
346
|
+
│ ┌──────────────────────────────────────┐ │
|
|
347
|
+
│ │ L2: Semantic Cache (PostgreSQL) │ ◄── Vector similarity search │
|
|
348
|
+
│ │ • pg_vector embeddings │ Catches rephrased questions │
|
|
349
|
+
│ │ • L2 distance similarity │ │
|
|
350
|
+
│ │ • Partitioned by Genie space ID │ │
|
|
351
|
+
│ └──────────────────────────────────────┘ │
|
|
352
|
+
│ │ Miss │
|
|
353
|
+
│ ▼ │
|
|
354
|
+
│ ┌──────────────────────────────────────┐ │
|
|
355
|
+
│ │ Genie API │ ◄── Natural language to SQL │
|
|
356
|
+
│ │ (Expensive call) │ │
|
|
357
|
+
│ └──────────────────────────────────────┘ │
|
|
358
|
+
│ │ │
|
|
359
|
+
│ ▼ │
|
|
360
|
+
│ ┌──────────────────────────────────────┐ │
|
|
361
|
+
│ │ Execute SQL via Warehouse │ ◄── Always fresh data! │
|
|
362
|
+
│ └──────────────────────────────────────┘ │
|
|
363
|
+
│ │
|
|
364
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
#### LRU Cache (L1)
|
|
368
|
+
|
|
369
|
+
The **LRU (Least Recently Used) Cache** provides instant lookups for exact question matches:
|
|
370
|
+
|
|
371
|
+
| Parameter | Default | Description |
|
|
372
|
+
|-----------|---------|-------------|
|
|
373
|
+
| `capacity` | 100 | Maximum number of cached queries |
|
|
374
|
+
| `time_to_live_seconds` | 86400 | Cache entry lifetime (-1 = never expire) |
|
|
375
|
+
| `warehouse` | Required | Databricks warehouse for SQL execution |
|
|
376
|
+
|
|
377
|
+
**Best for:** Repeated exact queries, chatbot interactions, dashboard refreshes
|
|
378
|
+
|
|
379
|
+
#### Semantic Cache (L2)
|
|
380
|
+
|
|
381
|
+
The **Semantic Cache** uses PostgreSQL with pg_vector to find similar questions even when worded differently:
|
|
382
|
+
|
|
383
|
+
| Parameter | Default | Description |
|
|
384
|
+
|-----------|---------|-------------|
|
|
385
|
+
| `similarity_threshold` | 0.85 | Minimum similarity for cache hit (0.0-1.0) |
|
|
386
|
+
| `time_to_live_seconds` | 86400 | Cache entry lifetime (-1 = never expire) |
|
|
387
|
+
| `embedding_model` | Required | Model for generating question embeddings |
|
|
388
|
+
| `database` | Required | PostgreSQL with pg_vector extension |
|
|
389
|
+
| `table_name` | `genie_semantic_cache` | Table name for cache storage |
|
|
390
|
+
|
|
391
|
+
**Best for:** Catching rephrased questions like:
|
|
392
|
+
- "What's our inventory status?" ≈ "Show me stock levels"
|
|
393
|
+
- "Top selling products this month" ≈ "Best sellers in December"
|
|
394
|
+
|
|
395
|
+
#### Cache Behavior
|
|
396
|
+
|
|
397
|
+
1. **SQL Caching, Not Results**: The cache stores the *generated SQL query*, not the query results. On a cache hit, the SQL is re-executed against your warehouse, ensuring **data freshness**.
|
|
398
|
+
|
|
399
|
+
2. **Refresh on Hit**: When a semantic cache entry is found but expired:
|
|
400
|
+
- The expired entry is deleted
|
|
401
|
+
- A cache miss is returned
|
|
402
|
+
- Genie generates fresh SQL
|
|
403
|
+
- The new SQL is cached
|
|
404
|
+
|
|
405
|
+
3. **Multi-Instance Aware**: Each LRU cache is per-instance (in Model Serving, each replica has its own). The semantic cache is shared across all instances via PostgreSQL.
|
|
406
|
+
|
|
407
|
+
4. **Space ID Partitioning**: Cache entries are isolated per Genie space, preventing cross-space cache pollution.
|
|
408
|
+
|
|
409
|
+
### 3. Vector Search Reranking
|
|
410
|
+
|
|
411
|
+
DAO supports **two-stage retrieval** with FlashRank reranking to improve search relevance without external API calls:
|
|
412
|
+
|
|
413
|
+
```yaml
|
|
414
|
+
retrievers:
|
|
415
|
+
products_retriever: &products_retriever
|
|
416
|
+
vector_store: *products_vector_store
|
|
417
|
+
columns: [product_id, name, description, price]
|
|
418
|
+
search_parameters:
|
|
419
|
+
num_results: 50 # Retrieve more candidates
|
|
420
|
+
query_type: ANN
|
|
421
|
+
rerank:
|
|
422
|
+
model: ms-marco-MiniLM-L-12-v2 # Local cross-encoder model
|
|
423
|
+
top_n: 5 # Return top 5 after reranking
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
#### How It Works
|
|
427
|
+
|
|
428
|
+
```
|
|
429
|
+
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
430
|
+
│ Two-Stage Retrieval Flow │
|
|
431
|
+
├─────────────────────────────────────────────────────────────────────────────┤
|
|
432
|
+
│ │
|
|
433
|
+
│ Query: "heavy duty outdoor extension cord" │
|
|
434
|
+
│ │ │
|
|
435
|
+
│ ▼ │
|
|
436
|
+
│ ┌──────────────────────────────────────┐ │
|
|
437
|
+
│ │ Stage 1: Vector Similarity Search │ ◄── Fast, approximate matching │
|
|
438
|
+
│ │ • Returns 50 candidates │ Uses embedding similarity │
|
|
439
|
+
│ │ • Milliseconds latency │ │
|
|
440
|
+
│ └──────────────────────────────────────┘ │
|
|
441
|
+
│ │ │
|
|
442
|
+
│ ▼ 50 documents │
|
|
443
|
+
│ ┌──────────────────────────────────────┐ │
|
|
444
|
+
│ │ Stage 2: Cross-Encoder Rerank │ ◄── Precise relevance scoring │
|
|
445
|
+
│ │ • FlashRank (local, no API) │ Query-document interaction │
|
|
446
|
+
│ │ • Returns top 5 most relevant │ │
|
|
447
|
+
│ └──────────────────────────────────────┘ │
|
|
448
|
+
│ │ │
|
|
449
|
+
│ ▼ 5 documents (reordered by relevance) │
|
|
450
|
+
│ │
|
|
451
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
#### Why Reranking?
|
|
455
|
+
|
|
456
|
+
| Approach | Pros | Cons |
|
|
457
|
+
|----------|------|------|
|
|
458
|
+
| **Vector Search Only** | Fast, scalable | Embedding similarity ≠ relevance |
|
|
459
|
+
| **Reranking** | More accurate relevance | Slightly higher latency |
|
|
460
|
+
| **Both (Two-Stage)** | Best of both worlds | Optimal quality/speed tradeoff |
|
|
461
|
+
|
|
462
|
+
Vector embeddings capture semantic similarity but may rank loosely related documents highly. Cross-encoder reranking evaluates query-document pairs directly, dramatically improving result quality for the final user.
|
|
463
|
+
|
|
464
|
+
#### Available Models
|
|
465
|
+
|
|
466
|
+
| Model | Speed | Quality | Use Case |
|
|
467
|
+
|-------|-------|---------|----------|
|
|
468
|
+
| `ms-marco-TinyBERT-L-2-v2` | ⚡⚡⚡ Fastest | Good | High-throughput, latency-sensitive |
|
|
469
|
+
| `ms-marco-MiniLM-L-6-v2` | ⚡⚡ Fast | Better | Balanced performance |
|
|
470
|
+
| `ms-marco-MiniLM-L-12-v2` | ⚡ Moderate | Best | Default, recommended |
|
|
471
|
+
| `rank-T5-flan` | Slower | Excellent | Maximum accuracy |
|
|
472
|
+
|
|
473
|
+
#### Configuration Options
|
|
474
|
+
|
|
475
|
+
```yaml
|
|
476
|
+
rerank:
|
|
477
|
+
model: ms-marco-MiniLM-L-12-v2 # FlashRank model name
|
|
478
|
+
top_n: 10 # Documents to return (default: all)
|
|
479
|
+
cache_dir: /tmp/flashrank_cache # Model weights cache location
|
|
480
|
+
columns: [description, name] # Columns for Databricks Reranker (optional)
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
**Note:** Model weights are downloaded automatically on first use (~20MB for MiniLM-L-12-v2).
|
|
484
|
+
|
|
485
|
+
### 4. Human-in-the-Loop Approvals
|
|
486
|
+
|
|
487
|
+
Add approval gates to sensitive tool calls without changing tool code:
|
|
488
|
+
|
|
489
|
+
```yaml
|
|
490
|
+
tools:
|
|
491
|
+
dangerous_operation:
|
|
492
|
+
function:
|
|
493
|
+
type: python
|
|
494
|
+
name: my_package.dangerous_function
|
|
495
|
+
human_in_the_loop:
|
|
496
|
+
review_prompt: "This operation will modify production data. Approve?"
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
### 5. Memory & State Persistence
|
|
500
|
+
|
|
501
|
+
Configure conversation memory with in-memory or PostgreSQL backends:
|
|
502
|
+
|
|
503
|
+
```yaml
|
|
504
|
+
memory:
|
|
505
|
+
checkpointer:
|
|
506
|
+
name: conversation_checkpointer
|
|
507
|
+
type: postgres
|
|
508
|
+
database: *postgres_db
|
|
509
|
+
|
|
510
|
+
store:
|
|
511
|
+
name: user_preferences_store
|
|
512
|
+
type: postgres
|
|
513
|
+
database: *postgres_db
|
|
514
|
+
embedding_model: *embedding_model
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
### 6. Hook System
|
|
518
|
+
|
|
519
|
+
Inject custom logic at key points in the agent lifecycle:
|
|
520
|
+
|
|
521
|
+
```yaml
|
|
522
|
+
app:
|
|
523
|
+
# Run on startup
|
|
524
|
+
initialization_hooks:
|
|
525
|
+
- my_package.hooks.setup_connections
|
|
526
|
+
- my_package.hooks.warmup_caches
|
|
527
|
+
|
|
528
|
+
# Run on every message
|
|
529
|
+
message_hooks:
|
|
530
|
+
- dao_ai.hooks.require_user_id_hook
|
|
531
|
+
- my_package.hooks.log_request
|
|
532
|
+
|
|
533
|
+
# Run on shutdown
|
|
534
|
+
shutdown_hooks:
|
|
535
|
+
- my_package.hooks.cleanup_resources
|
|
536
|
+
|
|
537
|
+
agents:
|
|
538
|
+
my_agent:
|
|
539
|
+
# Run before/after agent execution
|
|
540
|
+
pre_agent_hook: my_package.hooks.enrich_context
|
|
541
|
+
post_agent_hook: my_package.hooks.collect_metrics
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
### 7. MLflow Prompt Registry Integration
|
|
545
|
+
|
|
546
|
+
Store and version prompts externally, enabling prompt engineers to iterate without code changes:
|
|
547
|
+
|
|
548
|
+
```yaml
|
|
549
|
+
prompts:
|
|
550
|
+
product_expert_prompt:
|
|
551
|
+
schema: *retail_schema
|
|
552
|
+
name: product_expert_prompt
|
|
553
|
+
alias: production # or version: 3
|
|
554
|
+
default_template: |
|
|
555
|
+
You are a product expert...
|
|
556
|
+
tags:
|
|
557
|
+
team: retail
|
|
558
|
+
environment: production
|
|
559
|
+
|
|
560
|
+
agents:
|
|
561
|
+
product_expert:
|
|
562
|
+
prompt: *product_expert_prompt # Loaded from MLflow registry
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
### 8. Automated Prompt Optimization
|
|
566
|
+
|
|
567
|
+
Use DSPy-style optimization to automatically improve prompts:
|
|
568
|
+
|
|
569
|
+
```yaml
|
|
570
|
+
optimizations:
|
|
571
|
+
prompt_optimizations:
|
|
572
|
+
optimize_diy_prompt:
|
|
573
|
+
prompt: *diy_prompt
|
|
574
|
+
agent: *diy_agent
|
|
575
|
+
dataset: *training_dataset
|
|
576
|
+
reflection_model: "openai:/gpt-4"
|
|
577
|
+
num_candidates: 5
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
---
|
|
581
|
+
|
|
582
|
+
## Quick Start
|
|
583
|
+
|
|
584
|
+
### Prerequisites
|
|
585
|
+
|
|
586
|
+
- Python 3.12+
|
|
587
|
+
- Databricks workspace with:
|
|
588
|
+
- Unity Catalog access
|
|
589
|
+
- Model Serving enabled
|
|
590
|
+
- (Optional) Vector Search, Genie
|
|
591
|
+
|
|
592
|
+
### Installation
|
|
593
|
+
|
|
594
|
+
```bash
|
|
595
|
+
# Clone and setup
|
|
596
|
+
git clone <repo-url>
|
|
597
|
+
cd dao-ai
|
|
598
|
+
|
|
599
|
+
# Create virtual environment
|
|
600
|
+
uv venv
|
|
601
|
+
source .venv/bin/activate
|
|
602
|
+
|
|
603
|
+
# Install
|
|
604
|
+
make install
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
### Your First Agent
|
|
608
|
+
|
|
609
|
+
1. **Create a minimal configuration** (`config/my_agent.yaml`):
|
|
610
|
+
|
|
611
|
+
```yaml
|
|
612
|
+
schemas:
|
|
613
|
+
my_schema: &my_schema
|
|
614
|
+
catalog_name: my_catalog
|
|
615
|
+
schema_name: my_schema
|
|
616
|
+
|
|
617
|
+
resources:
|
|
618
|
+
llms:
|
|
619
|
+
default_llm: &default_llm
|
|
620
|
+
name: databricks-meta-llama-3-3-70b-instruct
|
|
621
|
+
|
|
622
|
+
agents:
|
|
623
|
+
assistant: &assistant
|
|
624
|
+
name: assistant
|
|
625
|
+
model: *default_llm
|
|
626
|
+
prompt: |
|
|
627
|
+
You are a helpful assistant.
|
|
628
|
+
|
|
629
|
+
app:
|
|
630
|
+
name: my_first_agent
|
|
631
|
+
registered_model:
|
|
632
|
+
schema: *my_schema
|
|
633
|
+
name: my_first_agent
|
|
634
|
+
agents:
|
|
635
|
+
- *assistant
|
|
636
|
+
orchestration:
|
|
637
|
+
swarm:
|
|
638
|
+
model: *default_llm
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
2. **Validate your configuration**:
|
|
642
|
+
|
|
643
|
+
```bash
|
|
644
|
+
dao-ai validate -c config/my_agent.yaml
|
|
645
|
+
```
|
|
646
|
+
|
|
647
|
+
3. **Visualize the agent graph**:
|
|
648
|
+
|
|
649
|
+
```bash
|
|
650
|
+
dao-ai graph -c config/my_agent.yaml -o my_agent.png
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
4. **Deploy to Databricks**:
|
|
654
|
+
|
|
655
|
+
```python
|
|
656
|
+
from dao_ai.config import AppConfig
|
|
657
|
+
|
|
658
|
+
config = AppConfig.from_file("config/my_agent.yaml")
|
|
659
|
+
config.create_agent() # Package as MLflow model
|
|
660
|
+
config.deploy_agent() # Deploy to serving endpoint
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
Or via CLI:
|
|
664
|
+
```bash
|
|
665
|
+
dao-ai bundle --deploy --run -c config/my_agent.yaml
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
### Interact with Your Agent
|
|
669
|
+
|
|
670
|
+
```python
|
|
671
|
+
from mlflow.deployments import get_deploy_client
|
|
672
|
+
|
|
673
|
+
client = get_deploy_client("databricks")
|
|
674
|
+
response = client.predict(
|
|
675
|
+
endpoint="my_first_agent",
|
|
676
|
+
inputs={
|
|
677
|
+
"messages": [{"role": "user", "content": "Hello!"}],
|
|
678
|
+
"configurable": {"thread_id": "1", "user_id": "demo_user"}
|
|
679
|
+
}
|
|
680
|
+
)
|
|
681
|
+
print(response["message"]["content"])
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
---
|
|
685
|
+
|
|
686
|
+
## Configuration Reference
|
|
687
|
+
|
|
688
|
+
### Full Configuration Structure
|
|
689
|
+
|
|
690
|
+
```yaml
|
|
691
|
+
# Schema definitions for Unity Catalog
|
|
692
|
+
schemas:
|
|
693
|
+
my_schema: &my_schema
|
|
694
|
+
catalog_name: string
|
|
695
|
+
schema_name: string
|
|
696
|
+
|
|
697
|
+
# Reusable variables (secrets, env vars)
|
|
698
|
+
variables:
|
|
699
|
+
api_key: &api_key
|
|
700
|
+
options:
|
|
701
|
+
- env: MY_API_KEY
|
|
702
|
+
- scope: my_scope
|
|
703
|
+
secret: api_key
|
|
704
|
+
|
|
705
|
+
# Infrastructure resources
|
|
706
|
+
resources:
|
|
707
|
+
llms:
|
|
708
|
+
model_name: &model_name
|
|
709
|
+
name: string # Databricks endpoint name
|
|
710
|
+
temperature: float # 0.0 - 2.0
|
|
711
|
+
max_tokens: int
|
|
712
|
+
fallbacks: [string] # Fallback model names
|
|
713
|
+
on_behalf_of_user: bool # Use caller's permissions
|
|
714
|
+
|
|
715
|
+
vector_stores:
|
|
716
|
+
store_name: &store_name
|
|
717
|
+
endpoint:
|
|
718
|
+
name: string
|
|
719
|
+
type: STANDARD | OPTIMIZED_STORAGE
|
|
720
|
+
index:
|
|
721
|
+
schema: *my_schema
|
|
722
|
+
name: string
|
|
723
|
+
source_table:
|
|
724
|
+
schema: *my_schema
|
|
725
|
+
name: string
|
|
726
|
+
embedding_model: *embedding_model
|
|
727
|
+
embedding_source_column: string
|
|
728
|
+
columns: [string]
|
|
729
|
+
|
|
730
|
+
databases:
|
|
731
|
+
postgres_db: &postgres_db
|
|
732
|
+
instance_name: string
|
|
733
|
+
client_id: *api_key # OAuth credentials
|
|
734
|
+
client_secret: *secret
|
|
735
|
+
workspace_host: string
|
|
736
|
+
|
|
737
|
+
warehouses:
|
|
738
|
+
warehouse: &warehouse
|
|
739
|
+
warehouse_id: string
|
|
740
|
+
on_behalf_of_user: bool
|
|
741
|
+
|
|
742
|
+
genie_rooms:
|
|
743
|
+
genie: &genie
|
|
744
|
+
space_id: string
|
|
745
|
+
|
|
746
|
+
# Retriever configurations
|
|
747
|
+
retrievers:
|
|
748
|
+
retriever_name: &retriever_name
|
|
749
|
+
vector_store: *store_name
|
|
750
|
+
columns: [string]
|
|
751
|
+
search_parameters:
|
|
752
|
+
num_results: int
|
|
753
|
+
query_type: ANN | HYBRID
|
|
754
|
+
|
|
755
|
+
# Tool definitions
|
|
756
|
+
tools:
|
|
757
|
+
tool_name: &tool_name
|
|
758
|
+
name: string
|
|
759
|
+
function:
|
|
760
|
+
type: python | factory | unity_catalog | mcp
|
|
761
|
+
name: string # Import path or UC function name
|
|
762
|
+
args: {} # For factory tools
|
|
763
|
+
schema: *my_schema # For UC tools
|
|
764
|
+
human_in_the_loop: # Optional approval gate
|
|
765
|
+
review_prompt: string
|
|
766
|
+
|
|
767
|
+
# Agent definitions
|
|
768
|
+
agents:
|
|
769
|
+
agent_name: &agent_name
|
|
770
|
+
name: string
|
|
771
|
+
description: string
|
|
772
|
+
model: *model_name
|
|
773
|
+
tools: [*tool_name]
|
|
774
|
+
prompt: string | *prompt_ref
|
|
775
|
+
handoff_prompt: string # For swarm routing
|
|
776
|
+
pre_agent_hook: string # Python function path
|
|
777
|
+
post_agent_hook: string
|
|
778
|
+
|
|
779
|
+
# Prompt definitions (MLflow registry)
|
|
780
|
+
prompts:
|
|
781
|
+
prompt_name: &prompt_name
|
|
782
|
+
schema: *my_schema
|
|
783
|
+
name: string
|
|
784
|
+
alias: string | null # e.g., "production"
|
|
785
|
+
version: int | null
|
|
786
|
+
default_template: string
|
|
787
|
+
tags: {}
|
|
788
|
+
|
|
789
|
+
# Memory configuration
|
|
790
|
+
memory: &memory
|
|
791
|
+
checkpointer:
|
|
792
|
+
name: string
|
|
793
|
+
type: memory | postgres
|
|
794
|
+
database: *postgres_db
|
|
795
|
+
store:
|
|
796
|
+
name: string
|
|
797
|
+
type: memory | postgres
|
|
798
|
+
database: *postgres_db
|
|
799
|
+
embedding_model: *embedding_model
|
|
800
|
+
|
|
801
|
+
# Application configuration
|
|
802
|
+
app:
|
|
803
|
+
name: string
|
|
804
|
+
description: string
|
|
805
|
+
log_level: DEBUG | INFO | WARNING | ERROR
|
|
806
|
+
|
|
807
|
+
registered_model:
|
|
808
|
+
schema: *my_schema
|
|
809
|
+
name: string
|
|
810
|
+
|
|
811
|
+
endpoint_name: string
|
|
812
|
+
|
|
813
|
+
agents: [*agent_name]
|
|
814
|
+
|
|
815
|
+
orchestration:
|
|
816
|
+
supervisor: # OR swarm, not both
|
|
817
|
+
model: *model_name
|
|
818
|
+
prompt: string
|
|
819
|
+
swarm:
|
|
820
|
+
model: *model_name
|
|
821
|
+
default_agent: *agent_name
|
|
822
|
+
handoffs:
|
|
823
|
+
agent_a: [agent_b, agent_c]
|
|
824
|
+
memory: *memory
|
|
825
|
+
|
|
826
|
+
initialization_hooks: [string]
|
|
827
|
+
message_hooks: [string]
|
|
828
|
+
shutdown_hooks: [string]
|
|
829
|
+
|
|
830
|
+
permissions:
|
|
831
|
+
- principals: [users]
|
|
832
|
+
entitlements: [CAN_QUERY]
|
|
833
|
+
|
|
834
|
+
environment_vars:
|
|
835
|
+
KEY: "{{secrets/scope/secret}}"
|
|
836
|
+
```
|
|
837
|
+
|
|
838
|
+
---
|
|
839
|
+
|
|
840
|
+
## Example Configurations
|
|
841
|
+
|
|
842
|
+
The `config/examples/` directory contains ready-to-use configurations:
|
|
843
|
+
|
|
844
|
+
| Example | Description |
|
|
845
|
+
|---------|-------------|
|
|
846
|
+
| `minimal.yaml` | Simplest possible agent configuration |
|
|
847
|
+
| `genie.yaml` | Natural language to SQL with Genie |
|
|
848
|
+
| `genie_with_lru_cache.yaml` | Genie with LRU caching |
|
|
849
|
+
| `genie_with_semantic_cache.yaml` | Genie with two-tier caching |
|
|
850
|
+
| `human_in_the_loop.yaml` | Tool approval workflows |
|
|
851
|
+
| `mcp.yaml` | External service integration via MCP |
|
|
852
|
+
| `prompt_optimization.yaml` | Automated prompt tuning |
|
|
853
|
+
| `vector_search_with_reranking.yaml` | RAG with reranking |
|
|
854
|
+
| `deep_research.yaml` | Multi-step research agent |
|
|
855
|
+
| `slack.yaml` | Slack integration |
|
|
856
|
+
|
|
857
|
+
---
|
|
858
|
+
|
|
859
|
+
## CLI Reference
|
|
860
|
+
|
|
861
|
+
```bash
|
|
862
|
+
# Validate configuration
|
|
863
|
+
dao-ai validate -c config/my_config.yaml
|
|
864
|
+
|
|
865
|
+
# Generate JSON schema for IDE support
|
|
866
|
+
dao-ai schema > schemas/model_config_schema.json
|
|
867
|
+
|
|
868
|
+
# Visualize agent workflow
|
|
869
|
+
dao-ai graph -c config/my_config.yaml -o workflow.png
|
|
870
|
+
|
|
871
|
+
# Deploy with Databricks Asset Bundles
|
|
872
|
+
dao-ai bundle --deploy --run -c config/my_config.yaml --profile DEFAULT
|
|
873
|
+
|
|
874
|
+
# Verbose output (-v through -vvvv)
|
|
875
|
+
dao-ai -vvvv validate -c config/my_config.yaml
|
|
876
|
+
```
|
|
877
|
+
|
|
878
|
+
---
|
|
879
|
+
|
|
880
|
+
## Python API
|
|
881
|
+
|
|
882
|
+
```python
|
|
883
|
+
from dao_ai.config import AppConfig
|
|
884
|
+
|
|
885
|
+
# Load configuration
|
|
886
|
+
config = AppConfig.from_file("config/my_config.yaml")
|
|
887
|
+
|
|
888
|
+
# Access components
|
|
889
|
+
agents = config.find_agents()
|
|
890
|
+
tools = config.find_tools()
|
|
891
|
+
vector_stores = config.resources.vector_stores
|
|
892
|
+
|
|
893
|
+
# Create infrastructure
|
|
894
|
+
for name, vs in vector_stores.items():
|
|
895
|
+
vs.create()
|
|
896
|
+
|
|
897
|
+
# Package and deploy
|
|
898
|
+
config.create_agent(
|
|
899
|
+
additional_pip_reqs=["custom-package==1.0.0"],
|
|
900
|
+
additional_code_paths=["./my_modules"]
|
|
901
|
+
)
|
|
902
|
+
config.deploy_agent()
|
|
903
|
+
|
|
904
|
+
# Visualize
|
|
905
|
+
config.display_graph()
|
|
906
|
+
config.save_image("docs/architecture.png")
|
|
907
|
+
```
|
|
908
|
+
|
|
909
|
+
---
|
|
910
|
+
|
|
911
|
+
## Project Structure
|
|
912
|
+
|
|
913
|
+
```
|
|
914
|
+
dao-ai/
|
|
915
|
+
├── src/dao_ai/
|
|
916
|
+
│ ├── config.py # Pydantic configuration models
|
|
917
|
+
│ ├── graph.py # LangGraph workflow builder
|
|
918
|
+
│ ├── nodes.py # Agent node factories
|
|
919
|
+
│ ├── state.py # State management
|
|
920
|
+
│ ├── tools/ # Tool implementations
|
|
921
|
+
│ │ ├── genie.py # Genie tool with caching
|
|
922
|
+
│ │ ├── mcp.py # MCP integrations
|
|
923
|
+
│ │ ├── vector_search.py
|
|
924
|
+
│ │ └── ...
|
|
925
|
+
│ ├── genie/
|
|
926
|
+
│ │ └── cache/ # LRU and Semantic cache
|
|
927
|
+
│ ├── memory/ # Checkpointer and store
|
|
928
|
+
│ └── hooks/ # Lifecycle hooks
|
|
929
|
+
├── config/
|
|
930
|
+
│ ├── examples/ # Example configurations
|
|
931
|
+
│ └── hardware_store/ # Reference implementation
|
|
932
|
+
├── tests/ # Test suite
|
|
933
|
+
└── schemas/ # JSON schemas for validation
|
|
934
|
+
```
|
|
935
|
+
|
|
936
|
+
---
|
|
937
|
+
|
|
938
|
+
## Contributing
|
|
939
|
+
|
|
940
|
+
1. Fork the repository
|
|
941
|
+
2. Create a feature branch
|
|
942
|
+
3. Make your changes
|
|
943
|
+
4. Run tests: `make test`
|
|
944
|
+
5. Format code: `make format`
|
|
945
|
+
6. Submit a pull request
|
|
946
|
+
|
|
947
|
+
---
|
|
948
|
+
|
|
949
|
+
## License
|
|
950
|
+
|
|
951
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|