flock-core 0.5.0b54__py3-none-any.whl → 0.5.0b56__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.
Potentially problematic release.
This version of flock-core might be problematic. Click here for more details.
- flock/logging/telemetry_exporter/duckdb_exporter.py +6 -6
- flock/store.py +34 -1
- flock_core-0.5.0b56.dist-info/METADATA +943 -0
- {flock_core-0.5.0b54.dist-info → flock_core-0.5.0b56.dist-info}/RECORD +7 -7
- flock_core-0.5.0b54.dist-info/METADATA +0 -916
- {flock_core-0.5.0b54.dist-info → flock_core-0.5.0b56.dist-info}/WHEEL +0 -0
- {flock_core-0.5.0b54.dist-info → flock_core-0.5.0b56.dist-info}/entry_points.txt +0 -0
- {flock_core-0.5.0b54.dist-info → flock_core-0.5.0b56.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,943 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: flock-core
|
|
3
|
+
Version: 0.5.0b56
|
|
4
|
+
Summary: Add your description here
|
|
5
|
+
Author-email: Andre Ratzenberger <andre.ratzenberger@whiteduck.de>
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Requires-Dist: devtools>=0.12.2
|
|
9
|
+
Requires-Dist: dspy==3.0.0
|
|
10
|
+
Requires-Dist: duckdb>=1.1.0
|
|
11
|
+
Requires-Dist: fastapi>=0.117.1
|
|
12
|
+
Requires-Dist: httpx>=0.28.1
|
|
13
|
+
Requires-Dist: litellm==1.75.3
|
|
14
|
+
Requires-Dist: loguru>=0.7.3
|
|
15
|
+
Requires-Dist: mcp>=1.7.1
|
|
16
|
+
Requires-Dist: opentelemetry-api>=1.30.0
|
|
17
|
+
Requires-Dist: opentelemetry-exporter-jaeger-proto-grpc>=1.21.0
|
|
18
|
+
Requires-Dist: opentelemetry-exporter-jaeger>=1.21.0
|
|
19
|
+
Requires-Dist: opentelemetry-exporter-otlp>=1.30.0
|
|
20
|
+
Requires-Dist: opentelemetry-instrumentation-logging>=0.51b0
|
|
21
|
+
Requires-Dist: opentelemetry-sdk>=1.30.0
|
|
22
|
+
Requires-Dist: poethepoet>=0.30.0
|
|
23
|
+
Requires-Dist: pydantic[email]>=2.11.9
|
|
24
|
+
Requires-Dist: rich>=14.1.0
|
|
25
|
+
Requires-Dist: toml>=0.10.2
|
|
26
|
+
Requires-Dist: typer>=0.19.2
|
|
27
|
+
Requires-Dist: uvicorn>=0.37.0
|
|
28
|
+
Requires-Dist: websockets>=15.0.1
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
<p align="center">
|
|
32
|
+
<img alt="Flock Banner" src="https://raw.githubusercontent.com/whiteducksoftware/flock/master/docs/assets/images/flock.png" width="800">
|
|
33
|
+
</p>
|
|
34
|
+
<p align="center">
|
|
35
|
+
<a href="https://pypi.org/project/flock-core/" target="_blank"><img alt="PyPI Version" src="https://img.shields.io/pypi/v/flock-core?style=for-the-badge&logo=pypi&label=pip%20version"></a>
|
|
36
|
+
<img alt="Python Version" src="https://img.shields.io/badge/python-3.10%2B-blue?style=for-the-badge&logo=python">
|
|
37
|
+
<a href="LICENSE" target="_blank"><img alt="License" src="https://img.shields.io/pypi/l/flock-core?style=for-the-badge"></a>
|
|
38
|
+
<a href="https://whiteduck.de" target="_blank"><img alt="Built by white duck" src="https://img.shields.io/badge/Built%20by-white%20duck%20GmbH-white?style=for-the-badge&labelColor=black"></a>
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
# Flock 0.5: Declarative Blackboard Multi-Agent Orchestration
|
|
44
|
+
|
|
45
|
+
> **Stop engineering prompts. Start declaring contracts.**
|
|
46
|
+
|
|
47
|
+
Flock is a production-focused framework for orchestrating AI agents through **declarative type contracts** and **blackboard architecture**, proven patterns from distributed systems, decades of engaging with micro-service landscapes and classical AI, now applied to modern LLMs.
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## The Problem With Current Approaches
|
|
54
|
+
|
|
55
|
+
Building production multi-agent systems today means dealing with:
|
|
56
|
+
|
|
57
|
+
**🔥 Prompt Engineering Hell**
|
|
58
|
+
```python
|
|
59
|
+
|
|
60
|
+
prompt = """You are an expert code reviewer. When you receive code, you should...
|
|
61
|
+
[498 more lines of instructions that the LLM ignores half the time]"""
|
|
62
|
+
|
|
63
|
+
# 500-line prompt that breaks when models update
|
|
64
|
+
|
|
65
|
+
# How do I know that there isn't an even better prompt (you don't) -> proof of 'best possible performane' impossible
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**🧪 Testing Nightmares**
|
|
69
|
+
```python
|
|
70
|
+
# How do you unit test this?
|
|
71
|
+
result = llm.invoke(prompt) # Hope for valid JSON
|
|
72
|
+
data = json.loads(result.content) # Crashes in production
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**📐 Rigid topology and tight coupling**
|
|
76
|
+
```python
|
|
77
|
+
# Want to add a new agent? Rewrite the entire graph.
|
|
78
|
+
workflow.add_edge("agent_a", "agent_b")
|
|
79
|
+
workflow.add_edge("agent_b", "agent_c")
|
|
80
|
+
# Add agent_d? Start rewiring...
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**💀 Single point of failure: Orchestrator dies? Everything dies.**
|
|
84
|
+
```python
|
|
85
|
+
# Orchestrator dies? Everything dies.
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**🧠 God object anti-pattern:**
|
|
89
|
+
```python
|
|
90
|
+
# One orchestrator needs domain knowledge of 20+ agents to route correctly
|
|
91
|
+
# Orchestrator 'guesses' next agent based on a natural language description. Hardly fit for critical systems.
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
These aren't framework limitations, they're **architectural choices** that don't scale.
|
|
95
|
+
|
|
96
|
+
Most issues are solvable, because decades of experience with micro services taught us hard lessons about decoupling, orchestration and reliability already. Let's use these learnings!
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## The Flock Approach
|
|
101
|
+
|
|
102
|
+
Flock takes a different path, combining two proven patterns:
|
|
103
|
+
|
|
104
|
+
### 1. Declarative Type Contracts (Not Prompts)
|
|
105
|
+
|
|
106
|
+
**Traditional approach:**
|
|
107
|
+
```python
|
|
108
|
+
prompt = "Analyze this bug report and return JSON with severity, category, hypothesis..."
|
|
109
|
+
result = llm.invoke(prompt) # Hope it works
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**The Flock way:**
|
|
113
|
+
```python
|
|
114
|
+
@flock_type
|
|
115
|
+
class BugDiagnosis(BaseModel):
|
|
116
|
+
severity: str = Field(pattern="^(Critical|High|Medium|Low)$")
|
|
117
|
+
category: str = Field(description="Bug category")
|
|
118
|
+
root_cause_hypothesis: str = Field(min_length=50)
|
|
119
|
+
confidence_score: float = Field(ge=0.0, le=1.0)
|
|
120
|
+
|
|
121
|
+
# The schema IS the instruction. No 500-line prompt needed.
|
|
122
|
+
agent.consumes(BugReport).publishes(BugDiagnosis)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
<p align="center">
|
|
126
|
+
<img alt="Flock Banner" src="docs/img/bug_diagnosis.png" width="1000">
|
|
127
|
+
</p>
|
|
128
|
+
|
|
129
|
+
**Why this matters:**
|
|
130
|
+
- ✅ **Survives model upgrades** - GPT-6 will still understand Pydantic schemas
|
|
131
|
+
- ✅ **Runtime validation** - Errors caught at parse time, not in production
|
|
132
|
+
- ✅ **Testable** - Mock inputs/outputs with concrete types
|
|
133
|
+
- ✅ **Self-documenting** - The code tells you what agents do
|
|
134
|
+
|
|
135
|
+
### 2. Blackboard Architecture (Not Directed Graphs)
|
|
136
|
+
|
|
137
|
+
**Graph-based approach:**
|
|
138
|
+
```python
|
|
139
|
+
# Explicit workflow with hardcoded edges
|
|
140
|
+
workflow.add_edge("radiologist", "diagnostician")
|
|
141
|
+
workflow.add_edge("lab_tech", "diagnostician")
|
|
142
|
+
# Add performance_analyzer? Rewrite the graph.
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**The Flock way (blackboard):**
|
|
146
|
+
```python
|
|
147
|
+
# Agents subscribe to types, workflows emerge
|
|
148
|
+
radiologist = flock.agent("radiologist").consumes(Scan).publishes(XRayAnalysis)
|
|
149
|
+
lab_tech = flock.agent("lab_tech").consumes(Scan).publishes(LabResults)
|
|
150
|
+
diagnostician = flock.agent("diagnostician").consumes(XRayAnalysis, LabResults).publishes(Diagnosis)
|
|
151
|
+
|
|
152
|
+
# Add performance_analyzer? Just subscribe it:
|
|
153
|
+
performance = flock.agent("perf").consumes(Scan).publishes(PerfAnalysis)
|
|
154
|
+
# Done. No graph rewiring. Diagnostician can optionally consume it.
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**What just happened:**
|
|
158
|
+
- ✅ **Parallel execution** - Radiologist and lab_tech run concurrently (automatic)
|
|
159
|
+
- ✅ **Dependency resolution** - Diagnostician waits for both inputs (automatic)
|
|
160
|
+
- ✅ **Loose coupling** - Agents don't know about each other, just data types
|
|
161
|
+
- ✅ **Scalable** - O(n) complexity, not O(n²) edges
|
|
162
|
+
|
|
163
|
+
**This is not a new idea.** Blackboard architecture powered groundbreaking AI systems since the 1970s (Hearsay-II, HASP/SIAP, BB1). We're applying proven patterns to modern LLMs.
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Quick Start (60 Seconds)
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
pip install flock-core
|
|
171
|
+
export OPENAI_API_KEY="sk-..."
|
|
172
|
+
# Optional: export DEFAULT_MODEL (falls back to hard-coded default if unset)
|
|
173
|
+
export DEFAULT_MODEL="openai/gpt-4.1"
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
import os
|
|
178
|
+
import asyncio
|
|
179
|
+
from pydantic import BaseModel, Field
|
|
180
|
+
from flock import Flock, flock_type
|
|
181
|
+
|
|
182
|
+
# 1. Define typed artifacts
|
|
183
|
+
@flock_type
|
|
184
|
+
class CodeSubmission(BaseModel):
|
|
185
|
+
code: str
|
|
186
|
+
language: str
|
|
187
|
+
|
|
188
|
+
@flock_type
|
|
189
|
+
class BugAnalysis(BaseModel):
|
|
190
|
+
bugs_found: list[str]
|
|
191
|
+
severity: str = Field(pattern="^(Critical|High|Medium|Low|None)$")
|
|
192
|
+
confidence: float = Field(ge=0.0, le=1.0)
|
|
193
|
+
|
|
194
|
+
@flock_type
|
|
195
|
+
class SecurityAnalysis(BaseModel):
|
|
196
|
+
vulnerabilities: list[str]
|
|
197
|
+
risk_level: str = Field(pattern="^(Critical|High|Medium|Low|None)$")
|
|
198
|
+
|
|
199
|
+
@flock_type
|
|
200
|
+
class FinalReview(BaseModel):
|
|
201
|
+
overall_assessment: str = Field(pattern="^(Approve|Approve with Changes|Reject)$")
|
|
202
|
+
action_items: list[str]
|
|
203
|
+
|
|
204
|
+
# 2. Create the blackboard
|
|
205
|
+
flock = Flock(os.getenv("DEFAULT_MODEL", "openai/gpt-4.1"))
|
|
206
|
+
|
|
207
|
+
# 3. Agents subscribe to types (NO graph wiring!)
|
|
208
|
+
bug_detector = flock.agent("bug_detector").consumes(CodeSubmission).publishes(BugAnalysis)
|
|
209
|
+
security_auditor = flock.agent("security_auditor").consumes(CodeSubmission).publishes(SecurityAnalysis)
|
|
210
|
+
|
|
211
|
+
# This agent AUTOMATICALLY waits for both analyses
|
|
212
|
+
final_reviewer = flock.agent("final_reviewer").consumes(BugAnalysis, SecurityAnalysis).publishes(FinalReview)
|
|
213
|
+
|
|
214
|
+
# 4. Run with real-time dashboard
|
|
215
|
+
async def main():
|
|
216
|
+
await flock.serve(dashboard=True)
|
|
217
|
+
|
|
218
|
+
asyncio.run(main())
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**What happened:**
|
|
222
|
+
- Bug detector and security auditor ran **in parallel** (both consume CodeSubmission)
|
|
223
|
+
- Final reviewer **automatically waited** for both
|
|
224
|
+
- **Zero prompts written** - types defined the behavior
|
|
225
|
+
- **Zero graph edges** - subscriptions created the workflow
|
|
226
|
+
- **Full type safety** - Pydantic validates all outputs
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Core Concepts
|
|
231
|
+
|
|
232
|
+
### Typed Artifacts (The Vocabulary)
|
|
233
|
+
|
|
234
|
+
Every piece of data on the blackboard is a validated Pydantic model:
|
|
235
|
+
|
|
236
|
+
```python
|
|
237
|
+
@flock_type
|
|
238
|
+
class PatientDiagnosis(BaseModel):
|
|
239
|
+
condition: str = Field(min_length=10)
|
|
240
|
+
confidence: float = Field(ge=0.0, le=1.0)
|
|
241
|
+
recommended_treatment: list[str] = Field(min_length=1)
|
|
242
|
+
follow_up_required: bool
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**Benefits:**
|
|
246
|
+
- Runtime validation ensures quality
|
|
247
|
+
- Field constraints prevent bad outputs
|
|
248
|
+
- Self-documenting data structures
|
|
249
|
+
- Version-safe (types survive model updates)
|
|
250
|
+
|
|
251
|
+
### Agent Subscriptions (The Rules)
|
|
252
|
+
|
|
253
|
+
Agents declare what they consume and produce:
|
|
254
|
+
|
|
255
|
+
```python
|
|
256
|
+
analyzer = (
|
|
257
|
+
flock.agent("analyzer")
|
|
258
|
+
.description("Analyzes patient scans") # Optional: improves multi-agent coordination
|
|
259
|
+
.consumes(PatientScan) # What triggers this agent
|
|
260
|
+
.publishes(PatientDiagnosis) # What it produces
|
|
261
|
+
)
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**Advanced subscriptions:**
|
|
265
|
+
|
|
266
|
+
```python
|
|
267
|
+
# Conditional consumption - only high-severity cases
|
|
268
|
+
urgent_care = flock.agent("urgent").consumes(
|
|
269
|
+
Diagnosis,
|
|
270
|
+
where=lambda d: d.severity in ["Critical", "High"]
|
|
271
|
+
)
|
|
272
|
+
|
|
273
|
+
# Batch processing - wait for 10 items
|
|
274
|
+
batch_processor = flock.agent("batch").consumes(
|
|
275
|
+
Event,
|
|
276
|
+
batch=BatchSpec(size=10, timeout=timedelta(seconds=30))
|
|
277
|
+
)
|
|
278
|
+
|
|
279
|
+
# Join operations - wait for multiple types within time window
|
|
280
|
+
correlator = flock.agent("correlator").consumes(
|
|
281
|
+
SignalA,
|
|
282
|
+
SignalB,
|
|
283
|
+
join=JoinSpec(within=timedelta(minutes=5))
|
|
284
|
+
)
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Visibility Controls (The Security)
|
|
288
|
+
|
|
289
|
+
**Unlike other frameworks, Flock has zero-trust security built-in:**
|
|
290
|
+
|
|
291
|
+
```python
|
|
292
|
+
# Multi-tenancy (SaaS isolation)
|
|
293
|
+
agent.publishes(CustomerData, visibility=TenantVisibility(tenant_id="customer_123"))
|
|
294
|
+
|
|
295
|
+
# Explicit allowlist (HIPAA compliance)
|
|
296
|
+
agent.publishes(MedicalRecord, visibility=PrivateVisibility(agents={"physician", "nurse"}))
|
|
297
|
+
|
|
298
|
+
# Role-based access control
|
|
299
|
+
agent.identity(AgentIdentity(name="analyst", labels={"clearance:secret"}))
|
|
300
|
+
agent.publishes(IntelReport, visibility=LabelledVisibility(required_labels={"clearance:secret"}))
|
|
301
|
+
|
|
302
|
+
# Time-delayed release (embargo periods)
|
|
303
|
+
artifact.visibility = AfterVisibility(ttl=timedelta(hours=24), then=PublicVisibility())
|
|
304
|
+
|
|
305
|
+
# Public (default)
|
|
306
|
+
agent.publishes(PublicReport, visibility=PublicVisibility())
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
**Why this matters:** Financial services, healthcare, defense, SaaS platforms all need this for compliance. Other frameworks make you build it yourself.
|
|
310
|
+
|
|
311
|
+
### Batching Pattern: Parallel Execution Control
|
|
312
|
+
|
|
313
|
+
**A key differentiator:** The separation of `publish()` and `run_until_idle()` enables parallel execution.
|
|
314
|
+
|
|
315
|
+
```python
|
|
316
|
+
# ✅ EFFICIENT: Batch publish, then run in parallel
|
|
317
|
+
for review in customer_reviews:
|
|
318
|
+
await flock.publish(review) # Just scheduling work
|
|
319
|
+
|
|
320
|
+
await flock.run_until_idle() # All sentiment_analyzer agents run concurrently!
|
|
321
|
+
|
|
322
|
+
# Get all results
|
|
323
|
+
analyses = await flock.store.get_by_type(SentimentAnalysis)
|
|
324
|
+
# 100 analyses completed in ~1x single review processing time!
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
**Why this separation matters:**
|
|
328
|
+
- ⚡ **Parallel execution** - Process 100 customer reviews concurrently
|
|
329
|
+
- 🎯 **Batch control** - Publish multiple artifacts, execute once
|
|
330
|
+
- 🔄 **Multi-type workflows** - Publish different types, trigger different agents in parallel
|
|
331
|
+
- 📊 **Better performance** - Process 1000 items in the time it takes to process 1
|
|
332
|
+
|
|
333
|
+
**Comparison to other patterns:**
|
|
334
|
+
```python
|
|
335
|
+
# ❌ If run_until_idle() was automatic (like most frameworks):
|
|
336
|
+
for review in customer_reviews:
|
|
337
|
+
await flock.publish(review) # Would wait for completion each time!
|
|
338
|
+
# Total time: 100x single execution (sequential)
|
|
339
|
+
|
|
340
|
+
# ✅ With explicit batching:
|
|
341
|
+
for review in customer_reviews:
|
|
342
|
+
await flock.publish(review) # Fast: just queuing
|
|
343
|
+
await flock.run_until_idle()
|
|
344
|
+
# Total time: ~1x single execution (parallel)
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### Production Safety Features
|
|
348
|
+
|
|
349
|
+
**Built-in safeguards prevent common production failures:**
|
|
350
|
+
|
|
351
|
+
```python
|
|
352
|
+
# Circuit breakers prevent runaway costs
|
|
353
|
+
flock = Flock("openai/gpt-4.1", max_agent_iterations=1000)
|
|
354
|
+
|
|
355
|
+
# Feedback loop protection
|
|
356
|
+
critic = (
|
|
357
|
+
flock.agent("critic")
|
|
358
|
+
.consumes(Essay)
|
|
359
|
+
.publishes(Critique)
|
|
360
|
+
.prevent_self_trigger(True) # Won't trigger itself infinitely
|
|
361
|
+
)
|
|
362
|
+
|
|
363
|
+
# Best-of-N execution (run 5x, pick best)
|
|
364
|
+
agent.best_of(5, score=lambda result: result.metrics["confidence"])
|
|
365
|
+
|
|
366
|
+
# Configuration validation
|
|
367
|
+
agent.best_of(150, ...) # ⚠️ Warns: "best_of(150) is very high - high LLM costs"
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## Production-Ready Observability
|
|
373
|
+
|
|
374
|
+
### Real-Time Dashboard
|
|
375
|
+
|
|
376
|
+
**Start the dashboard with one line:**
|
|
377
|
+
|
|
378
|
+
```python
|
|
379
|
+
await flock.serve(dashboard=True)
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
The dashboard provides comprehensive real-time visibility into your agent system with professional UI/UX:
|
|
383
|
+
|
|
384
|
+
<p align="center">
|
|
385
|
+
<img alt="Flock Agent View" src="docs/img/flock_ui_agent_view.png" width="1000">
|
|
386
|
+
<i>Agent View: See agent communication patterns and message flows in real-time</i>
|
|
387
|
+
</p>
|
|
388
|
+
|
|
389
|
+
**Key Features:**
|
|
390
|
+
|
|
391
|
+
- **Dual Visualization Modes:**
|
|
392
|
+
- **Agent View** - Agents as nodes with message flows as edges
|
|
393
|
+
- **Blackboard View** - Messages as nodes with data transformations as edges
|
|
394
|
+
|
|
395
|
+
<p align="center">
|
|
396
|
+
<img alt="Flock Blackboard View" src="docs/img/flock_ui_blackboard_view.png" width="1000">
|
|
397
|
+
<i>Blackboard View: Track data lineage and transformations across the system</i>
|
|
398
|
+
</p>
|
|
399
|
+
|
|
400
|
+
- **Real-Time Updates:**
|
|
401
|
+
- WebSocket streaming with 2-minute heartbeat
|
|
402
|
+
- Live agent activation and message publication
|
|
403
|
+
- Auto-layout with Dagre algorithm
|
|
404
|
+
|
|
405
|
+
- **Interactive Graph:**
|
|
406
|
+
- Drag nodes, zoom, pan, and explore topology
|
|
407
|
+
- Double-click nodes to open detail windows
|
|
408
|
+
- Right-click for context menu and modules
|
|
409
|
+
|
|
410
|
+
- **Advanced Filtering:**
|
|
411
|
+
- Correlation ID tracking for workflow tracing
|
|
412
|
+
- Time range filtering (last 5/10/60 minutes or custom)
|
|
413
|
+
- Active filter pills with one-click removal
|
|
414
|
+
- Autocomplete search with metadata preview
|
|
415
|
+
|
|
416
|
+
- **Control Panel:**
|
|
417
|
+
- Publish artifacts from the UI
|
|
418
|
+
- Invoke agents manually
|
|
419
|
+
- Monitor system health
|
|
420
|
+
|
|
421
|
+
- **Keyboard Shortcuts:**
|
|
422
|
+
- `Ctrl+M` - Toggle view mode
|
|
423
|
+
- `Ctrl+F` - Focus filter
|
|
424
|
+
- `Ctrl+/` - Show shortcuts help
|
|
425
|
+
- WCAG 2.1 AA compliant accessibility
|
|
426
|
+
|
|
427
|
+
### Production-Grade Trace Viewer
|
|
428
|
+
|
|
429
|
+
The dashboard includes a **Jaeger-style trace viewer** with 7 powerful visualization modes:
|
|
430
|
+
|
|
431
|
+
<p align="center">
|
|
432
|
+
<img alt="Trace Viewer" src="docs/img/trace_1.png" width="1000">
|
|
433
|
+
<i>Trace Viewer: Timeline view showing span hierarchies and execution flow</i>
|
|
434
|
+
</p>
|
|
435
|
+
|
|
436
|
+
**7 Trace Viewer Modes:**
|
|
437
|
+
|
|
438
|
+
1. **Timeline** - Waterfall visualization with parent-child relationships
|
|
439
|
+
2. **Statistics** - Sortable table view with durations and error tracking
|
|
440
|
+
3. **RED Metrics** - Rate, Errors, Duration monitoring for service health
|
|
441
|
+
4. **Dependencies** - Service-to-service communication analysis
|
|
442
|
+
5. **DuckDB SQL** - Interactive SQL query editor with CSV export
|
|
443
|
+
6. **Configuration** - Real-time service/operation filtering
|
|
444
|
+
7. **Guide** - Built-in documentation and query examples
|
|
445
|
+
|
|
446
|
+
**Additional Features:**
|
|
447
|
+
|
|
448
|
+
- **Full I/O Capture** - Complete input/output data for every operation
|
|
449
|
+
- **JSON Viewer** - Collapsible tree structure with expand all/collapse all
|
|
450
|
+
- **Multi-Trace Support** - Open and compare multiple traces simultaneously
|
|
451
|
+
- **Smart Sorting** - Sort by date, span count, or duration
|
|
452
|
+
- **CSV Export** - Download query results for offline analysis
|
|
453
|
+
|
|
454
|
+
<p align="center">
|
|
455
|
+
<img alt="Trace Viewer" src="docs/img/trace_2.png" width="1000">
|
|
456
|
+
<i>Trace Viewer: Dependency Analysis</i>
|
|
457
|
+
</p>
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
### OpenTelemetry + DuckDB Tracing
|
|
461
|
+
|
|
462
|
+
**One environment variable enables comprehensive tracing:**
|
|
463
|
+
|
|
464
|
+
```bash
|
|
465
|
+
export FLOCK_AUTO_TRACE=true
|
|
466
|
+
export FLOCK_TRACE_FILE=true
|
|
467
|
+
|
|
468
|
+
python your_app.py
|
|
469
|
+
# Traces stored in .flock/traces.duckdb
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
**AI-queryable debugging:**
|
|
473
|
+
|
|
474
|
+
```python
|
|
475
|
+
import duckdb
|
|
476
|
+
conn = duckdb.connect('.flock/traces.duckdb', read_only=True)
|
|
477
|
+
|
|
478
|
+
# Find bottlenecks
|
|
479
|
+
slow_ops = conn.execute("""
|
|
480
|
+
SELECT name, AVG(duration_ms) as avg_ms, COUNT(*) as count
|
|
481
|
+
FROM spans
|
|
482
|
+
WHERE duration_ms > 1000
|
|
483
|
+
GROUP BY name
|
|
484
|
+
ORDER BY avg_ms DESC
|
|
485
|
+
""").fetchall()
|
|
486
|
+
|
|
487
|
+
# Find errors with full context
|
|
488
|
+
errors = conn.execute("""
|
|
489
|
+
SELECT name, status_description,
|
|
490
|
+
json_extract(attributes, '$.input') as input,
|
|
491
|
+
json_extract(attributes, '$.output') as output
|
|
492
|
+
FROM spans
|
|
493
|
+
WHERE status_code = 'ERROR'
|
|
494
|
+
""").fetchall()
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
**Real debugging session:**
|
|
498
|
+
```
|
|
499
|
+
You: "My pizza agent is slow"
|
|
500
|
+
AI: [queries DuckDB]
|
|
501
|
+
"DSPyEngine.evaluate takes 23s on average.
|
|
502
|
+
Input size: 50KB of conversation history.
|
|
503
|
+
Recommendation: Limit context to last 5 messages."
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
**Why DuckDB?** 10-100x faster than SQLite for analytical queries. Zero configuration. AI agents can debug your AI agents.
|
|
507
|
+
|
|
508
|
+
<p align="center">
|
|
509
|
+
<img alt="Trace Viewer" src="docs/img/trace_3.png" width="1000">
|
|
510
|
+
<i>Trace Viewer: DuckDB Query</i>
|
|
511
|
+
</p>
|
|
512
|
+
|
|
513
|
+
---
|
|
514
|
+
|
|
515
|
+
## Framework Comparison
|
|
516
|
+
|
|
517
|
+
### Architectural Differences
|
|
518
|
+
|
|
519
|
+
Flock uses a fundamentally different coordination pattern than most multi-agent frameworks:
|
|
520
|
+
|
|
521
|
+
| Dimension | Graph-Based Frameworks | Chat-Based Frameworks | Flock (Blackboard) |
|
|
522
|
+
|-----------|------------------------|----------------------|-------------------|
|
|
523
|
+
| **Core Pattern** | Directed graph with explicit edges | Round-robin conversation | Blackboard subscriptions |
|
|
524
|
+
| **Coordination** | Manual edge wiring | Message passing | Type-based subscriptions |
|
|
525
|
+
| **Parallelism** | Manual (split/join nodes) | Sequential turn-taking | Automatic (concurrent consumers) |
|
|
526
|
+
| **Type Safety** | Varies (often TypedDict) | Text-based messages | Pydantic + runtime validation |
|
|
527
|
+
| **Coupling** | Tight (hardcoded successors) | Medium (conversation context) | Loose (type subscriptions only) |
|
|
528
|
+
| **Adding Agents** | Rewrite graph topology | Update conversation flow | Just subscribe to types |
|
|
529
|
+
| **Testing** | Requires full graph | Requires full group | Individual agent isolation |
|
|
530
|
+
| **Security Model** | DIY implementation | DIY implementation | Built-in (5 visibility types) |
|
|
531
|
+
| **Scalability** | O(n²) edge complexity | Limited by turn-taking | O(n) subscription complexity |
|
|
532
|
+
|
|
533
|
+
### When Flock Wins
|
|
534
|
+
|
|
535
|
+
**✅ Use Flock when you need:**
|
|
536
|
+
|
|
537
|
+
- **Parallel agent execution** - Agents consuming the same type run concurrently automatically
|
|
538
|
+
- **Type-safe outputs** - Pydantic validation catches errors at runtime
|
|
539
|
+
- **Minimal prompt engineering** - Schemas define behavior, not natural language
|
|
540
|
+
- **Dynamic agent addition** - Subscribe new agents without rewiring existing workflows
|
|
541
|
+
- **Testing in isolation** - Unit test individual agents with mock inputs
|
|
542
|
+
- **Built-in security** - 5 visibility types for compliance (HIPAA, SOC2, multi-tenancy)
|
|
543
|
+
- **10+ agents** - Linear complexity stays manageable at scale
|
|
544
|
+
|
|
545
|
+
### When Alternatives Win
|
|
546
|
+
|
|
547
|
+
**⚠️ Consider graph-based frameworks when:**
|
|
548
|
+
- You need extensive ecosystem integration with existing tools
|
|
549
|
+
- Your workflow is inherently sequential (no parallelism needed)
|
|
550
|
+
- You want battle-tested maturity (larger communities, more documentation)
|
|
551
|
+
- Your team has existing expertise with those frameworks
|
|
552
|
+
|
|
553
|
+
**⚠️ Consider chat-based frameworks when:**
|
|
554
|
+
- You prefer conversation-based development patterns
|
|
555
|
+
- Your use case maps naturally to turn-taking dialogue
|
|
556
|
+
- You need features specific to those ecosystems
|
|
557
|
+
|
|
558
|
+
### Honest Trade-offs
|
|
559
|
+
|
|
560
|
+
**You trade:**
|
|
561
|
+
- Ecosystem maturity (established frameworks have larger communities)
|
|
562
|
+
- Extensive documentation (we're catching up)
|
|
563
|
+
- Battle-tested age (newer architecture means less production history)
|
|
564
|
+
|
|
565
|
+
**You gain:**
|
|
566
|
+
- Better scalability (O(n) vs O(n²) complexity)
|
|
567
|
+
- Type safety (runtime validation vs hope)
|
|
568
|
+
- Cleaner architecture (loose coupling vs tight graphs)
|
|
569
|
+
- Production safety (circuit breakers, feedback prevention built-in)
|
|
570
|
+
- Security model (5 visibility types vs DIY)
|
|
571
|
+
|
|
572
|
+
**Different frameworks for different priorities. Choose based on what matters to your team.**
|
|
573
|
+
|
|
574
|
+
---
|
|
575
|
+
|
|
576
|
+
## Production Readiness
|
|
577
|
+
|
|
578
|
+
### What Works Today (v0.5.0)
|
|
579
|
+
|
|
580
|
+
**✅ Production-ready core:**
|
|
581
|
+
- more than 700 tests, with >75% coverage (>90% on critical paths)
|
|
582
|
+
- Blackboard orchestrator with typed artifacts
|
|
583
|
+
- Parallel + sequential execution (automatic)
|
|
584
|
+
- Zero-trust security (5 visibility types)
|
|
585
|
+
- Circuit breakers and feedback loop prevention
|
|
586
|
+
- OpenTelemetry distributed tracing with DuckDB storage
|
|
587
|
+
- Real-time dashboard with 7-mode trace viewer
|
|
588
|
+
- MCP integration (Model Context Protocol)
|
|
589
|
+
- Best-of-N execution, batch processing, join operations
|
|
590
|
+
- Type-safe retrieval API (`get_by_type()`)
|
|
591
|
+
|
|
592
|
+
**⚠️ What's missing for large-scale production:**
|
|
593
|
+
- **Persistent blackboard** - Currently in-memory only
|
|
594
|
+
- **Advanced retry logic** - Basic only
|
|
595
|
+
- **Event replay** - No Kafka integration yet
|
|
596
|
+
- **Kubernetes-native deployment** - No Helm chart yet
|
|
597
|
+
- **OAuth/RBAC** - Dashboard has no auth
|
|
598
|
+
|
|
599
|
+
All planned for v1.0
|
|
600
|
+
|
|
601
|
+
### Recommended Use Cases Today
|
|
602
|
+
|
|
603
|
+
**✅ Good fit right now:**
|
|
604
|
+
- **Startups/MVPs** - Fast iteration, type safety, built-in observability
|
|
605
|
+
- **Internal tools** - Where in-memory blackboard is acceptable
|
|
606
|
+
- **Research/prototyping** - Rapid experimentation with clean architecture
|
|
607
|
+
- **Medium-scale systems** (10-50 agents, 1000s of artifacts)
|
|
608
|
+
|
|
609
|
+
**⚠️ Wait for 1.0 if you need:**
|
|
610
|
+
- **Enterprise persistence** (multi-region, high availability)
|
|
611
|
+
- **Compliance auditing** (immutable event logs)
|
|
612
|
+
- **Multi-tenancy SaaS** (with OAuth/SSO)
|
|
613
|
+
- **Mission-critical systems** with 99.99% uptime requirements
|
|
614
|
+
|
|
615
|
+
**Flock 0.5.0 is production-ready for the right use cases. Know your requirements.**
|
|
616
|
+
|
|
617
|
+
---
|
|
618
|
+
|
|
619
|
+
## Roadmap to 1.0
|
|
620
|
+
|
|
621
|
+
We're not building a toy framework. We're building enterprise infrastructure for AI agents.
|
|
622
|
+
|
|
623
|
+
**See [ROADMAP.md](ROADMAP.md) for the complete roadmap with detailed code examples.**
|
|
624
|
+
|
|
625
|
+
### Flock 1.0 - Q4 2025 Release
|
|
626
|
+
|
|
627
|
+
**We're confident to deliver all enterprise features by Q4 2025:**
|
|
628
|
+
|
|
629
|
+
**🏢 Enterprise Persistence**
|
|
630
|
+
- Redis and PostgreSQL backends for durable blackboard state
|
|
631
|
+
- Agent crashes? State persists, agents resume automatically
|
|
632
|
+
- Multi-region deployments with shared blackboard
|
|
633
|
+
- SQL queries on artifact history for analytics and compliance
|
|
634
|
+
|
|
635
|
+
**🔄 Advanced Error Handling**
|
|
636
|
+
- Exponential backoff with jitter for transient failures
|
|
637
|
+
- Dead letter queues for poison messages
|
|
638
|
+
- Per-agent circuit breakers with auto-recovery
|
|
639
|
+
- Full observability of all failure modes
|
|
640
|
+
|
|
641
|
+
**🤝 Aggregation Patterns**
|
|
642
|
+
- Map-reduce pattern for parallel processing → aggregation
|
|
643
|
+
- Voting/consensus for multi-agent decision making
|
|
644
|
+
- Best-result selection with custom scoring functions
|
|
645
|
+
|
|
646
|
+
**📨 Kafka Event Backbone**
|
|
647
|
+
- Event replay for debugging production issues in development
|
|
648
|
+
- Time-travel debugging with checkpoint restoration
|
|
649
|
+
- Immutable audit logs for regulatory compliance
|
|
650
|
+
- Backfill new agents with historical data
|
|
651
|
+
|
|
652
|
+
**☸️ Kubernetes-Native Deployment**
|
|
653
|
+
- Helm charts for production deployments
|
|
654
|
+
- Horizontal auto-scaling based on blackboard queue depth
|
|
655
|
+
- Zero-downtime deployments with health checks
|
|
656
|
+
- Production-grade readiness probes
|
|
657
|
+
|
|
658
|
+
**🔐 OAuth/RBAC**
|
|
659
|
+
- OAuth2/OIDC authentication for multi-tenant SaaS
|
|
660
|
+
- API key authentication for programmatic access
|
|
661
|
+
- Role-based access control with agent-level permissions
|
|
662
|
+
- Complete audit trails for compliance (SOC2, HIPAA)
|
|
663
|
+
|
|
664
|
+
**👤 Human-in-the-Loop**
|
|
665
|
+
- Approval patterns for high-value transactions
|
|
666
|
+
- Dashboard integration for pending approvals
|
|
667
|
+
- Slack/email notifications with audit trails
|
|
668
|
+
- Training mode with review-before-automation
|
|
669
|
+
|
|
670
|
+
**🔀 Fan-Out/Fan-In Patterns**
|
|
671
|
+
- Dynamic work distribution based on runtime data
|
|
672
|
+
- Result collection and aggregation
|
|
673
|
+
- Map-reduce over LLM operations
|
|
674
|
+
- Sharding for horizontal scale
|
|
675
|
+
|
|
676
|
+
**⏰ Time-Based Scheduling**
|
|
677
|
+
- Cron-like triggers for periodic workflows
|
|
678
|
+
- Sliding window patterns for real-time analytics
|
|
679
|
+
- Hybrid event+time based triggers
|
|
680
|
+
- SLA monitoring and data freshness checks
|
|
681
|
+
|
|
682
|
+
### Release Criteria for v1.0
|
|
683
|
+
|
|
684
|
+
**v1.0 will ship when all of these are complete:**
|
|
685
|
+
1. ✅ Production persistence (Redis + Postgres backends stable)
|
|
686
|
+
2. ✅ Advanced error handling (retry, circuit breakers, DLQ working)
|
|
687
|
+
3. ✅ Aggregation patterns (map-reduce, voting, consensus implemented)
|
|
688
|
+
4. ✅ Kafka event backbone (replay and time-travel debugging)
|
|
689
|
+
5. ✅ Kubernetes native (Helm chart with auto-scaling)
|
|
690
|
+
6. ✅ Authentication (OAuth/OIDC + API key auth)
|
|
691
|
+
7. ✅ Human-in-the-loop (approval patterns implemented)
|
|
692
|
+
8. ✅ Fan-out/fan-in (distributed processing patterns)
|
|
693
|
+
9. ✅ Time-based scheduling (cron + sliding windows)
|
|
694
|
+
10. ✅ 85%+ test coverage (1000+ tests passing)
|
|
695
|
+
11. ✅ Production validation (deployed at 3+ companies)
|
|
696
|
+
|
|
697
|
+
**Target Date:** Q4 2025
|
|
698
|
+
|
|
699
|
+
---
|
|
700
|
+
|
|
701
|
+
## Example: Multi-Modal Clinical Decision Support
|
|
702
|
+
|
|
703
|
+
```python
|
|
704
|
+
import os
|
|
705
|
+
from flock import Flock, flock_type
|
|
706
|
+
from flock.visibility import PrivateVisibility, TenantVisibility, LabelledVisibility
|
|
707
|
+
from flock.identity import AgentIdentity
|
|
708
|
+
from pydantic import BaseModel
|
|
709
|
+
|
|
710
|
+
@flock_type
|
|
711
|
+
class PatientScan(BaseModel):
|
|
712
|
+
patient_id: str
|
|
713
|
+
scan_type: str
|
|
714
|
+
image_data: bytes
|
|
715
|
+
|
|
716
|
+
@flock_type
|
|
717
|
+
class XRayAnalysis(BaseModel):
|
|
718
|
+
findings: list[str]
|
|
719
|
+
confidence: float
|
|
720
|
+
|
|
721
|
+
@flock_type
|
|
722
|
+
class LabResults(BaseModel):
|
|
723
|
+
markers: dict[str, float]
|
|
724
|
+
|
|
725
|
+
@flock_type
|
|
726
|
+
class Diagnosis(BaseModel):
|
|
727
|
+
condition: str
|
|
728
|
+
reasoning: str
|
|
729
|
+
confidence: float
|
|
730
|
+
|
|
731
|
+
# Create HIPAA-compliant blackboard
|
|
732
|
+
flock = Flock(os.getenv("DEFAULT_MODEL", "openai/gpt-4.1"))
|
|
733
|
+
|
|
734
|
+
# Radiologist with privacy controls
|
|
735
|
+
radiologist = (
|
|
736
|
+
flock.agent("radiologist")
|
|
737
|
+
.consumes(PatientScan)
|
|
738
|
+
.publishes(
|
|
739
|
+
XRayAnalysis,
|
|
740
|
+
visibility=PrivateVisibility(agents={"diagnostician"}) # HIPAA!
|
|
741
|
+
)
|
|
742
|
+
)
|
|
743
|
+
|
|
744
|
+
# Lab tech with multi-tenancy
|
|
745
|
+
lab_tech = (
|
|
746
|
+
flock.agent("lab_tech")
|
|
747
|
+
.consumes(PatientScan)
|
|
748
|
+
.publishes(
|
|
749
|
+
LabResults,
|
|
750
|
+
visibility=TenantVisibility(tenant_id="patient_123") # Isolation!
|
|
751
|
+
)
|
|
752
|
+
)
|
|
753
|
+
|
|
754
|
+
# Diagnostician with explicit access
|
|
755
|
+
diagnostician = (
|
|
756
|
+
flock.agent("diagnostician")
|
|
757
|
+
.identity(AgentIdentity(name="diagnostician", labels={"role:physician"}))
|
|
758
|
+
.consumes(XRayAnalysis, LabResults) # Waits for BOTH
|
|
759
|
+
.publishes(
|
|
760
|
+
Diagnosis,
|
|
761
|
+
visibility=LabelledVisibility(required_labels={"role:physician"})
|
|
762
|
+
)
|
|
763
|
+
)
|
|
764
|
+
|
|
765
|
+
# Run with tracing
|
|
766
|
+
async with flock.traced_run("patient_123_diagnosis"):
|
|
767
|
+
await flock.publish(PatientScan(patient_id="123", ...))
|
|
768
|
+
await flock.run_until_idle()
|
|
769
|
+
|
|
770
|
+
# Get diagnosis (type-safe retrieval)
|
|
771
|
+
diagnoses = await flock.store.get_by_type(Diagnosis)
|
|
772
|
+
# Returns list[Diagnosis] directly - no .data access, no casting
|
|
773
|
+
```
|
|
774
|
+
|
|
775
|
+
**What this demonstrates:**
|
|
776
|
+
- Multi-modal data fusion (images + labs + history)
|
|
777
|
+
- Built-in access controls (HIPAA compliance)
|
|
778
|
+
- Parallel agent execution (radiology + labs run concurrently)
|
|
779
|
+
- Automatic dependency resolution (diagnostician waits for both)
|
|
780
|
+
- Full audit trail (traced_run + DuckDB storage)
|
|
781
|
+
- Type-safe data retrieval (no Artifact wrappers)
|
|
782
|
+
|
|
783
|
+
---
|
|
784
|
+
|
|
785
|
+
## Production Use Cases
|
|
786
|
+
|
|
787
|
+
Flock's architecture shines in production scenarios requiring parallel execution, security, and observability. Here are common patterns:
|
|
788
|
+
|
|
789
|
+
### Financial Services: Multi-Signal Trading
|
|
790
|
+
|
|
791
|
+
**The Challenge:** Analyze multiple market signals in parallel, correlate them within time windows, maintain SEC-compliant audit trails.
|
|
792
|
+
|
|
793
|
+
**The Solution:** 20+ signal analyzers run concurrently, join operations correlate signals, DuckDB provides complete audit trails.
|
|
794
|
+
|
|
795
|
+
```python
|
|
796
|
+
# Parallel signal analyzers
|
|
797
|
+
volatility = flock.agent("volatility").consumes(MarketData).publishes(VolatilityAlert)
|
|
798
|
+
sentiment = flock.agent("sentiment").consumes(NewsArticle).publishes(SentimentAlert)
|
|
799
|
+
|
|
800
|
+
# Trade execution waits for CORRELATED signals (within 5min window)
|
|
801
|
+
trader = flock.agent("trader").consumes(
|
|
802
|
+
VolatilityAlert, SentimentAlert,
|
|
803
|
+
join=JoinSpec(within=timedelta(minutes=5))
|
|
804
|
+
).publishes(TradeOrder)
|
|
805
|
+
```
|
|
806
|
+
|
|
807
|
+
### Healthcare: HIPAA-Compliant Diagnostics
|
|
808
|
+
|
|
809
|
+
**The Challenge:** Multi-modal data fusion with strict access controls, complete audit trails, zero-trust security.
|
|
810
|
+
|
|
811
|
+
**The Solution:** Built-in visibility controls for HIPAA compliance, automatic parallel execution, full data lineage tracking.
|
|
812
|
+
|
|
813
|
+
```python
|
|
814
|
+
# Privacy controls built-in
|
|
815
|
+
radiology.publishes(XRayAnalysis, visibility=PrivateVisibility(agents={"diagnostician"}))
|
|
816
|
+
lab.publishes(LabResults, visibility=TenantVisibility(tenant_id="patient_123"))
|
|
817
|
+
|
|
818
|
+
# Diagnostician waits for BOTH inputs with role-based access
|
|
819
|
+
diagnostician = flock.agent("diagnostician").consumes(XRayAnalysis, LabResults).publishes(Diagnosis)
|
|
820
|
+
```
|
|
821
|
+
|
|
822
|
+
### E-Commerce: 50-Agent Personalization
|
|
823
|
+
|
|
824
|
+
**The Challenge:** Analyze dozens of independent signals, support dynamic signal addition, process millions of events daily.
|
|
825
|
+
|
|
826
|
+
**The Solution:** O(n) scaling to 50+ analyzers, batch processing for efficiency, zero graph rewiring when adding signals.
|
|
827
|
+
|
|
828
|
+
```python
|
|
829
|
+
# 50+ signal analyzers (all run in parallel!)
|
|
830
|
+
for signal in ["browsing", "purchase", "cart", "reviews", "email", "social"]:
|
|
831
|
+
flock.agent(f"{signal}_analyzer").consumes(UserEvent).publishes(Signal)
|
|
832
|
+
|
|
833
|
+
# Recommender batches signals for efficient LLM calls
|
|
834
|
+
recommender = flock.agent("recommender").consumes(Signal, batch=BatchSpec(size=50))
|
|
835
|
+
```
|
|
836
|
+
|
|
837
|
+
### Multi-Tenant SaaS: Content Moderation
|
|
838
|
+
|
|
839
|
+
**The Challenge:** Complete data isolation between tenants, multi-agent consensus, full audit trails.
|
|
840
|
+
|
|
841
|
+
**The Solution:** Tenant visibility ensures zero cross-tenant leakage, parallel checks provide diverse signals, traces show complete reasoning.
|
|
842
|
+
|
|
843
|
+
**See [USECASES.md](USECASES.md) for complete code examples and production metrics.**
|
|
844
|
+
|
|
845
|
+
---
|
|
846
|
+
|
|
847
|
+
## Getting Started
|
|
848
|
+
|
|
849
|
+
```bash
|
|
850
|
+
# Install
|
|
851
|
+
pip install flock-core
|
|
852
|
+
|
|
853
|
+
# Set API key
|
|
854
|
+
export OPENAI_API_KEY="sk-..."
|
|
855
|
+
|
|
856
|
+
# Try the workshop
|
|
857
|
+
git clone https://github.com/whiteducksoftware/flock-flow.git
|
|
858
|
+
cd flock-flow
|
|
859
|
+
uv run python examples/05-claudes-workshop/lesson_01_code_detective.py
|
|
860
|
+
```
|
|
861
|
+
|
|
862
|
+
**Learn by doing:**
|
|
863
|
+
- 📚 [7-Lesson Workshop](examples/05-claudes-workshop/) - Progressive lessons from basics to advanced
|
|
864
|
+
- 🆚 [The Blackboard](examples/02-the-blackboard/) - See data-driven orchestration without graphs
|
|
865
|
+
- 🎯 [Declarative Basics](examples/01-the-declarative-way/) - Understanding declarative programming
|
|
866
|
+
- 📖 [Documentation](AGENTS.md) - Complete development guide
|
|
867
|
+
|
|
868
|
+
---
|
|
869
|
+
|
|
870
|
+
## Contributing
|
|
871
|
+
|
|
872
|
+
We're building Flock in the open. See [CONTRIBUTING.md](CONTRIBUTING.md) and [AGENTS.md](AGENTS.md) for development setup.
|
|
873
|
+
|
|
874
|
+
**We welcome:**
|
|
875
|
+
- Bug reports and feature requests
|
|
876
|
+
- Documentation improvements
|
|
877
|
+
- Example contributions
|
|
878
|
+
- Architecture discussions
|
|
879
|
+
|
|
880
|
+
**Quality standards:**
|
|
881
|
+
- All tests must pass
|
|
882
|
+
- Coverage requirements met
|
|
883
|
+
- Code formatted with Ruff
|
|
884
|
+
|
|
885
|
+
---
|
|
886
|
+
|
|
887
|
+
## Why "0.5"?
|
|
888
|
+
|
|
889
|
+
We're calling this 0.5 to signal:
|
|
890
|
+
|
|
891
|
+
1. **Core is production-ready** - real-world client deployments, comprehensive features
|
|
892
|
+
2. **Ecosystem is evolving** - Documentation growing, community building, features maturing
|
|
893
|
+
3. **Architecture is proven** - Blackboard pattern is 50+ years old, declarative contracts are sound
|
|
894
|
+
4. **Enterprise features are coming** - Persistence, auth, Kubernetes deployment in roadmap
|
|
895
|
+
|
|
896
|
+
**1.0 will arrive** when we've delivered persistence, advanced error handling, and enterprise deployment patterns (targeting Q4 2025).
|
|
897
|
+
|
|
898
|
+
---
|
|
899
|
+
|
|
900
|
+
## The Bottom Line
|
|
901
|
+
|
|
902
|
+
**Flock is different because it makes different architectural choices:**
|
|
903
|
+
|
|
904
|
+
**Instead of:**
|
|
905
|
+
- ❌ Prompt engineering → ✅ Declarative type contracts
|
|
906
|
+
- ❌ Workflow graphs → ✅ Blackboard subscriptions
|
|
907
|
+
- ❌ Manual parallelization → ✅ Automatic concurrent execution
|
|
908
|
+
- ❌ Bolt-on security → ✅ Zero-trust visibility controls
|
|
909
|
+
- ❌ Hope-based debugging → ✅ AI-queryable distributed traces
|
|
910
|
+
|
|
911
|
+
**These aren't marketing slogans. They're architectural decisions with real tradeoffs.**
|
|
912
|
+
|
|
913
|
+
**You trade:**
|
|
914
|
+
- Ecosystem maturity (established frameworks have larger communities)
|
|
915
|
+
- Extensive documentation (we're catching up)
|
|
916
|
+
- Battle-tested age (newer architecture means less production history)
|
|
917
|
+
|
|
918
|
+
**You gain:**
|
|
919
|
+
- Better scalability (O(n) vs O(n²) complexity)
|
|
920
|
+
- Type safety (runtime validation vs hope)
|
|
921
|
+
- Cleaner architecture (loose coupling vs tight graphs)
|
|
922
|
+
- Production safety (circuit breakers, feedback prevention built-in)
|
|
923
|
+
- Security model (5 visibility types vs DIY)
|
|
924
|
+
|
|
925
|
+
**Different frameworks for different priorities. Choose based on what matters to your team.**
|
|
926
|
+
|
|
927
|
+
---
|
|
928
|
+
|
|
929
|
+
<div align="center">
|
|
930
|
+
|
|
931
|
+
**Built with ❤️ by white duck GmbH**
|
|
932
|
+
|
|
933
|
+
**"Declarative contracts eliminate prompt hell. Blackboard architecture eliminates graph spaghetti. Proven patterns applied to modern LLMs."**
|
|
934
|
+
|
|
935
|
+
[⭐ Star on GitHub](https://github.com/whiteducksoftware/flock-flow) | [📖 Read the Docs](AGENTS.md) | [🚀 Try Examples](examples/) | [💼 Enterprise Support](mailto:support@whiteduck.de)
|
|
936
|
+
|
|
937
|
+
</div>
|
|
938
|
+
|
|
939
|
+
---
|
|
940
|
+
|
|
941
|
+
**Last Updated:** October 8, 2025
|
|
942
|
+
**Version:** Flock 0.5.0 (Blackboard Edition)
|
|
943
|
+
**Status:** Production-Ready Core, Enterprise Features Roadmapped
|