You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ajoutée après alignement front/back. Contexte complet dans docs/planning/ALIGNMENT.md.
Scope. En plus des 14 data tools MCP, exposer 9 tools render_* aux agents
pour qu'ils puissent émettre des events ui_render consommés par le frontend
(generative UI inline dans le chat).
Pas d'implémentation Python. Ces tools n'ont pas de code métier — ce sont
juste des schémas passés au LLM. Quand un agent appelle render_signal_chart,
l'orchestrateur capture le tool_use, broadcast un event ui_render via WSManager,
et retourne immédiatement un tool_result = "rendered" sans effet DB.
Fichier.backend/agents/ui_tools.py — module avec les 9 schémas + helper.
Decided — tools locaux agent, pas via FastMCP.
Même règle que submit_rca
(cf. M4.3) : tool d'output structuré = local, tool de lecture/écriture DB = MCP.
Les render_* sont déclarés inline dans chaque agent concerné et concaténés à tools_schema avant l'appel Anthropic.
Pattern d'intégration dans le system prompt de chaque agent.
Pour rendre visuels tes résultats, tu peux appeler :
- render_signal_chart(...) pour afficher une courbe
- render_diagnostic_card(...) pour afficher ton diagnostic final
- render_work_order_card(...) pour afficher un WO
Appelle-les quand c'est plus parlant qu'une réponse texte seule.
Handler orchestrateur.
iftool_name.startswith("render_"):
awaitws_manager.broadcast("ui_render", {
"agent": agent_id,
"component": tool_name.removeprefix("render_"), # SignalChart, DiagnosticCard, ..."props": args,
"turn_id": turn_id,
})
tool_result= {"type": "tool_result", "tool_use_id": tu_id, "content": "rendered"}
# pas de persistence DB, pas de side-effect
Pourquoi critique. Sans ces tools, Q&A/Investigator répondent en markdown texte
uniquement. Avec, le chat affiche inline des graphes, cards, diagnostics rendus
par l'agent lui-même — pattern Generative UI / Claude artifacts. C'est ce qui
rend la démo visuellement agentique et distingue ARIA d'un chatbot classique.
Acceptance.
Investigator émet ui_render pour render_diagnostic_card à la fin du RCA
Q&A émet ui_render pour render_signal_chart sur question relative à un signal
Frontend (M7.5 + M8.1–M8.3) rend les composants correctement
sequenceDiagram
autonumber
participant LLM as Claude (Investigator)
participant Orch as Agent orchestrator
participant WS as WSManager
participant Reg as Artifact Registry (M7.5)
participant UI as Chat / Dashboard
LLM->>Orch: tool_use render_diagnostic_card({props})
Orch->>WS: broadcast('ui_render', {agent, component, props, turn_id})
Orch-->>LLM: tool_result 'rendered' (no DB hit)
WS-->>Reg: ui_render event
Reg->>Reg: validate Zod schema
Reg->>UI: render <DiagnosticCard {...props} />
Loading
Important
No backend persistence, no side-effect. The render tools are pure UI signals
the LLM is allowed to emit. The frontend ArtifactRenderer (M7.5) is the only
consumer.
Note
Milestone: M2 — MCP Server
Planning doc:
docs/planning/M2-mcp-server/issues.mdScope. En plus des 14 data tools MCP, exposer 9 tools
render_*aux agentspour qu'ils puissent émettre des events
ui_renderconsommés par le frontend(generative UI inline dans le chat).
Pas d'implémentation Python. Ces tools n'ont pas de code métier — ce sont
juste des schémas passés au LLM. Quand un agent appelle
render_signal_chart,l'orchestrateur capture le
tool_use, broadcast un eventui_rendervia WSManager,et retourne immédiatement un
tool_result = "rendered"sans effet DB.Fichier.
backend/agents/ui_tools.py— module avec les 9 schémas + helper.Les 9 tools.
render_signal_chart{signal_def_id, window_hours, mark_anomaly_at?, threshold?}render_equipment_kb_card{cell_id, highlight_fields?}render_work_order_card{work_order_id, printable}render_diagnostic_card{title, confidence, root_cause, contributing_factors[], pattern_match_id?}render_correlation_matrix{sources[], impact_matrix[][]}render_pattern_match{current_event, past_event_ref, similarity}render_bar_chart{title, x_label, y_label, bars[]}render_alert_banner{severity, cell_id, message, anomaly_id}render_kb_progress{steps[{label, status}]}Note
Decided — tools locaux agent, pas via FastMCP.
Même règle que
submit_rca(cf. M4.3) : tool d'output structuré = local, tool de lecture/écriture DB = MCP.
Les
render_*sont déclarés inline dans chaque agent concerné et concaténés àtools_schemaavant l'appel Anthropic.Pattern d'intégration dans le system prompt de chaque agent.
Handler orchestrateur.
Pourquoi critique. Sans ces tools, Q&A/Investigator répondent en markdown texte
uniquement. Avec, le chat affiche inline des graphes, cards, diagnostics rendus
par l'agent lui-même — pattern Generative UI / Claude artifacts. C'est ce qui
rend la démo visuellement agentique et distingue ARIA d'un chatbot classique.
Acceptance.
ui_renderpourrender_diagnostic_cardà la fin du RCAui_renderpourrender_signal_chartsur question relative à un signalBloque. Frontend M7.5 (artifact registry), M8.1 / M8.2 / M8.3 (artifacts).
Generative UI flow
sequenceDiagram autonumber participant LLM as Claude (Investigator) participant Orch as Agent orchestrator participant WS as WSManager participant Reg as Artifact Registry (M7.5) participant UI as Chat / Dashboard LLM->>Orch: tool_use render_diagnostic_card({props}) Orch->>WS: broadcast('ui_render', {agent, component, props, turn_id}) Orch-->>LLM: tool_result 'rendered' (no DB hit) WS-->>Reg: ui_render event Reg->>Reg: validate Zod schema Reg->>UI: render <DiagnosticCard {...props} />Important
No backend persistence, no side-effect. The render tools are pure UI signals
the LLM is allowed to emit. The frontend
ArtifactRenderer(M7.5) is the onlyconsumer.