Skip to content

feat(cockpit): ag-ui/json-render — AG-UI shared-state generative UI#608

Merged
blove merged 10 commits into
mainfrom
claude/ag-ui-spec-examples
Jun 7, 2026
Merged

feat(cockpit): ag-ui/json-render — AG-UI shared-state generative UI#608
blove merged 10 commits into
mainfrom
claude/ag-ui-spec-examples

Conversation

@blove
Copy link
Copy Markdown
Contributor

@blove blove commented Jun 7, 2026

Summary

Adds the ag-ui/json-render cockpit example (PR-B1 of the AG-UI backend-spec effort): a port of the chat/generative-ui airline-KPI dashboard onto the AG-UI runtime, demonstrating AG-UI shared-state → generative UI — the cockpit's first example exercising STATE_SNAPSHOT/STATE_DELTA.

The render spec is emitted in AI message content (the content classifier mounts <chat-generative-ui>, unchanged). The dashboard data is delivered the idiomatic AG-UI way: stored in LangGraph graph state (so ag-ui-langgraph auto-emits STATE_SNAPSHOT), reduced into the agent state signal, and synced into the render store by one small new chat-lib effect — where the spec's $state bindings resolve it.

Why a chat-lib change (not pure example work)

Research found the LangGraph example's data channel (get_stream_writer()) is silently dropped by ag-ui-langgraph (it consumes astream_events, where stream-writer payloads never surface). The idiomatic AG-UI fix is shared state — but the <chat> composition didn't feed agent.state() into the render store (only events$ custom events). This PR closes that latent gap.

Changes

  • libs/chatChatComponent gains a small, runtime-neutral effect syncing the agent state signal into the render store (top-level keys mapped to /key JSON pointers; messages excluded). Unit-tested (chat-state-sync.spec.ts). Benefits both adapters; coexists with the existing events$ state_update path.
  • cockpit/ag-ui/json-render/python — full chat/generative-ui graph port (render_spec + 4 data tools + wrap_spec_into_ai loop with _MAX_TOOL_ITERATIONS cap + finalize/respond/generate_title), with emit_state returning dashboard data into typed DashboardState fields (output-schema-visible) instead of stream-writer. MemorySaver checkpointer for the ag-ui-langgraph runtime.
  • cockpit/ag-ui/json-render/angularprovideAgent({url:'/agent'}) + the six dashboard view components (verbatim from the chat sibling) + the views registry.
  • e2e — asserts the dashboard mounts AND a app-stat-card shows a non-empty state-bound KPI value (proves the full STATE_SNAPSHOT data path).
  • Wiring — ports 4323/5323, capability-registry, route-resolution, manifest (+spec).

PR-B2 (ag-ui/a2ui) is a separate future PR (its data rides in the message-content envelope, needing no lib change).

Test Plan

  • nx test chat green (incl. new chat-state-sync effect test)
  • nx test cockpit --run cockpit-e2e-wiring route-resolution + nx test cockpit-registry green
  • nx e2e cockpit-ag-ui-json-render-angular — dashboard renders with a non-empty STATE_SNAPSHOT-bound KPI value
  • nx smoke (python + angular) + nx build green
  • Vertical-slice e2e proved the data path before the full port
  • chat:lint shows pre-existing a2ui-spec warnings (present on main, not from this branch; tracked separately)

🤖 Generated with Claude Code

blove and others added 9 commits June 6, 2026 18:48
PR-B of the generative-UI effort: two cockpit examples demonstrating
backend-sent UI specs over AG-UI — ag-ui/json-render (agent emits a
json-render spec) and ag-ui/a2ui (agent emits an A2UI envelope). Faithful
ports of the chat/generative-ui and chat/a2ui LangGraph examples onto the
ag-ui-langgraph runtime, same airline domains. Purely example work: the
content classifier is adapter-agnostic and the AG-UI reducer preserves raw
content, so no chat-lib or adapter changes. One spec, two PRs (json-render
first).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…livery

Research found json-render's dashboard data (custom get_stream_writer
events) does not survive ag-ui-langgraph. Revise PR-B1 to deliver data as
AG-UI agent shared state (STATE_SNAPSHOT/STATE_DELTA): backend stores data
in graph state (output-schema-visible); add one small runtime-neutral
chat-lib effect syncing agent.state() into the render store. Makes
ag-ui/json-render the cockpit's first AG-UI shared-state demo. a2ui
(PR-B2) unaffected (data rides in the envelope content).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Vertical-slice-first plan: chat-lib state-sync effect, a minimal end-to-end
slice proving the STATE_SNAPSHOT data path, then the full generative-ui graph
port (data in graph state), 6 dashboard views, full e2e fixtures, and
registry/manifest wiring.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…roof)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…n state)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
threadplane Ready Ready Preview, Comment Jun 7, 2026 3:35am

Request Review

@blove blove enabled auto-merge (squash) June 7, 2026 03:31
@blove blove merged commit 39775da into main Jun 7, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant