Arquitetura do Fluxo (ASCII)
Plane Issue ──→ n8n Webhook (verifica segredo, dedupe, normalize)
│
└──→ POST /ai/tasks/route (Supervisor)
│
├── Prefer LangGraph? (flag/política) ── sim ──→ LangGraph
│ │
│ ├─ retrieve_kb (RAG, KB+pgvector)
│ ├─ tools (AWX/n8n) + awx_watcher
│ └─ respond → persist (tasks, task_events,
│ graph_runs/steps, KB)
│
└── não ──→ WS Bridge (Socket.IO)
├─ new_task → ack → progress → complete
└─ persist (tasks, task_metrics, task_events, KB)
TimeoutManager (ack/progress/overall)
├─ reassign (eventos) ou timeout_final
└─ fallback (quando habilitado)
n8n (Result/Comment)
└─ Comenta no Plane sumário + link do Console
Persistências (Postgres)
- tasks: estado final e snapshot
- task_metrics: latências (ack/total), tentativas e reassigns
- task_events: timeline (routed_ws/fallback, ack, progress, complete, timeouts, reassign, awx_status/complete)
- knowledge_base (+ embeddings): aprendizado coletivo para RAG
- graph_runs / graph_steps: trilha de execuções do LangGraph
Observabilidade
- Console: Agentes / Tarefas / Tools / Graph Runs / Task Metrics (CSV)
- /metrics (Prometheus)
- Botão “events” por tarefa (timeline)
Mensagens agent↔agent
- agent:request | agent:response (via Supervisor), com auditoria em agent_messages