flock-core 0.5.0b54__py3-none-any.whl → 0.5.0b55__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.

@@ -0,0 +1,681 @@
1
+ Metadata-Version: 2.4
2
+ Name: flock-core
3
+ Version: 0.5.0b55
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="https://github.com/whiteducksoftware/flock/blob/master/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 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 and classical AI, now applied to modern LLMs.
48
+
49
+ **Version 0.5.0** • Production-Ready Core • 743 Tests • 77% Coverage
50
+
51
+ ---
52
+
53
+ ## The Problem With Current Frameworks
54
+
55
+ Building production multi-agent systems today means dealing with:
56
+
57
+ **🔥 Prompt Engineering Hell**
58
+ ```python
59
+ # 500-line prompt that breaks when GPT-4 becomes GPT-5
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
+
64
+ **🔥 Testing Nightmares**
65
+ ```python
66
+ # How do you unit test this?
67
+ result = llm.invoke(prompt) # Hope for valid JSON
68
+ data = json.loads(result.content) # Crashes in production
69
+ ```
70
+
71
+ **🔥 Rigid Workflow Graphs**
72
+ ```python
73
+ # Want to add a new agent? Rewrite the entire graph.
74
+ workflow.add_edge("agent_a", "agent_b")
75
+ workflow.add_edge("agent_b", "agent_c")
76
+ # Add agent_d? Start rewiring...
77
+ ```
78
+
79
+ **🔥 No Security Model**
80
+ ```python
81
+ # Every agent sees everything. Good luck with HIPAA compliance.
82
+ ```
83
+
84
+ These aren't framework limitations—they're **architectural choices** that don't scale.
85
+
86
+ ---
87
+
88
+ ## The Flock Approach
89
+
90
+ Flock takes a different path, combining two proven patterns:
91
+
92
+ ### 1. Declarative Type Contracts (Not Prompts)
93
+
94
+ **The old way:**
95
+ ```python
96
+ prompt = "Analyze this bug report and return JSON with severity, category, hypothesis..."
97
+ result = llm.invoke(prompt) # Hope it works
98
+ ```
99
+
100
+ **The Flock way:**
101
+ ```python
102
+ @flock_type
103
+ class BugDiagnosis(BaseModel):
104
+ severity: str = Field(pattern="^(Critical|High|Medium|Low)$")
105
+ category: str = Field(description="Bug category")
106
+ root_cause_hypothesis: str = Field(min_length=50)
107
+ confidence_score: float = Field(ge=0.0, le=1.0)
108
+
109
+ # The schema IS the instruction. No 500-line prompt needed.
110
+ agent.consumes(BugReport).publishes(BugDiagnosis)
111
+ ```
112
+
113
+ **Why this matters:**
114
+ - ✅ **Survives model upgrades** - GPT-6 will still understand Pydantic schemas
115
+ - ✅ **Runtime validation** - Errors caught at parse time, not in production
116
+ - ✅ **Testable** - Mock inputs/outputs with concrete types
117
+ - ✅ **Self-documenting** - The code tells you what agents do
118
+
119
+ ### 2. Blackboard Architecture (Not Directed Graphs)
120
+
121
+ **The old way (graph-based):**
122
+ ```python
123
+ # Explicit workflow with hardcoded edges
124
+ workflow.add_edge("radiologist", "diagnostician")
125
+ workflow.add_edge("lab_tech", "diagnostician")
126
+ # Add performance_analyzer? Rewrite the graph.
127
+ ```
128
+
129
+ **The Flock way (blackboard):**
130
+ ```python
131
+ # Agents subscribe to types, workflows emerge
132
+ radiologist = flock.agent("radiologist").consumes(Scan).publishes(XRayAnalysis)
133
+ lab_tech = flock.agent("lab_tech").consumes(Scan).publishes(LabResults)
134
+ diagnostician = flock.agent("diagnostician").consumes(XRayAnalysis, LabResults).publishes(Diagnosis)
135
+
136
+ # Add performance_analyzer? Just subscribe it:
137
+ performance = flock.agent("perf").consumes(Scan).publishes(PerfAnalysis)
138
+ # Done. No graph rewiring. Diagnostician can optionally consume it.
139
+ ```
140
+
141
+ **What just happened:**
142
+ - ✅ **Parallel execution** - Radiologist and lab_tech run concurrently (automatic)
143
+ - ✅ **Dependency resolution** - Diagnostician waits for both inputs (automatic)
144
+ - ✅ **Loose coupling** - Agents don't know about each other, just data types
145
+ - ✅ **Scalable** - O(n) complexity, not O(n²) edges
146
+
147
+ **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.
148
+
149
+ ---
150
+
151
+ ## Quick Start (60 Seconds)
152
+
153
+ ```bash
154
+ pip install flock-flow
155
+ export OPENAI_API_KEY="sk-..."
156
+ ```
157
+
158
+ ```python
159
+ import asyncio
160
+ from pydantic import BaseModel, Field
161
+ from flock.orchestrator import Flock
162
+ from flock.registry import flock_type
163
+
164
+ # 1. Define typed artifacts
165
+ @flock_type
166
+ class CodeSubmission(BaseModel):
167
+ code: str
168
+ language: str
169
+
170
+ @flock_type
171
+ class BugAnalysis(BaseModel):
172
+ bugs_found: list[str]
173
+ severity: str = Field(pattern="^(Critical|High|Medium|Low|None)$")
174
+ confidence: float = Field(ge=0.0, le=1.0)
175
+
176
+ @flock_type
177
+ class SecurityAnalysis(BaseModel):
178
+ vulnerabilities: list[str]
179
+ risk_level: str = Field(pattern="^(Critical|High|Medium|Low|None)$")
180
+
181
+ @flock_type
182
+ class FinalReview(BaseModel):
183
+ overall_assessment: str = Field(pattern="^(Approve|Approve with Changes|Reject)$")
184
+ action_items: list[str]
185
+
186
+ # 2. Create the blackboard
187
+ flock = Flock("openai/gpt-4.1")
188
+
189
+ # 3. Agents subscribe to types (NO graph wiring!)
190
+ bug_detector = flock.agent("bug_detector").consumes(CodeSubmission).publishes(BugAnalysis)
191
+ security_auditor = flock.agent("security_auditor").consumes(CodeSubmission).publishes(SecurityAnalysis)
192
+
193
+ # This agent AUTOMATICALLY waits for both analyses
194
+ final_reviewer = flock.agent("final_reviewer").consumes(BugAnalysis, SecurityAnalysis).publishes(FinalReview)
195
+
196
+ # 4. Run with real-time dashboard
197
+ async def main():
198
+ await flock.serve(dashboard=True)
199
+
200
+ asyncio.run(main())
201
+ ```
202
+
203
+ **What happened:**
204
+ - Bug detector and security auditor ran **in parallel** (both consume CodeSubmission)
205
+ - Final reviewer **automatically waited** for both
206
+ - **Zero prompts written** - types defined the behavior
207
+ - **Zero graph edges** - subscriptions created the workflow
208
+ - **Full type safety** - Pydantic validates all outputs
209
+
210
+ ---
211
+
212
+ ## Core Concepts
213
+
214
+ ### Typed Artifacts (The Vocabulary)
215
+
216
+ Every piece of data on the blackboard is a validated Pydantic model:
217
+
218
+ ```python
219
+ @flock_type
220
+ class PatientDiagnosis(BaseModel):
221
+ condition: str = Field(min_length=10)
222
+ confidence: float = Field(ge=0.0, le=1.0)
223
+ recommended_treatment: list[str] = Field(min_length=1)
224
+ follow_up_required: bool
225
+ ```
226
+
227
+ **Benefits:**
228
+ - Runtime validation ensures quality
229
+ - Field constraints prevent bad outputs
230
+ - Self-documenting data structures
231
+ - Version-safe (types survive model updates)
232
+
233
+ ### Agent Subscriptions (The Rules)
234
+
235
+ Agents declare what they consume and produce:
236
+
237
+ ```python
238
+ analyzer = (
239
+ flock.agent("analyzer")
240
+ .description("Analyzes patient scans") # Optional: improves multi-agent coordination
241
+ .consumes(PatientScan) # What triggers this agent
242
+ .publishes(PatientDiagnosis) # What it produces
243
+ )
244
+ ```
245
+
246
+ **Advanced subscriptions:**
247
+
248
+ ```python
249
+ # Conditional consumption - only high-severity cases
250
+ urgent_care = flock.agent("urgent").consumes(
251
+ Diagnosis,
252
+ where=lambda d: d.severity in ["Critical", "High"]
253
+ )
254
+
255
+ # Batch processing - wait for 10 items
256
+ batch_processor = flock.agent("batch").consumes(
257
+ Event,
258
+ batch=BatchSpec(size=10, timeout=timedelta(seconds=30))
259
+ )
260
+
261
+ # Join operations - wait for multiple types within time window
262
+ correlator = flock.agent("correlator").consumes(
263
+ SignalA,
264
+ SignalB,
265
+ join=JoinSpec(within=timedelta(minutes=5))
266
+ )
267
+ ```
268
+
269
+ ### Visibility Controls (The Security)
270
+
271
+ **Unlike other frameworks, Flock has zero-trust security built-in:**
272
+
273
+ ```python
274
+ # Multi-tenancy (SaaS isolation)
275
+ agent.publishes(CustomerData, visibility=TenantVisibility(tenant_id="customer_123"))
276
+
277
+ # Explicit allowlist (HIPAA compliance)
278
+ agent.publishes(MedicalRecord, visibility=PrivateVisibility(agents={"physician", "nurse"}))
279
+
280
+ # Role-based access control
281
+ agent.identity(AgentIdentity(name="analyst", labels={"clearance:secret"}))
282
+ agent.publishes(IntelReport, visibility=LabelledVisibility(required_labels={"clearance:secret"}))
283
+
284
+ # Time-delayed release (embargo periods)
285
+ artifact.visibility = AfterVisibility(ttl=timedelta(hours=24), then=PublicVisibility())
286
+
287
+ # Public (default)
288
+ agent.publishes(PublicReport, visibility=PublicVisibility())
289
+ ```
290
+
291
+ **Why this matters:** Financial services, healthcare, defense, SaaS platforms all need this for compliance. Other frameworks make you build it yourself.
292
+
293
+ ### Production Safety Features
294
+
295
+ **Built-in safeguards prevent common production failures:**
296
+
297
+ ```python
298
+ # Circuit breakers prevent runaway costs
299
+ flock = Flock("openai/gpt-4.1", max_agent_iterations=1000)
300
+
301
+ # Feedback loop protection
302
+ critic = (
303
+ flock.agent("critic")
304
+ .consumes(Essay)
305
+ .publishes(Critique)
306
+ .prevent_self_trigger(True) # Won't trigger itself infinitely
307
+ )
308
+
309
+ # Best-of-N execution (run 5x, pick best)
310
+ agent.best_of(5, score=lambda result: result.metrics["confidence"])
311
+
312
+ # Configuration validation
313
+ agent.best_of(150, ...) # ⚠️ Warns: "best_of(150) is very high - high LLM costs"
314
+ ```
315
+
316
+ ---
317
+
318
+ ## Production-Ready Observability
319
+
320
+ ### OpenTelemetry + DuckDB Tracing
321
+
322
+ **One environment variable enables comprehensive tracing:**
323
+
324
+ ```bash
325
+ export FLOCK_AUTO_TRACE=true
326
+ export FLOCK_TRACE_FILE=true
327
+
328
+ python your_app.py
329
+ # Traces stored in .flock/traces.duckdb
330
+ ```
331
+
332
+ **AI-queryable debugging:**
333
+
334
+ ```python
335
+ import duckdb
336
+ conn = duckdb.connect('.flock/traces.duckdb', read_only=True)
337
+
338
+ # Find bottlenecks
339
+ slow_ops = conn.execute("""
340
+ SELECT name, AVG(duration_ms) as avg_ms, COUNT(*) as count
341
+ FROM spans
342
+ WHERE duration_ms > 1000
343
+ GROUP BY name
344
+ ORDER BY avg_ms DESC
345
+ """).fetchall()
346
+
347
+ # Find errors with full context
348
+ errors = conn.execute("""
349
+ SELECT name, status_description,
350
+ json_extract(attributes, '$.input') as input,
351
+ json_extract(attributes, '$.output') as output
352
+ FROM spans
353
+ WHERE status_code = 'ERROR'
354
+ """).fetchall()
355
+ ```
356
+
357
+ **Real debugging session:**
358
+ ```
359
+ You: "My pizza agent is slow"
360
+ AI: [queries DuckDB]
361
+ "DSPyEngine.evaluate takes 23s on average.
362
+ Input size: 50KB of conversation history.
363
+ Recommendation: Limit context to last 5 messages."
364
+ ```
365
+
366
+ **Why DuckDB?** 10-100x faster than SQLite for analytical queries. Zero configuration. AI agents can debug your AI agents.
367
+
368
+ ### Real-Time Dashboard
369
+
370
+ ```python
371
+ await flock.serve(dashboard=True)
372
+ ```
373
+
374
+ - **Dual visualization modes:** Agent View vs Blackboard View
375
+ - **WebSocket streaming:** Live updates with 2-minute heartbeat
376
+ - **Control panel:** Publish artifacts and invoke agents from UI
377
+ - **7 trace viewer modes:** Timeline, Statistics, RED metrics, Dependencies, SQL, Config, Guide
378
+ - **Full I/O capture:** Complete input/output data with collapsible JSON viewer
379
+ - **Keyboard shortcuts:** WCAG 2.1 AA compliant accessibility
380
+
381
+ ---
382
+
383
+ ## Framework Comparison
384
+
385
+ ### When Flock Wins
386
+
387
+ **✅ Use Flock when you need:**
388
+
389
+ | Requirement | Why Flock | Alternative Challenge |
390
+ |-------------|-----------|----------------------|
391
+ | **Parallel agent execution** | Automatic - agents consuming same type run concurrently | Graph frameworks require manual coordination; chat frameworks are typically sequential |
392
+ | **Type-safe outputs** | Pydantic validation at runtime | Most use TypedDict (no validation) or text-based outputs |
393
+ | **Zero prompt engineering** | Schemas define behavior | Most require extensive manual prompts |
394
+ | **Adding agents dynamically** | Just subscribe to types | Graph frameworks require rewiring; others need flow updates |
395
+ | **Testing in isolation** | Unit test individual agents | Most require full workflow setup for testing |
396
+ | **Security/access control** | 5 visibility types built-in | DIY implementation in most frameworks |
397
+ | **10+ agents** | O(n) complexity, stays clean | Graph-based approaches have O(n²) edge complexity |
398
+
399
+ ### When Alternatives Win
400
+
401
+ **⚠️ Consider LangGraph when:**
402
+ - You need **extensive ecosystem integration** (LangChain tools, LangSmith debugging)
403
+ - Your workflow is **inherently sequential** (no parallelism needed)
404
+ - You want **battle-tested maturity** (LangGraph is 1.0+, Flock is 0.5.0)
405
+ - You need **extensive documentation** and large community
406
+
407
+ **⚠️ Consider AutoGen when:**
408
+ - You need **Microsoft ecosystem** integration (Azure, Office)
409
+ - You prefer **chat-based development patterns** for agent interaction
410
+ - Your team has existing **AutoGen expertise**
411
+ - You need features specific to the AutoGen ecosystem
412
+
413
+ ### Honest Architectural Comparison
414
+
415
+ | Dimension | Flock | LangGraph | AutoGen (v0.2) | AutoGen (v0.4) |
416
+ |-----------|-------|-----------|---------------|----------------|
417
+ | **Core Pattern** | Blackboard subscriptions | Directed graph | Round-robin chat | Agent graphs |
418
+ | **Parallelism** | Automatic | Manual (Send API) | No | Manual |
419
+ | **Type Safety** | Pydantic + validation | TypedDict | Text-based | Typed messages |
420
+ | **Coupling** | Loose (types) | Tight (edges) | Medium (conversation) | Medium (graph) |
421
+ | **Prompt Engineering** | Zero (declarative) | Required | Required | Required |
422
+ | **Add Agent** | Subscribe to type | Rewrite graph | Update flow | Update graph |
423
+ | **Maturity** | 0.5.0 (early) | 1.0+ (mature) | 1.0+ (mature) | 0.4+ (evolving) |
424
+ | **Community** | Small | Large | Large | Growing |
425
+ | **Testing** | Isolated agents | Full graph | Full group | Graph/agents |
426
+ | **Security** | Built-in (5 types) | DIY | DIY | DIY |
427
+
428
+ **Bottom line:** Different architectures for different needs. Flock trades ecosystem maturity for better scalability patterns. Choose based on your priorities.
429
+
430
+ ---
431
+
432
+ ## Production Readiness
433
+
434
+ ### What Works Today (v0.5.0)
435
+
436
+ **✅ Production-ready core:**
437
+ - 743 tests, 77% coverage (86-100% on critical paths)
438
+ - Blackboard orchestrator with typed artifacts
439
+ - Parallel + sequential execution (automatic)
440
+ - Zero-trust security (5 visibility types)
441
+ - Circuit breakers and feedback loop prevention
442
+ - OpenTelemetry distributed tracing with DuckDB storage
443
+ - Real-time dashboard with 7-mode trace viewer
444
+ - MCP integration (Model Context Protocol)
445
+ - Best-of-N execution, batch processing, join operations
446
+
447
+ **⚠️ What's missing for large-scale production:**
448
+ - **Persistent blackboard** - Currently in-memory only (Redis/Postgres coming Q1 2025)
449
+ - **Advanced retry logic** - Basic only (exponential backoff + dead letter queue coming Q1 2025)
450
+ - **Event replay** - No Kafka integration yet (coming Q2 2025)
451
+ - **Kubernetes-native deployment** - No Helm chart yet (coming Q2 2025)
452
+ - **OAuth/RBAC** - Dashboard has no auth (coming Q2 2025)
453
+
454
+ ### Recommended Use Cases Today
455
+
456
+ **✅ Good fit right now:**
457
+ - **Startups/MVPs** - Fast iteration, type safety, built-in observability
458
+ - **Internal tools** - Where in-memory blackboard is acceptable
459
+ - **Research/prototyping** - Rapid experimentation with clean architecture
460
+ - **Medium-scale systems** (10-50 agents, 1000s of artifacts)
461
+
462
+ **⚠️ Wait for 1.0 if you need:**
463
+ - **Enterprise persistence** (multi-region, high availability)
464
+ - **Compliance auditing** (immutable event logs)
465
+ - **Multi-tenancy SaaS** (with OAuth/SSO)
466
+ - **Mission-critical systems** with 99.99% uptime requirements
467
+
468
+ **Flock 0.5.0 is production-ready for the right use cases. Know your requirements.**
469
+
470
+ ---
471
+
472
+ ## Roadmap to 1.0
473
+
474
+ See [ROADMAP.md](ROADMAP.md) for detailed timeline. Key milestones:
475
+
476
+ **Q1 2025: Production Hardening**
477
+ - Redis/Postgres persistence
478
+ - Advanced retry & error handling (exponential backoff, circuit breakers per-agent, dead letter queues)
479
+ - Aggregation patterns (map-reduce, voting, consensus)
480
+
481
+ **Q2 2025: Enterprise Infrastructure**
482
+ - Kafka event backbone (replay, time-travel debugging)
483
+ - Kubernetes-native deployment (Helm charts, auto-scaling)
484
+ - OAuth/RBAC (multi-tenant auth)
485
+
486
+ **Q3 2025: Advanced Orchestration**
487
+ - Human-in-the-loop approval patterns
488
+ - Fan-out/fan-in workflows
489
+ - Time-based scheduling (cron triggers, sliding windows)
490
+
491
+ **Target: v1.0 by Q3 2025**
492
+
493
+ ---
494
+
495
+ ## Example: Multi-Modal Clinical Decision Support
496
+
497
+ ```python
498
+ from flock.orchestrator import Flock
499
+ from flock.visibility import PrivateVisibility, TenantVisibility
500
+ from pydantic import BaseModel
501
+ from flock.registry import flock_type
502
+
503
+ @flock_type
504
+ class PatientScan(BaseModel):
505
+ patient_id: str
506
+ scan_type: str
507
+ image_data: bytes
508
+
509
+ @flock_type
510
+ class XRayAnalysis(BaseModel):
511
+ findings: list[str]
512
+ confidence: float
513
+
514
+ @flock_type
515
+ class LabResults(BaseModel):
516
+ markers: dict[str, float]
517
+
518
+ @flock_type
519
+ class Diagnosis(BaseModel):
520
+ condition: str
521
+ reasoning: str
522
+ confidence: float
523
+
524
+ # Create HIPAA-compliant blackboard
525
+ flock = Flock("openai/gpt-4.1")
526
+
527
+ # Radiologist with privacy controls
528
+ radiologist = (
529
+ flock.agent("radiologist")
530
+ .consumes(PatientScan)
531
+ .publishes(
532
+ XRayAnalysis,
533
+ visibility=PrivateVisibility(agents={"diagnostician"}) # HIPAA!
534
+ )
535
+ )
536
+
537
+ # Lab tech with multi-tenancy
538
+ lab_tech = (
539
+ flock.agent("lab_tech")
540
+ .consumes(PatientScan)
541
+ .publishes(
542
+ LabResults,
543
+ visibility=TenantVisibility(tenant_id="patient_123") # Isolation!
544
+ )
545
+ )
546
+
547
+ # Diagnostician with explicit access
548
+ diagnostician = (
549
+ flock.agent("diagnostician")
550
+ .identity(AgentIdentity(name="diagnostician", labels={"role:physician"}))
551
+ .consumes(XRayAnalysis, LabResults) # Waits for BOTH
552
+ .publishes(
553
+ Diagnosis,
554
+ visibility=LabelledVisibility(required_labels={"role:physician"})
555
+ )
556
+ )
557
+
558
+ # Run with tracing
559
+ async with flock.traced_run("patient_123_diagnosis"):
560
+ await flock.publish(PatientScan(patient_id="123", ...))
561
+ await flock.run_until_idle()
562
+
563
+ # Get diagnosis (type-safe retrieval)
564
+ diagnoses = await flock.store.get_by_type(Diagnosis)
565
+ # Returns list[Diagnosis] directly - no .data access, no casting
566
+ ```
567
+
568
+ **What this demonstrates:**
569
+ - Multi-modal data fusion (images + labs + history)
570
+ - Built-in access controls (HIPAA compliance)
571
+ - Parallel agent execution (radiology + labs run concurrently)
572
+ - Automatic dependency resolution (diagnostician waits for both)
573
+ - Full audit trail (traced_run + DuckDB storage)
574
+ - Type-safe data retrieval (no Artifact wrappers)
575
+
576
+ ---
577
+
578
+ ## Getting Started
579
+
580
+ ```bash
581
+ # Install
582
+ pip install flock-flow
583
+
584
+ # Set API key
585
+ export OPENAI_API_KEY="sk-..."
586
+
587
+ # Try the workshop
588
+ git clone https://github.com/whiteducksoftware/flock-flow.git
589
+ cd flock-flow
590
+ uv run python examples/05-claudes-workshop/lesson_01_code_detective.py
591
+ ```
592
+
593
+ **Learn by doing:**
594
+ - 📚 [7-Lesson Workshop](examples/05-claudes-workshop/) ✅ - Progressive lessons from basics to advanced
595
+ - 🎯 [Declarative Basics](examples/01-the-declarative-way/) ✅ - Understanding declarative programming
596
+ - 🗂️ [Blackboard Workflows](examples/02-the-blackboard/) 🚧 - Parallel and sequential execution patterns *(coming soon)*
597
+ - 📊 [Dashboard UI](examples/03-the-dashboard/) 🚧 - Real-time visualization *(coming soon)*
598
+ - 🔌 [REST API](examples/04-the-api/) 🚧 - API integration examples *(coming soon)*
599
+ - 📖 [Documentation](AGENTS.md) - Complete development guide
600
+
601
+ ---
602
+
603
+ ## Contributing
604
+
605
+ We're building Flock in the open. See [AGENTS.md](AGENTS.md) for development setup.
606
+
607
+ **We welcome:**
608
+ - Bug reports and feature requests
609
+ - Documentation improvements
610
+ - Example contributions
611
+ - Architecture discussions
612
+
613
+ **Quality standards:**
614
+ - All tests must pass (743 currently)
615
+ - Coverage requirements met (77%+ overall, 86-100% critical paths)
616
+ - Code formatted with Ruff
617
+ - Type checking passes (mypy)
618
+
619
+ ---
620
+
621
+ ## Why "0.5"?
622
+
623
+ We're calling this 0.5 to signal:
624
+
625
+ 1. **Core is production-ready** - 743 tests, real-world deployments, comprehensive features
626
+ 2. **Ecosystem is evolving** - Documentation growing, community building, features maturing
627
+ 3. **Architecture is proven** - Blackboard pattern is 50+ years old, declarative contracts are sound
628
+ 4. **Enterprise features are coming** - Persistence, auth, Kubernetes deployment in roadmap
629
+
630
+ **1.0 will arrive** when we've delivered persistence, advanced error handling, and enterprise deployment patterns (targeting Q3 2025).
631
+
632
+ ---
633
+
634
+ ## The Bottom Line
635
+
636
+ **Flock is different because it makes different architectural choices:**
637
+
638
+ **Instead of:**
639
+ - ❌ Prompt engineering → ✅ Declarative type contracts
640
+ - ❌ Workflow graphs → ✅ Blackboard subscriptions
641
+ - ❌ Manual parallelization → ✅ Automatic concurrent execution
642
+ - ❌ Bolt-on security → ✅ Zero-trust visibility controls
643
+ - ❌ Hope-based debugging → ✅ AI-queryable distributed traces
644
+
645
+ **These aren't marketing slogans. They're architectural decisions with real tradeoffs.**
646
+
647
+ **You trade:**
648
+ - Ecosystem maturity (established frameworks have larger communities)
649
+ - Extensive documentation (we're catching up)
650
+ - Battle-tested age (newer architecture means less production history)
651
+
652
+ **You gain:**
653
+ - Better scalability (O(n) vs O(n²) complexity)
654
+ - Type safety (runtime validation vs hope)
655
+ - Cleaner architecture (loose coupling vs tight graphs)
656
+ - Production safety (circuit breakers, feedback prevention built-in)
657
+ - Security model (5 visibility types vs DIY)
658
+
659
+ **Different frameworks for different priorities. Choose based on what matters to your team.**
660
+
661
+ ---
662
+
663
+ <div align="center">
664
+
665
+ **Built with ❤️ by white duck GmbH**
666
+
667
+ **"Agents are microservices. The blackboard is their API."**
668
+
669
+ [⭐ Star on GitHub](https://github.com/whiteducksoftware/flock-flow) | [📖 Read the Docs](AGENTS.md) | [🚀 Try Examples](examples/) | [💼 Enterprise Support](mailto:support@whiteduck.de)
670
+
671
+ </div>
672
+
673
+ ---
674
+
675
+ **Last Updated:** October 8, 2025
676
+ **Version:** Flock 0.5.0 (Blackboard Edition)
677
+ **Status:** Production-Ready Core, Enterprise Features Roadmapped
678
+
679
+ ---
680
+
681
+ **"Declarative contracts eliminate prompt hell. Blackboard architecture eliminates graph spaghetti. Proven patterns applied to modern LLMs."**