Repository navigation
fix(showcase): align langgraph-fastapi to north-star langgraph-python (OSS-582) - #6184
Merged
lukasmoschitz merged 21 commits intoJul 28, 2026
Conversation
Diffs an integration's frontend surface (all src/** UI files except src/agents/** and src/app/api/**, tests, qa) against a reference integration (default langgraph-python) byte-for-byte, normalizing integration identity (manifest name/slug) so name-only differences report as IDENTITY rather than DRIFT. Exits 0 when the frontend is byte-identical modulo the integration's own name. Supports --md (markdown audit), --full, --all (fleet ranking), --verbose, --ref. Complements the structural-only validate-parity.ts. Zero-dependency; runs on node 23+ directly or via tsx.
…-python Task 1 of OSS-582 (frontend parity). Bring the app chrome + beautiful-chat byte-identical to the langgraph-python north star: - globals.css: adopt LGP theme (@theme inline tokens + green palette) - middleware.ts: add (was missing) — sets x-pathname like LGP - layout.tsx: adopt LGP structure; keep FastAPI in title/log (identity carve-out) - beautiful-chat/page.tsx: sync stale doc comment Also fix a Dockerfile parity gap: fastapi was missing the COPY manifest.yaml that LGP has. demos/layout.tsx reads manifest.yaml at request time via generateMetadata (headers() -> dynamic), so without it every /demos/* route crashed with an RSC render error (ENOENT /app/manifest.yaml).
harness-control-plane and harness-pool-worker both declared a build: block AND the same image: showcase-harness:local. Under the parallel docker buildx bake path (default in recent Docker Compose) both targets build and race to tag the identical image, failing the whole 'bin/showcase up' with 'image "...showcase-harness:local": already exists'. It only surfaces on a cold parallel bake build (Colima/Homebrew, fresh clone), which is why it is intermittent across toolchains. Give the image a single build owner: harness-pool-worker now reuses the image built by harness-control-plane (worker vs control-plane role is chosen at runtime via HARNESS_ROLE) instead of declaring its own build:.
…l sales-analyst demo Task 2 of OSS-582. Replace fastapi's old generic 'chart-picker' declarative-gen-ui with langgraph-python's canonical sales-analyst demo, so it matches the shared D6 probe (which asserts sales-dashboard / DataTable / StatusBadge / InfoRow per pill): - backend src/agents/src/a2ui_dynamic.py: generic prompt -> LGP sales-analyst graph (persona + dataset grounding + composition rules + generate_a2ui tool) - frontend definitions.ts/renderers.tsx/chat.tsx/suggestions.ts byte-identical to LGP, add sales-context.ts (fictional Vantage Threads dataset + composition rules) - d6 fixtures gen-ui-declarative.json + render-a2ui.json: LGP's, re-keyed to context=langgraph-fastapi Verified D6 green via control-plane (real 12s browser run, canonical testids asserted). a2ui-recovery intentionally NOT aligned: its fixtures have no context routing, so each integration must keep a unique pill prompt (sanctioned per-slug divergence).
…list fe-parity.ts now reads a per-integration allowlist from integrations/<slug>/PARITY_NOTES.md (an <!-- fe-parity-allow --> block of 'src-relative-path | reason' lines). Listed files report as ALLOWED (sanctioned per-integration divergence), not DRIFT; the gate passes on zero UNSANCTIONED drift instead of zero diffs. This stops the byte-identical goal from being impossible for demos that legitimately must differ (e.g. a2ui-recovery's per-slug prompt, which has no aimock context routing). Add langgraph-fastapi/PARITY_NOTES.md documenting the a2ui-recovery frontend divergence with reasons. D6 remains the correctness gate; fe-parity is the 'where to look' map.
fixture[8] (userMessage:"project planning", turnIndex:0) returned a query_notes toolCall. aimock matches userMessage by substring, so "project planning" also matched the test prompt "Find my notes about project planning"; as a turnIndex:0 'scripted turn' it beat the correct terminal fixture[2] (toolCallId-keyed, content-only) on the follow-up turn, so the agent kept getting another tool call and looped ~30x, never emitting the done signal (D6 done-signal-missing). Remove turnIndex:0 from fixture[8] so it's a plain fallback that loses to the terminal fixture by registration order (matching the langgraph-typescript shape). D6 now green: two real ~6s runs (was a 120s timeout). Note: langgraph-python has the identical bug (still red) — same one-line fix applies there; tracked separately.
…adowing)
open-gen-ui and open-gen-ui-advanced (both probes load gen-ui-open.json) hung
with done-signal-missing (~12 agent runs, 1.3MB tool-call payload each turn).
Cause: two files (gen-ui-open.json + gen-ui-tool-based.json) both defined leg-1
generateSandboxedUi tool-call fixtures for the SAME userMessages ('3D axis…',
'Inline expression evaluator') under the same context but different toolCallIds.
aimock pools every d6/<slug>/*.json into one substring-match set, and the
turnIndex:0 fixture in gen-ui-tool-based.json got served on follow-up turns too
(turnIndex-relaxed), so the toolCallId-anchored terminal never won → no
finish_reason:stop → loop.
Fix (fastapi fixtures only, aligned to GOTCHAS 'canonical fixtures have no
turnIndex' + toolCallId-terminal-before-userMessage-leg1):
- gen-ui-tool-based.json: strip spurious turnIndex:0 from leg-1 tool-call
fixtures; add chunkSize:9999 so the large args JSON-parse in one chunk. Now
the single source for all open-gen-ui pills.
- gen-ui-open.json: empty its fixtures (keep a documenting _note) to remove the
duplicate leg-1/terminal for the 2 probed pills.
- gen-ui-open-advanced.json: delete orphan (no probe declares it; both open
probes use gen-ui-open.json).
D6 green + stable (two ~4s runs each); regression-checked gen-ui-custom
(gen-ui-tool-based route) still green. NOTE: LGP + likely all integrations have
the same open-gen-ui loop (fleet-wide fixture-shadow bug) — no sibling was green.
The fastapi agent_config_agent still used the v1 StateGraph pattern reading tone/expertise/responseLength from RunnableConfig[configurable][properties]. The frontend (identical to LGP) publishes those knobs via the v2 useAgentContext hook and the route uses a plain LangGraphAgent, so the old graph received nothing on configurable and the run errored (turn never completed, D6 red). Port the backend to LGP's v2 shape: create_agent + CopilotKitMiddleware with a single static system prompt that reads the injected context entry. Update the route comment to describe the useAgentContext path (runtime code unchanged: plain LangGraphAgent + AGENT_URL env fallback preserved). D6 langgraph-fastapi:agent-config now green (two real ~28s runs).
…imit
gen-ui-agent had no dedicated backend graph: langgraph.json lacked a
gen_ui_agent entry and route.ts routed the name through the neutral-assistant
loop to sample_agent, which has no steps state or set_steps tool, so the
progress card never mounted (agent hit the default recursion limit of 25).
- Port LGP's gen_ui_agent.py (byte-identical) and register it in langgraph.json.
- route.ts: bind gen-ui-agent to createAgent("gen_ui_agent") and bake
assistantConfig.recursion_limit (default 100) into every LangGraphAgent —
the graph's Python with_config isn't visible to the server runs API, so the
multi-step set_steps walk overran 25. Mirrors langgraph-python.
- aimock: regenerate d6/gen-ui-agent.json from LGP (adds chunkSize:9999 on the
24 tool-call fixtures) and narrow the over-broad d4 chat.json "summarize" key
to "Summarize the sales pipeline" so it stops substring-shadowing the
competitor set_steps chain (and other summarize prompts). Matches LGP.
D6 langgraph-fastapi:gen-ui-agent now green (two real ~14s runs);
agent-config re-verified green (no regression).
Two compounding defects kept this cell red:
1. Backend missing get_revenue_chart. headless_complete.py never registered
the revenue-chart tool, so the chart-turn never emitted a tool call and the
card never mounted. Port LGP's get_revenue_chart tool + its system-prompt
routing rule (tool return shape byte-identical to LGP).
2. Stale turnIndex fixtures caused turn-2 and turn-4 loops to the recursion
limit. Align to LGP's canonical shape:
- tool-rendering.json (shared): AAPL first-leg turnIndex:0 -> hasToolResult:false
so it stops re-firing at turnIndex>=2 in the multi-pill thread.
- headless-complete.json: rewrite to LGP's structure (narration/toolCallId
fixtures first, tool-call legs after with userMessage+context only, no
stale turnIndex); drop the divergent fastapi-only highlight fixtures,
subsumed by the broader substring fixture.
D6 langgraph-fastapi:gen-ui-headless-complete now green (two real ~29s runs);
tool-rendering re-verified green (shared-fixture no regression).
tool-rendering-custom-catchall renders the ticker quote in the wildcard card. fastapi's get_stock_price(ticker) had no scriptable args, so when the aimock fixture emitted price_usd/change_pct the @tool silently dropped the unknown kwargs and returned random numbers instead of the scripted quote — the card showed nondeterministic values, diverging from the north star. Port LGP's scriptable signature: get_stock_price(ticker, price_usd=None, change_pct=None) — echoes scripted values verbatim when supplied, random when omitted (backward-compatible with the other tool-rendering pills). Behavior byte-aligned to langgraph-python. D6 tool-rendering-custom-catchall green (two real ~8s runs); shared-backend siblings tool-rendering, tool-rendering-default-catchall, headless-complete all re-verified green.
…to parity
Two independent fastapi divergences from the green north-star kept this red:
1. Missing chunkSize:9999 on the 8 tool-call fixtures. Under aimock's global
8-byte chunking the large tool-call args failed to JSON-parse in one piece,
so the AAPL->MSFT reasoning chain stopped at leg 1 (turns 1 & 2). Byte-align
to LGP (and the green mastra/langgraph-typescript siblings carry the same
pattern).
2. Fixture-pool shadowing broke turn 3. aimock pools all d4+d6 fixtures for a
context and matches by userMessage substring, first-match-wins in load order
(d4 before d6). fastapi had broad keys LGP doesn't:
- d4/chat.json: 'weather' -> 'weather in San Francisco', 'flights from SFO
to JFK' -> 'Find flights from SFO to JFK.' (period-terminated so it stops
being a substring of turn 3's 'Find flights from SFO to JFK and show me
the weather there.').
- tool-rendering-{custom,default}-catchall.json: bare 'Find flights' ->
'Find flights from SFO to JFK.' (now matches LGP's exact key).
Also byte-align the backend agent to LGP: scriptable get_stock_price signature,
the detailed chaining system prompt, model gpt-5.4, reasoning summary detailed.
D6 tool-rendering-reasoning-chain green (two real ~21s runs). Shared-fixture
regression all green: agentic-chat, tool-rendering, tool-rendering-custom-catchall,
tool-rendering-default-catchall, headless-complete (Tokyo-weather consumer).
… wiring to parity
The demo-browser overview (page.tsx, identical to LGP) groups cards by
demo.tags[0] and orders within a group by manifest.features[] index, so the
card arrangement is fully driven by manifest.yaml. fastapi's manifest was an
older curation: a different naming scheme (~26 demos), deprecated feature/demo
ids (agentic-chat-reasoning, reasoning-default-render, byoc-hashbrown,
byoc-json-render, hitl, phantom hitl-in-chat-booking), divergent tags/order,
and a missing shared-state-streaming/shared-state-read card.
Align manifest.yaml demos+features to LGP (names, descriptions, tags, order,
canonical ids), preserving fastapi identity (name/slug/logo/description) and
the sanctioned a2ui-recovery prompt divergence. Overview is now card-for-card
identical to langgraph-python.
Canonicalizing the ids pulled two cells into the D6 tested set that were
mis-wired to the old names; wire them to LGP's shape:
- reasoning-custom/reasoning-default -> reasoning_agent in copilotkit/route.ts
(were wired under agentic-chat-reasoning/reasoning-default-render).
- rename api routes copilotkit-byoc-{hashbrown,json-render} ->
copilotkit-declarative-{hashbrown,json-render}; align endpoints + the
declarative-hashbrown-demo agent id to what the demo pages request.
Full D6 sweep: 37 green / 1 red; reasoning-display and byoc now green (two
real runs each); the lone red is a2ui-recovery (known shared north-star
defect, identical on LGP).
…fect Soften the stale 'D6 green'/'under investigation' wording. A live trace confirmed the a2ui-recovery surface-missing D6 red reproduces identically on the langgraph-python north star (shared Python ag_ui_langgraph recovery loop; mastra's TS impl is green), so fastapi is already behaviorally aligned and there is nothing to fix under integrations/langgraph-fastapi/. Fixing the shared loop is a separate PR against the north star / the package.
… sample_agent fallbacks) Live QA surfaced demos that behaved wrong on fastapi because they fell back to the generic sample_agent (or were unregistered) instead of the dedicated graph LGP uses. aimock D6 masked these (fixtures script the tool calls), so they were green in the grid but broken against a real model. Audit of fastapi's agentNames fallthrough vs LGP's neutralAssistantCells found exactly these: - gen-ui-tool-based: port gen_ui_tool_based graph (tools=[], frontend supplies render_bar/pie_chart via useComponent). Was sample_agent, whose query_data tool + prompt made the model loop on data queries instead of rendering. - shared-state-streaming: port shared_state_streaming graph (StateStreaming middleware + write_document tool + document state). Was sample_agent, which never emits state.document, so it only wrote to chat. Remove from not_supported_features (now works, D6 green). - agentic-chat: port agentic_chat graph (tools=[]). Was sample_agent (7+ tools). - threadid-frontend-tool-roundtrip: wire to frontend_tools (was unregistered). - reasoning-custom: align reasoning_agent config to LGP (gpt-5.4 / effort medium / summary detailed; were gpt-5-mini / low / auto). Register the 3 new graphs in langgraph.json; remove the 3 names from the sample_agent fallthrough loop in route.ts. D6 green x2 for reasoning-display, gen-ui-custom, shared-state-streaming, agentic-chat; agent-config + tool-rendering-reasoning-chain re-verified (no regression).
…gainst a real LLM aimock replays scripted tool calls keyed on userMessage+context regardless of which graph ran or its tool set, so a demo mis-wired to the sample_agent fallback passes D6 green while breaking against a real model (OSS-582: gen-ui-tool-based looped on query_data; shared-state-streaming wrote only to chat; agentic-chat ran with the wrong tool set). Document that D6-green is necessary but not sufficient, the real-LLM live click-through procedure, and the structural tell (route.ts fallthrough loop vs LGP's dedicated wiring).
… as sanctioned The byoc D6 featureType covers both declarative demos; the grid cell is green (hashbrown route+pill). A scoped declarative-json-render --d6 run reds for two non-fastapi reasons: (1) the shared d5-byoc probe always sends the hashbrown pill even on the json-render page (harness limitation — build context lacks demos[]; tracked as a separate follow-up), and (2) fastapi deliberately keeps hashbrown (@hashbrownai/react) and json-render (@json-render/react) as separate library integrations with their own pills/fixtures, vs LGP's unified render_dashboard contract. Sanctioned; do not collapse fastapi's json-render to the unified contract (content downgrade) — the real fix is probe-side.
fe-parity.ts was a scratch parity checker for this alignment work; it is no longer needed in the worktree. Drop it and de-reference it from langgraph-fastapi/PARITY_NOTES.md (reword the intro, convert the machine-readable fe-parity-allow allowlist into a plain human-readable 'sanctioned file-level divergences' list). No other references existed. D6 behavior remains the parity judge.
… agents The factory automation extracts curated snippets via @region markers. readonly_state_agent_context.py and shared_state_read_write.py were byte-aligned to langgraph-python except their @region markers had been stripped, so the factory would extract nothing for those two regions. Restore them to match LGP: - agent-context-setup around create_agent in readonly_state_agent_context.py - shared-state-setup around create_agent in shared_state_read_write.py Comment-only; no behavior change. Audit confirms all 49 fastapi region pairs are now balanced and LGP-consistent (0 orphans/typos/mismatches).
lukasmoschitz
requested review from
jpr5,
marthakelly,
mme,
ranst91 and
tylerslaton
as code owners
July 27, 2026 15:08
Contributor
Production Digest-Pinning AuditAll 41 services digest-pinned. Run 2026-07-27 08:28:56 PDT — 0 finding(s). |
…I: aimock-fixtures) CI 'Showcase: Validate' failed: aimock-fixtures.test.ts asserts every d6/*.json yields >=1 fixture, but gen-ui-open.json had been emptied to a _meta stub (0 fixtures) by an earlier open-gen-ui shadowing fix that consolidated the pills into gen-ui-tool-based.json. Restore gen-ui-open.json as a byte-for-byte context-swap of the canonical langgraph-python file (context -> langgraph-fastapi): 4 fixtures for the '3D axis' and 'Inline expression evaluator' pills, LGP's clean shape (hasToolResult:false leg-1, distinct toolCallId terminals). No shadowing loop: each file's leg-1/terminal pair is anchored by its own distinct toolCallId, so the done-signal always resolves. Verified: aimock-fixtures.test.ts 839/839 green locally; D6 gen-ui-open, gen-ui-open-advanced, gen-ui-custom all green (two real runs each).
AlemTuzlak
approved these changes
Jul 28, 2026
lukasmoschitz
deleted the
lukas/oss-582-align-langgraph-fastapi-showcase-demos-and-code
branch
July 28, 2026 10:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Aligns the langgraph-fastapi showcase integration to the north-star langgraph-python (OSS-582 — "Align LangGraph (FastAPI) Showcase demos and code"). Moves the integration onto the product-centric demo set: backend agent graphs, runtime wiring, frontend chrome, the demo-browser overview (
manifest.yaml), and aimock fixtures.Linear: OSS-582.
What changed
Backend agents (
src/agents/src/)agentic_chat,gen_ui_agent,gen_ui_tool_based,shared_state_streaming.create_agentports + config alignment foragent_config_agent,headless_complete,reasoning_agent,tool_rendering_agent,tool_rendering_reasoning_chain_agent,a2ui_dynamic.Runtime wiring
route.ts: wired the canonical demos to their dedicated graphs and removed them from the genericsample_agentfallthrough loop (this is what made several demos behave correctly against a real LLM — see below); addedrecursion_limit.langgraph.json: registered the 3 new graphs.copilotkit-byoc-{hashbrown,json-render}→copilotkit-declarative-{hashbrown,json-render}.Overview / content
manifest.yaml: demos + features aligned to LGP (names, descriptions, tags, order, canonical ids; deprecated aliases migrated; phantomhitl-in-chat-bookingremoved;shared-state-streamingun-quarantined now that it works). Integration identity (name/slug/logo) preserved. The demo-browser overview is now card-for-card identical to langgraph-python.@regionmarkers (factory-automation snippet extraction).Frontend chrome
globals.css,layout.tsx,middleware.ts(was missing),declarative-gen-ui/*+sales-context.ts,beautiful-chat;Dockerfilenow copiesmanifest.yaml(fixed an RSC crash on every/demos/*).aimock fixtures (
aimock/d4|d6/langgraph-fastapi/)turnIndexgates, cross-file substring shadowing, missingchunkSize, prompt narrowing).Showcase tooling / docs
docker-compose.local.yml).GOTCHAS.mdautosuggestions #8: documents that aimock D6 can be green while a demo is broken against a real LLM (fixtures replay scripted tool calls regardless of which graph ran), plus how to catch it.PARITY_NOTES.md: sanctioned divergences (a2ui-recovery per-slug prompt isolation; declarative-json-render scoped-test divergence).Verification
ag_ui_langgraphrecovery loop; mastra's TS impl is green). It is not a fastapi defect and is tracked as a separate PR against the north star. Documented inPARITY_NOTES.md.validate-manifests(manifest → registry, all 20 integrations) — green.validate-routes --all(runtime-route wiring) — green.next buildvia the Docker image build) — green.@regionaudit — all region pairs balanced and LGP-consistent (0 orphans/typos/mismatches).:3102vs:3100) confirmed the key demos (reasoning-custom, shared-state-streaming, gen-ui-tool-based, agentic-chat).Notable finding
Several demos were D6-green but broke against a real model because they fell back to the generic
sample_agentinstead of their dedicated graph — the aimock fixture masked the wiring bug by replaying scripted tool calls. This PR fixes the wiring and documents the gap (GOTCHAS #8). D6-green is necessary but not sufficient for graph/tool-dependent demos; a real-LLM click-through is required.Deferred / follow-ups
ag_ui_langgraphrecovery loop; separate PR against the north star.byocgrid cell is green.Scope note
Only
langgraph-fastapiintegration code, its aimock fixtures, and showcase tooling/docs changed. langgraph-python (the north star) was not touched.