Includes updates across gateway, router, node-worker, memory-service, aurora-service, swapper, sofiia-console UI and node2 infrastructure: - gateway-bot: Dockerfile, http_api.py, druid/aistalk prompts, doc_service - services/router: main.py, router-config.yml, fabric_metrics, memory_retrieval, offload_client, prompt_builder - services/node-worker: worker.py, main.py, config.py, fabric_metrics - services/memory-service: Dockerfile, database.py, main.py, requirements - services/aurora-service: main.py (+399), kling.py, quality_report.py - services/swapper-service: main.py, swapper_config_node2.yaml - services/sofiia-console: static/index.html (console UI update) - config: agent_registry, crewai_agents/teams, router_agents - ops/fabric_preflight.sh: updated preflight checks - router-config.yml, docker-compose.node2.yml: infra updates - docs: NODA1-AGENT-ARCHITECTURE, fabric_contract updated Made-with: Cursor
14 KiB
14 KiB
NODA1 Agent Architecture
Дата: 2026-02-11 Версія: 2.1.0
Огляд
NODA1 використовує уніфіковану систему агентів з єдиним джерелом істини (config/agent_registry.yml).
Схема підключення агентів
┌─────────────────────────────────────────────────────────────────────────────┐
│ TELEGRAM USERS │
│ (публічні канали та приватні чати) │
└────────────────────────────────┬────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ GATEWAY (dagi-gateway-node1:9300) │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ agent_registry.json (generated from config/agent_registry.yml) │ │
│ │ ─────────────────────────────────────────────────────────────────── │ │
│ │ 13 Telegram Agents: │ │
│ │ • daarwizz (Meta-Orchestrator, Digital Mayor) │ │
│ │ • helion (Energy Research, Energy Union) │ │
│ │ • alateya (R&D Lab OS, Interdisciplinary Research) │ │
│ │ • druid (Ayurveda, Cosmetics R&D) │ │
│ │ • nutra (Nutraceutical Research) │ │
│ │ • agromatrix (AgroMatrix Platform) │ │
│ │ • greenfood (Craft Food ERP) │ │
│ │ • clan (Community Spirit) │ │
│ │ • eonarch (Consciousness Evolution) │ │
│ │ • yaromir (Private Tech Lead) [whitelist] │ │
│ │ • soul (Spiritual Mentor) │ │
│ │ • senpai (Trading Advisor) │ │
│ │ • sofiia (Chief AI Architect) │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
│ Features: │
│ • registry_loader.py - читає agent_registry.json │
│ • Multimodal: photo, voice (STT), documents │
│ • Memory context integration │
└────────────────────────────────┬────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ ROUTER (dagi-router-node1:9102 -> :8000) │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ router_agents.json (generated from config/agent_registry.yml) │ │
│ │ ─────────────────────────────────────────────────────────────────── │ │
│ │ 15 Agents with routing: │ │
│ │ • 13 top-level (user-facing) │ │
│ │ • 2 internal (monitor, devtools) │ │
│ │ │ │
│ │ Per agent: keywords[], domains[], llm_profile, visibility │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
│ Endpoints: │
│ • POST /v1/agents/{agent_id}/infer - виклик агента │
│ • GET /health - статус │
│ • GET /metrics - Prometheus метрики │
│ │
│ Features: │
│ • Tool Manager (11 tools per agent) │
│ • Intent routing │
│ • LLM profile selection │
└────────────────────────────────┬────────────────────────────────────────────┘
│
┌────────────┼────────────┐
│ │ │
▼ ▼ ▼
┌───────────────────────┐ ┌───────────┐ ┌─────────────────────┐
│ LLM PROVIDERS │ │ MEMORY │ │ CREWAI │
│ ───────────────────── │ │ SERVICE │ │ (dagi-staging- │
│ • Grok (cloud) │ │ :8000 │ │ crewai-service) │
│ - sofiia, senpai │ ├───────────┤ │ ─────────────────── │
│ • DeepSeek (cloud) │ │ • Qdrant │ │ crewai_agents.json │
│ - all other agents │ │ • Neo4j │ │ │
│ + fallback │ │ • Postgres│ │ 11 Orchestrators │
│ • Mistral (fallback) │ └───────────┘ │ + Teams per agent │
│ • Ollama (crew only) │ └─────────────────────┘
│ - qwen3:8b (crew) │
│ - qwen3-vl:8b (vis) │
└───────────────────────┘
Canonical Source of Truth
config/agent_registry.yml ←── ЄДИНЕ джерело істини
│
│ tools/agents generate
▼
┌────────────────────────────────────────────────────────┐
│ Generated configs (НЕ редагувати вручну!) │
│ │
│ • gateway-bot/agent_registry.json → Gateway │
│ • config/router_agents.json → Router │
│ • config/crewai_agents.json → CrewAI │
└────────────────────────────────────────────────────────┘
Агенти за класами
TOP-LEVEL (User-facing, 13 agents)
| ID | Display | Telegram | Visibility | Domain | LLM (primary) | Fallback |
|---|---|---|---|---|---|---|
daarwizz |
DAARWIZZ | public | public | Meta-Orchestrator | DeepSeek | Mistral |
helion |
Helion | public | public | Energy | DeepSeek | Mistral |
alateya |
Aletheia | public | public | R&D Lab | DeepSeek | Mistral |
druid |
DRUID | public | public | Ayurveda/Cosmetics | DeepSeek | Mistral |
nutra |
NUTRA | public | public | Nutraceuticals | DeepSeek | Mistral |
agromatrix |
Степан Матрікс | public | public | Agriculture | DeepSeek | Mistral |
greenfood |
GREENFOOD | public | public | Food ERP | DeepSeek | Mistral |
clan |
CLAN | public | public | Community | DeepSeek | Mistral |
eonarch |
EONARCH | public | public | Consciousness | DeepSeek | Mistral |
yaromir |
YAROMIR | whitelist | private | Tech Lead | DeepSeek | Mistral |
soul |
SOUL | public | public | Spiritual | DeepSeek | Mistral |
senpai |
SENPAI | public | public | Trading | Grok | DeepSeek |
sofiia |
SOFIIA | public | public | AI Architecture | Grok | DeepSeek |
INTERNAL (Service agents, 2 agents)
| ID | Display | Telegram | Scope | Purpose | LLM |
|---|---|---|---|---|---|
monitor |
MONITOR | off | node_local | Observability, alerts | Ollama (local) |
devtools |
DevTools | off | global | Development tools | DeepSeek (складні) / Ollama (прості) |
Tools per Agent (Standard Stack)
Всі 13 top-level агентів мають доступ до стандартного стеку:
| Tool | Description |
|---|---|
memory_search |
Пошук в памяті (Qdrant) |
graph_query |
Knowledge Graph запити (Neo4j) |
web_search |
Пошук в інтернеті |
web_extract |
Витяг даних з веб |
crawl4ai_scrape |
Глибокий скрейпінг |
remember_fact |
Збереження факту про користувача |
image_generate |
Генерація зображень |
tts_speak |
Текст у мовлення |
presentation_create |
Створення презентацій |
presentation_status |
Статус презентації |
presentation_download |
Завантаження презентації |
CrewAI Teams
Кожен top-level агент може мати CrewAI команду:
# Приклад: ALATEYA має 5 "професорів"
alateya:
team:
- role: "Prof-Erudite"
skills: [search, verification, analogies]
- role: "Prof-Analyst"
skills: [decomposition, triz, formalization]
- role: "Prof-Creative"
skills: [lateral_thinking, cross_domain]
- role: "Prof-Optimizer"
skills: [feasibility, risk_assessment]
- role: "Prof-Communicator"
skills: [synthesis, presentation]
Feature Flags
# Увімкнено по замовчуванню
AGENT_REGISTRY_ENABLED=true
# Генерація конфігів
feature_flags:
registry_enabled: true
generate_prompts: true
generate_router_config: true
generate_crewai_config: true
Як додати нового агента
- Редагувати
config/agent_registry.yml - Створити
gateway-bot/<agent>_prompt.txt python3 tools/agents validatepython3 tools/agents generatepython3 tools/agents smoke --id <agent_id>- Restart gateway:
docker restart dagi-gateway-node1 - Commit changes
Мережева конфігурація
dagi-network:
- dagi-gateway-node1
- dagi-staging-router
- dagi-staging-crewai-service
- dagi-memory-service-node1
- dagi-qdrant-node1
- dagi-nats-node1
- swapper-service-node1
- ...
Monitoring
- Gateway metrics:
:9300/metrics - Router metrics:
:8000/metrics - Prober:
:9108/metrics - Prometheus:
:9090 - Grafana:
:3030
⚠️ KNOWN GAP: Router → CrewAI Integration (2026-01-29)
Current State
Router always uses direct LLM call. CrewAI service exists but is not called.
Current: Gateway → Router → LLM (always)
↓
CrewAI (unused!)
Target State
Target: Gateway → Router → Decision?
│
┌───────────┴───────────┐
↓ ↓
Direct LLM CrewAI /crew/run
(simple) (complex tasks)
Integration Point
File: services/router/main.py function agent_infer()
Add after line ~540:
from crewai_client import should_use_crewai, call_crewai
# Decision: direct LLM or CrewAI?
use_crew, reason = should_use_crewai(agent_id, request.prompt, agent_config)
logger.info(f"🎭 CrewAI decision: {use_crew} ({reason})")
if use_crew:
crew_result = await call_crewai(agent_id, request.prompt, context)
if crew_result["success"]:
return InferResponse(
response=crew_result["result"],
model="crewai",
...
)
# Fallback to direct LLM if CrewAI failed
Prepared Files
services/router/crewai_client.py- readyconfig/crewai_agents.json- generated from registry