Arquitetura do Fluxo
flowchart TD
A([Plane Issue
Created/Updated]) --> B[n8n Webhook
(Verify Secret + Dedupe)]
B --> C[n8n Normalize + Decide]
C --> D[n8n to /ai/tasks/route]
D --> E{Prefer LangGraph?
flag/policy}
E -->|No| F[WS Bridges
(Socket.IO)]
E -->|Yes| G[LangGraph
(RAG + Tools)]
F --> F1[new_task]
F1 --> F2[task:ack]
F2 --> F3[task:progress]
F3 --> F4[task:complete]
G --> G1[retrieve_kb
(KB + pgvector)]
G1 --> G2[tools: AWX / n8n]
G2 --> G3[respond]
G2 -. job_id .-> W[AWX Watcher
jobs/id]
W --> WE[task_events
(awx_status, awx_complete)]
subgraph P [Persistencias]
R[(Redis state)]
T[(tasks + task_metrics)]
EV[(task_events)]
KB[(knowledge_base + embeddings)]
GR[(graph_runs + graph_steps)]
end
F4 -->|final| T
F4 -->|timeline| EV
F4 -->|save KB| KB
G3 -->|final| T
G3 -->|timeline| EV
G3 -->|graph trail| GR
G3 -->|save KB| KB
subgraph M [TimeoutManager]
M1[ack_timeout]
M2[progress_timeout]
M3[overall_timeout]
end
M1 -->|reassign| F
M2 -->|reassign| F
M1 --> EV
M2 --> EV
M3 --> EV
T --> X[Console: Tasks]
EV --> X
GR --> Y[Console: Graph Runs]
T --> Z[/metrics]
KB --> G
D --> N[n8n Plane Comment
Roteado + link]
T --> RC[n8n Result Collector
(optional)] --> N
subgraph MSG [Agent Messaging]
Q1[agent:request] --> Q2[agent:response]
end
MSG --> EV