Files
Jordan Ritter 46f810779c fix(showcase): wire langroid declarative-gen-ui via Option A (JS-injected A2UI)
Supersedes #6058's two-stage approach (outer generate_a2ui → secondary Python
LLM call → render_a2ui), which severed across the prod streaming boundary.

Option A: `injectA2UITool` (default true) causes CopilotKit's A2UIMiddleware to
inject `render_a2ui` into RunAgentInput.tools. The langroid agui_adapter now
merges those injected tools into its OpenAI call so the LLM can call render_a2ui
directly. The middleware intercepts the tool call stream, builds a2ui_operations,
and fires RUN_FINISHED — no secondary Python LLM pass needed.

Changes:
- agent.py: remove ~550 lines of two-stage A2UI infrastructure (generate_a2ui_via_llm,
  _a2ui_error, _resolve_a2ui_model, _get_a2ui_llm, etc.); replace GenerateA2UITool.handle
  with a stub that logs loudly if middleware interception regresses
- agui_adapter.py: merge run_input.tools (AG-UI-injected) into the OpenAI tools list
  so render_a2ui is visible to the LLM; remove set_last_user_message call
- route.ts: remove injectA2UITool: false; keep defaultCatalogId pin
- gen-ui-declarative.json: replace 9 two-stage fixtures with 4 single-stage fixtures
  matching toolName: render_a2ui + context: langroid (mirrors crewai-crews Option A)

Mirrors the crewai-crews fix from #6067.
2026-07-20 12:04:40 -07:00
..