Files
microdao-daarion/docs/ARCHITECTURE_DIAGRAM.md
Apple ef3473db21 snapshot: NODE1 production state 2026-02-09
Complete snapshot of /opt/microdao-daarion/ from NODE1 (144.76.224.179).
This represents the actual running production code that has diverged
significantly from the previous main branch.

Key changes from old main:
- Gateway (http_api.py): expanded from ~40KB to 164KB with full agent support
- Router: new /v1/agents/{id}/infer endpoint with vision + DeepSeek routing
- Behavior Policy: SOWA v2.2 (3-level: FULL/ACK/SILENT)
- Agent Registry: config/agent_registry.yml as single source of truth
- 13 agents configured (was 3)
- Memory service integration
- CrewAI teams and roles

Excluded from snapshot: venv/, .env, data/, backups, .tgz archives

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-09 08:46:46 -08:00

101 lines
8.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# DAARION Architecture Diagram
## Production-Grade Stack with Event Bus
```
┌──────────────────────────────┐
│ MONITORING │
│ Prometheus :9090 Grafana:3030│
│ Alerts + Queue Lag │
└───────────────┬──────────────┘
│ metrics/logs/alerts
┌───────────────────────────────────────┴──────────────────────────────────┐
│ CONTROL PLANE │
│ │
│ Control Plane :9200 │
│ ├── /prompts/{agent_id} — versioned system prompts │
│ ├── /policy/{agent_id} — RBAC, entitlements, modes │
│ ├── /config/{key} — routing rules, feature flags │
│ └── /quotas/{user_id} — rate limits, budgets │
│ │
└───────────────────────────────────────┬──────────────────────────────────┘
│ policy/config fetch (cached)
┌───────────────────────────────────────┴──────────────────────────────────┐
│ DATA PLANE │
│ │
│ Gateway (BFF) :9300 │
│ ├── Telegram webhooks │
│ ├── Auth, sessions, throttling │
│ └── Request normalization │
│ │ │
│ ▼ │
│ Router :9102 │
│ ├── Agent routing │
│ ├── Tool orchestration │
│ ├── Policy enforcement │
│ └── LLM calls (DeepSeek/Mistral/Grok/Ollama) │
│ │ │
│ ▼ │
│ Swapper (GPU) :8890 │
│ ├── Vision (qwen3-vl) │
│ ├── STT (faster-whisper) │
│ ├── TTS (edge-tts) │
│ └── Image Gen (FLUX lazy) │
│ │
│ Ingest :8100 ──► [NATS: attachment.created] │
│ Parser :8101 ◄── [NATS: attachment.created] ──► [attachment.parsed] │
│ │
└──────────────────────────────────────────────────────────────────────────┘
┌───────────────────────────────────────┴──────────────────────────────────┐
│ ORCHESTRATION / JOBS │
│ │
│ CrewAI :9010 CrewAI Worker :9011 │
│ ├── Agent definitions ├── [NATS: agent.run.requested] │
│ └── Crew management └── [NATS: agent.run.completed] │
│ │
└──────────────────────────────────────────────────────────────────────────┘
┌───────────────────────────────────────┴──────────────────────────────────┐
│ DATA LAYER │
│ │
│ Memory API :8000 ◄─── ЕДИНСТВЕННАЯ ТОЧКА ДОСТУПА К ДАНИМ │
│ │ │
│ ├──► PostgreSQL :5432 (facts, sessions, quotas, audit) │
│ ├──► Qdrant :6333 (vectors: messages, docs, artifacts) │
│ ├──► Neo4j :7687 (graph: users, topics, relations) │
│ └──► Redis :6379 (cache, sessions) │
│ │
└──────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────┐
│ EVENT BUS (CROSS-CUTTING) │
│ │
│ NATS JetStream :4222 │
│ │
│ Streams: │
│ ├── MESSAGES (message.received/processed/sent) │
│ ├── ATTACHMENTS (attachment.created/parsed/indexed) │
│ ├── AGENT_RUNS (agent.run.requested/completed/failed) │
│ ├── MEMORY (memory.store/indexed) │
│ └── AUDIT (audit.action/error, ops.health/alert) │
│ │
│ Consumers: │
│ ├── parser-pipeline (attachment.created.>) │
│ ├── crewai-worker (agent.run.requested) │
│ ├── memory-indexer (memory.store.>) │
│ └── audit-logger (audit.>) │
│ │
└──────────────────────────────────────────────────────────────────────────┘
```
## Key Principles
1. **NATS is cross-cutting** — connects all layers, not just bottom
2. **Control Plane** — policy/config separate from data plane
3. **Memory API** — single access point to all data stores
4. **Async by default** — Parser, Workers via NATS
5. **Observability** — metrics + logs + trace_id everywhere