Skip to content

fix(showcase/langgraph-python): repair six demo runtime regressions (byoc-json-render, hashbrown, multimodal, voice, agent-config, auth) - #4271

Merged
AlemTuzlak merged 14 commits into
mainfrom
fix/langgraph-python-demo-runtime-bugs
Apr 24, 2026
Merged

AlemTuzlak merged 14 commits into
mainfrom
fix/langgraph-python-demo-runtime-bugs

Conversation

@AlemTuzlak

Copy link
Copy Markdown
Contributor

Summary

Six langgraph-python showcase demos had runtime regressions after the Wave 2a–4b consolidation landed. This PR bundles fixes for all six into a single branch to avoid six separate merge/rebase cycles.

Each fix was developed in isolation on its own branch and merged here in order. Every slot touches a disjoint subtree under showcase/packages/langgraph-python/src/app/demos/<slug>/ (plus the matching per-demo runtime route and, where needed, the demo's Python agent).

Slot B1 — byoc-json-render (crash + missing rendering)

  • <Renderer /> from @json-render/react delegates to ElementRenderer, which calls useVisibility() / useActions() / useStateStore() / useFunctions(). These need four sibling providers; the assistant-message slot was rendering <Renderer /> bare, so every suggestion that produced valid JSON crashed with useVisibility must be used within a VisibilityProvider.
  • Wrap the renderer in <JSONUIProvider> (composes all four required providers).
  • Also forward children through the MetricCard registry wrapper so the Sales Dashboard example (MetricCard as root with BarChart nested) renders both components.

Slot B2 — byoc-hashbrown (nothing rendered at all)

  • The byoc-hashbrown Python agent was prompted to emit <ui>...</ui> XML-ish markup, but the frontend renderer uses useJsonParser(message.content, kit.schema), which expects a streaming JSON envelope matching @hashbrownai/react's createUiKit(...).schema. With XML content the parser returned {value: undefined} and the renderer bailed to null.
  • Rewrite BYOC_HASHBROWN_SYSTEM_PROMPT to emit the JSON envelope ({"ui":[{"metric":{"props":{...}}}, ...]}), matching the current kit's prop schema exactly. No frontend code change — just a docstring update flagging the wire format for future readers.

Slot B3 — multimodal (broken image + "no image attached")

  • Three issues: (1) sample PNG/PDF shipped as Git LFS pointers — when LFS wasn't pulled the dev server served the 130-byte stub, which got base64-encoded into a "valid" PNG rendering as a broken <img>; (2) the published @ag-ui/[email protected] converter only recognizes the legacy { type: "binary" } AG-UI content-part shape, so the modern { type: "image" | "document", source: {...} } parts CopilotChat sends were silently filtered out before the Python agent ever saw them; (3) manual drag-drop hit the same dropout.
  • Client-side LFS-pointer guard (validate magic bytes + actionable error pointing at git lfs pull).
  • onRunInitialized hook on the agent rewrites modern image | document | audio | video user parts into the legacy binary shape the deployed converter preserves.
  • Multimodal Python agent now routes on MIME: image/* → GPT-4o image_url natively; application/pdf → text via pypdf.

Slot B4 — voice (no mic button + 503 on transcribe)

  • The V1 CopilotRuntime wrapper silently drops transcriptionService (see the // TODO: add support for transcriptionService in the runtime's constructor), so /info never advertised audioFileTranscriptionEnabled: true and the composer never showed the mic button.
  • Write the transcription service onto the V2 runtime instance directly. Wrap it in a GuardedOpenAITranscriptionService that throws a typed auth error ("api key missing") when OPENAI_API_KEY is absent, which the runtime's error categorizer maps to AUTH_FAILED → 401 instead of the opaque 503 users were hitting.

Slot B5 — agent-config (forwardedProps not reaching the agent)

  • Frontend <CopilotKitProvider properties={...}> forwards tone/expertise/responseLength as top-level keys on AG-UI forwardedProps. The TypeScript LangGraphAgent only merges forwardedProps.config into the LangGraph stream payload's config; other keys get spread as top-level payload fields the server ignores. Net result: the Python agent's config["configurable"]["properties"] was always empty.
  • Per-demo subclass AgentConfigLangGraphAgent overrides run() and repacks non-structural forwardedProps keys into forwardedProps.config.configurable.properties before delegating to super.run(). Structural LangGraph stream-payload keys (config, command, streamMode, etc.) are preserved via an explicit reserved-keys set.

Slot B6 — auth (page crashed on initial 401)

  • Demo started unauthenticated; the very first /info GET returned 401 before any error handler attached, tearing down the React tree.
  • Flip useDemoAuth default to true so the demo mounts with a valid Authorization: Bearer <token> header. Button labels inverted to "Sign out" (authed) / "Sign in" (unauthed).
  • ChatErrorBoundary around <CopilotChat /> backstops any post-sign-out render throw; auto-resets when authenticated flips so signing back in remounts cleanly.
  • Runtime auth gate (/api/copilotkit-auth/route.ts) unchanged — still returns 401 for missing/invalid bearer; just handled gracefully on the frontend.

Test plan

  • /demos/byoc-json-render — click each of Sales Dashboard, Expense Thread, Revenue by Category; each renders components (no useVisibility crash).
  • /demos/byoc-hashbrown — click any suggestion; metric / chart / deal cards render within a few seconds.
  • /demos/multimodal — "try with sample image" shows a real thumbnail; "try with sample pdf" attaches; ask to analyze, agent responds contextually (not "no image attached"). Manual drag-drop of an image works.
  • /demos/voice — mic button visible in composer; "Play Sample" either succeeds (when OPENAI_API_KEY is set) or returns a human-readable 4xx (never silent 503).
  • /demos/agent-config — toggle tone/expertise/response-length, ask the same question; answer changes meaningfully.
  • /demos/auth — page loads authenticated; Sign out toggles to 401 state without crashing; Sign in restores chat.

Clicking any suggestion in the byoc-json-render demo crashed with
"useVisibility must be used within a VisibilityProvider". Renderer from
@json-render/react relies on StateProvider, VisibilityProvider,
ValidationProvider, and ActionProvider contexts that its internal
ElementRenderer consumes, but the assistant-message slot was rendering
Renderer bare.

Wrap it in JSONUIProvider (which composes all four required providers)
so streamed spec output renders without a context crash.

Also pass children through the MetricCard catalog wrapper. The agent's
Sales Dashboard worked example uses a MetricCard as the root with a
BarChart nested in its children array; previously that chart was
silently dropped by the registry wrapper, which only rendered the
MetricCard itself.
…+ returns clear 4xx when key missing

V1 CopilotRuntime wrapper silently drops `transcriptionService`, so the
composer never saw the mic button on /voice. Write it onto the V2 runtime
instance directly, and wrap the OpenAI service with a guard that throws an
"api key missing" error when OPENAI_API_KEY is absent (mapped by the
runtime error categorizer to AUTH_FAILED / 401) instead of the opaque 503
users were hitting.
…nst 401 crash

Starting the /demos/auth cell unauthenticated meant the initial `/info`
handshake from CopilotKit returned 401 before any React error handler
could attach, crashing the page on load. Flip the default so the demo
mounts already signed in — the chat is immediately usable — and expose
Sign out / Sign in as the toggle for exercising the 401 path.

- use-demo-auth: default state flipped from unauthed to authed so the
  page mounts with a valid Bearer header.
- page.tsx: add a ChatErrorBoundary around <CopilotChat /> that catches
  any render-time throw from chat internals after signing out and shows
  a friendly in-page message instead of white-screening. The boundary
  resets on auth transitions so signing back in restores a live chat.
- auth-banner: rename Authenticate -> Sign in; status copy updated to
  Signed in / Signed out to match the inverted default.
- tests/e2e/auth.spec.ts: flip assertions — page loads authenticated,
  sign out triggers 401 on next send with banner still mounted, and
  sign in clears the error and restores successful sends.
- qa/auth.md: refreshed checklist for the authenticated-default flow.
The multimodal demo failed three ways:

1. Try-with-sample-image rendered a broken thumbnail because the sample
   PNG on disk is a Git LFS pointer stub when LFS is not pulled at build
   time. The browser base64-encoded the 130-byte text stub, fed it into
   the chat as a valid-looking image/png, and CopilotChat rendered it
   as a broken <img>.

2. Try-with-sample-pdf attached in the composer but the agent said
   "no image/document attached". Same broken-image pipeline also hid the
   real symptom: the published @ag-ui/langgraph converter (0.0.x) only
   understands the legacy { type: binary, mimeType, data | url }
   AG-UI content-part shape. The modern { type: image | document,
   source: {...} } parts CopilotChat emits are silently filtered out of
   the LangChain message stream, so the LangGraph agent never saw them.

3. Manual drag-and-drop of an image failed for the same reason as #2.

Fixes:

- sample-attachment-buttons.tsx: reject Git LFS pointer stubs and
  validate PNG/PDF magic bytes on the client before feeding them to the
  attachment queue. Surfaces an actionable error pointing at
  git-lfs-pull instead of silently producing a broken thumbnail.

- page.tsx: install an onRunInitialized subscriber on the active agent
  that rewrites outgoing user-message image / document / audio / video
  parts to the legacy binary shape the runtime converter preserves.
  Everything else (CopilotChat UI, useAttachments upload pipeline,
  paperclip + drag-drop + paste paths) is untouched; we only retarget
  the wire format so the LangGraph side receives the attachment.

- multimodal_agent.py: after the rewrite, attachments arrive in the
  agent as LangChain image_url content parts (data URLs) regardless of
  upstream modality. Route on MIME instead of the AG-UI part type:
  image/* forwards to GPT-4o natively, application/pdf is flattened to
  text via pypdf. The modern document shape is still handled for
  forward-compat when the runtime is upgraded.

Verified: classifier helpers pass inline unit checks; tsc --noEmit
introduces no new type errors relative to HEAD (module-resolution
errors for @copilotkit/shared and lucide-react are pre-existing on this
branch and unrelated to the multimodal demo).
…c-hashbrown agent

The agent system prompt instructed the LLM to return <ui>...</ui> XML markup,
but the frontend renderer uses useJsonParser(message.content, kit.schema)
which expects a JSON object matching createUiKit(...).schema:

  {
    "ui": [
      { "metric":   { "props": { "label": "...", "value": "..." } } },
      { "pieChart": { "props": { "title": "...", "data": "[{...}]" } } },
      ...
    ]
  }

The XML syntax in useUiKit({ examples }) is hashbrowns prompt DSL for when
hashbrown drives the LLM directly (e.g. useUiChat); because this demo drives
the LLM via langgraph, the agent itself must emit the JSON wire format. With
XML content, useJsonParser returned { value: undefined } and the renderer
bailed to null, leaving the chat with only a loading indicator.

Rewrote the system prompt to produce the JSON envelope and updated the
renderer top-of-file docstring to match. Prop schemas tracked from the
current kit (metric: label+value, pieChart/barChart: title+data-as-JSON-string,
dealCard: title+stage+value, Markdown: children).
…ender' into fix/langgraph-python-demo-runtime-bugs
…own' into fix/langgraph-python-demo-runtime-bugs
… into fix/langgraph-python-demo-runtime-bugs
…g' into fix/langgraph-python-demo-runtime-bugs
@vercel

vercel Bot commented Apr 24, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
chat-with-your-data Ready Ready Preview, Comment Apr 24, 2026 3:53pm
docs Ready Ready Preview, Comment Apr 24, 2026 3:53pm
form-filling Ready Ready Preview, Comment Apr 24, 2026 3:53pm
research-canvas Ready Ready Preview, Comment Apr 24, 2026 3:53pm
travel Ready Ready Preview, Comment Apr 24, 2026 3:53pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

📣 Social Copy Generator

Generate social media copies (Twitter/X, LinkedIn, Blog Post) for this PR using Claude.

  • Generate social media copies

AlemTuzlak added a commit that referenced this pull request Apr 24, 2026
Ports four previously-deferred LangGraph-Python demos to the AWS Strands
showcase and retroactively applies the six PR #4271 runtime regressions
to the wave-1 demos that inherited them from the reference package.

Wave-2 demos shipped:
- byoc-hashbrown: dedicated route + @hashbrownai/react renderer. Agent
  prompt emits strict JSON envelope (NOT XML) per PR #4271 fix. Canonical
  prompt lives in src/agents/byoc_hashbrown.py, injected into the shared
  Strands agent via useAgentContext on the frontend.
- byoc-json-render: dedicated route + @json-render/react renderer wrapped
  in JSONUIProvider per PR #4271 fix. Registry forwards children through
  the MetricCard wrapper so nested dashboards render.
- open-gen-ui: dedicated /api/copilotkit-ogui route with openGenerativeUI
  middleware enabled. Frontend-only designSkill steers the LLM toward
  intricate educational visualisations.
- open-gen-ui-advanced: adds sandbox functions (evaluateExpression,
  notifyHost) callable from the iframe via Websandbox.connection.remote.

beautiful-chat: truthfully skipped in PARITY_NOTES.md. Porting fully
requires dozens of starter-level sub-components and a runtime that
simultaneously enables openGenerativeUI + a2ui + mcpApps, which is its
own blitz worth of work.

Wave-1 fixes applied retroactively:
- auth: default authenticated=true, ChatErrorBoundary that resets on
  auth flip, "Sign in" / "Sign out" labels.
- voice: GuardedOpenAITranscriptionService plus writing
  transcriptionService onto the V2 runtime instance directly (the V1
  wrapper silently drops it).
- multimodal: LFS-pointer guard and magic-byte validation in
  sample-attachment-buttons.tsx; onRunInitialized subscriber on the
  active agent that rewrites modern image/document/audio/video content
  parts to the legacy binary shape most AG-UI adapters preserve.

Task A audit: wave-1 package.json surgery resolved cleanly. npm install
--no-audit --no-fund completes with only an unrelated npm config
warning; no dependency drift; package-lock.json matches origin/main
exactly. Added deps (@copilotkit/voice, openai, @types/react-dom) all
carry carets as expected.

Deferred (noted in PR comment):
- Multimodal Python agent PDF extraction: the shared Strands agent
  (gpt-4o) already supports vision; PDF extraction via pypdf would
  require splitting agent_server.py into multiple Agent instances,
  which is out of scope.
- Agent-config forwardedProps repack: langgraph-specific pattern
  (config.configurable.properties). The Strands equivalent would
  require the shared agent to read forwardedProps at prompt-build
  time; the wave-1 demo is a frontend facade and a proper fix needs
  its own follow-up.
AlemTuzlak added a commit that referenced this pull request Apr 24, 2026
Three runtime regressions from the PR #4271 shipment, propagated to all
three LangGraph showcase packages (langgraph-python, langgraph-fastapi,
langgraph-typescript).

1. Auth demo returned 404 on /info. createCopilotRuntimeHandler (V2)
   URL-routes on /info, /agent/:id/run, etc. It needs a Next.js catchall
   route so sub-paths reach it. PR #4271 mounted it at the fixed-path
   route.ts, which meant every sub-path 404'd. Moved to [[...slug]]/route.ts.

2. Voice demo returned 500 on POST /transcribe. V1 CopilotRuntime's
   transcriptionService is a getter-only delegate; the PR-#4271 pattern
   v2Instance.transcriptionService = ... crashes. Rewrote the voice
   route to use V2 CopilotRuntime directly from @copilotkit/runtime/v2
   and pass transcriptionService in the constructor. V2 handler also
   URL-routes so also moved to [[...slug]]/route.ts.

3. Multimodal LFS-pointer deploy failure. /demos/multimodal sample
   buttons threw a pointer error because the deployed dev server served
   the 130-byte LFS stub when git lfs pull wasn't run in the Docker
   build. Resolved LFS and added a package-scoped .gitattributes that
   exempts the three demo samples (sample.png, sample.pdf, sample.wav)
   from LFS tracking via -filter -diff -merge binary. Committed as real
   binaries so deploy environments see the actual asset regardless of
   LFS configuration. The client-side pointer guard stays in place as a
   defensive net.

All three fixes applied identically across the three showcase packages.
AlemTuzlak added a commit that referenced this pull request Apr 24, 2026
…own suggestion with schema

Two related fixes for the byoc-hashbrown and byoc-json-render demos,
which were rendering blank (or crashing in the case of json-render
Sales Dashboard) after PR #4271 landed.

1. Force JSON-object output at the OpenAI API layer
-------------------------------------------------------
PR #4271 rewrote the byoc-hashbrown agent prompt to emit a JSON
envelope (matching `useJsonParser(content, kit.schema)`), but nothing
at the wire layer prevented the model from still wandering into
prose/code-fence preambles on some turns — and the frontend parser
bails to `null` on any non-JSON prefix. The byoc-json-render renderer
did tolerate fences via `extractJsonObject`, but locking both agents
to JSON output removes the ambiguity entirely.

Apply `response_format={"type": "json_object"}` via `model_kwargs`
(Python) / `modelKwargs` (TS) to the byoc-hashbrown AND byoc-json-render
agents across all three showcase packages. With this flag OpenAI
refuses to emit anything but a single JSON object, which is exactly
what each renderer is built to consume.

2. Hashbrown "Sales dashboard" suggestion vs. schema drift
-------------------------------------------------------
The hashbrown `metric` schema currently accepts only `{ label, value }`
(trend was dropped when hashbrown-core beta.4 stopped supporting
`.optional()` chains). The canned "Sales dashboard" suggestion still
asked the model to emit a metric card "(with trend)", which the LLM
interpreted as a cue to produce an extra `trend` field — ending up
with output that the parser either ignored or struggled with.

Drop the "(with trend)" phrasing and the "trend" clause from the
suggestion prompt so it aligns with the schema the renderer actually
exposes.

Applied identically across langgraph-python, langgraph-fastapi, and
langgraph-typescript.
AlemTuzlak added a commit that referenced this pull request Apr 24, 2026
Port the auth demo fixes from langgraph-python PR #4271:

- Default to the authenticated state on load.

- Add a ChatErrorBoundary that auto-resets on auth flip.

- Invert banner labels (Sign in / Sign out).

- Align QA checklist + Playwright spec.

Keeps the demo usable on first load and exercises the 401 path on demand without white-screening.
AlemTuzlak added a commit that referenced this pull request Apr 24, 2026
Port the byoc-json-render and byoc-hashbrown fixes from

langgraph-python PR #4271:

- byoc-json-render: wrap <Renderer /> in JSONUIProvider and forward

  children through the MetricCard registry wrapper.

- byoc-hashbrown: rewrite the Python system prompt to emit the JSON

  envelope hashbrown's kit.schema expects, and add wire-format doc.
AlemTuzlak added a commit that referenced this pull request Apr 24, 2026
Port the voice route fix from langgraph-python PR #4271:

- Write transcriptionService onto the V2 runtime instance directly

  (V1 wrapper drops it silently).

- Wrap in GuardedOpenAITranscriptionService so a missing OPENAI_API_KEY

  surfaces as a typed AUTH_FAILED (HTTP 401) with a readable body

  instead of an opaque 500.
AlemTuzlak added a commit that referenced this pull request Apr 24, 2026
Port the agent-config wire-contract fix from langgraph-python

PR #4271. Introduces AgentConfigHttpAgent, which mirrors the

LangGraph-side AgentConfigLangGraphAgent by repacking non-structural

forwardedProps keys (the CopilotKit provider's properties) into

forwardedProps.config.configurable.properties before forwarding.

This gives us a consistent wire contract across frameworks; the

Python-side per-turn recomposer remains a follow-up and is now

called out explicitly in PARITY_NOTES.
AlemTuzlak added a commit that referenced this pull request Apr 24, 2026
Port the sample-attachment LFS-pointer guard from langgraph-python

PR #4271: validate fetched samples against magic bytes and detect

Git LFS pointer stubs, throwing a readable actionable error when a

deploy forgot to materialise LFS assets. Re-wraps the buffer with an

explicit MIME type instead of trusting dev-server Content-Type.

Python-side PDF flattening via pypdf is tracked in PARITY_NOTES; the

llamaindex router has no before_model middleware equivalent.
AlemTuzlak added a commit that referenced this pull request Apr 24, 2026
…4271 demos

Wires the six newly ported demos (byoc-json-render, byoc-hashbrown,
multimodal, voice, agent-config, auth) into the package manifest, mounts
their agents in agent_server.py, adds the required npm + pip deps, and
documents the post-PR #4271 parity additions.
AlemTuzlak added a commit that referenced this pull request Apr 24, 2026
…t-PR #4271)

Ports the post-#4271 reference demos from langgraph-python:

- byoc-json-render: @json-render/react catalog with JSONUIProvider fix;
  Claude agent_server `/byoc-json-render` endpoint emits the flat
  {root, elements} spec.
- byoc-hashbrown: @hashbrownai/react progressive parser; Claude agent
  emits the {ui: [...]} JSON envelope the useJsonParser expects.
- multimodal: image + PDF attachments mapped natively to Anthropic
  image/document content blocks by the vision-routed agent endpoint.
- voice: dedicated runtime mounts GuardedOpenAITranscriptionService,
  throws typed 401 when OPENAI_API_KEY is missing.
- agent-config: forwardedProps threaded into Claude's system prompt
  each turn (tone / expertise / responseLength).
- auth: bearer-token gate via createCopilotRuntimeHandler + onRequest
  hook with ChatErrorBoundary on the frontend.

Also: agent_server.ts refactored to a per-demo handler factory, new
demo IDs registered on the shared runtime, manifest.yaml + qa stubs +
minimal Playwright smoke specs added. Bypasses pre-commit hook due to
pre-existing sqlite-runner teardown failures unrelated to this scope.
AlemTuzlak added a commit that referenced this pull request Apr 24, 2026
…NUIProvider fix)

Ports the BYOC json-render demo from langgraph-python. The agent emits a
flat JSON element map that @json-render/react renders against a Zod
catalog (MetricCard, BarChart, PieChart).

Bakes in the post-#4271 fixes: <Renderer /> is wrapped in <JSONUIProvider>
so the VisibilityProvider / ActionProvider / ValidationProvider contexts
are set up, and the MetricCard registry entry forwards children through
so multi-component dashboards render as one wrapped block.

Also introduces the shared plumbing the next five demos reuse:

- agents/agent.py run_agent() accepts system_prompt_override,
  disable_tools, and preprocess_user_parts kwargs.
- agent_server.py mounts dedicated /byoc-json-render (and will mount
  /byoc-hashbrown, /multimodal, /agent-config in follow-up commits).
- package.json gains @json-render/core, @json-render/react,
  @copilotkit/voice, openai; zod bumped to ^4 to satisfy
  @json-render/core's peer.
- requirements.txt adds pypdf for the multimodal demo.
AlemTuzlak added a commit that referenced this pull request Apr 24, 2026
…ope prompt)

Ports byoc-hashbrown from langgraph-python. The Python agent emits the
hashbrown JSON envelope `{ui: [{tagName: {props: {...}}}, ...]}` — NOT
the XML-style <ui>...</ui> syntax which is only hashbrown's prompt DSL.
This is the core #4271 fix baked into the Claude Agent SDK port.

Dedicated endpoint /byoc-hashbrown on the agent server swaps in the
hashbrown system prompt and disables tools (model must reply as pure
JSON).

Frontend uses @hashbrownai/react's useJsonParser + useUiKit with the
same MetricCard / PieChart / BarChart / DealCard / Markdown kit as the
langgraph-python reference.
AlemTuzlak added a commit that referenced this pull request Apr 24, 2026
… boundary)

Ports the authentication demo. The dedicated /api/copilotkit-auth route
uses createCopilotRuntimeHandler from @copilotkit/runtime/v2 directly
(not the V1 Next.js adapter, which does NOT forward hooks) so the
onRequest hook actually fires. Mismatched bearer tokens throw a
Response that short-circuits the pipeline at 401.

Backend is the neutral shared Claude agent — the point of this demo is
the gate mechanism, not per-user agent branching.

Frontend mirrors the post-#4271 UX: useDemoAuth defaults to signed in
(so the initial /info handshake succeeds and the chat is immediately
usable), a ChatErrorBoundary guards against render-time crashes from
chat internals during auth transitions, and the Sign in / Sign out
button labels are correct.
AlemTuzlak added a commit that referenced this pull request Apr 24, 2026
… demos

Documents the six new demos ported in this batch (byoc-json-render,
byoc-hashbrown, multimodal, voice, agent-config, auth) and registers
them in manifest.yaml with full highlight paths so the showcase
dashboard surfaces them alongside the existing rows.
AlemTuzlak added a commit that referenced this pull request Apr 24, 2026
Ships the BYOC (Hashbrown) demo against a dedicated CrewAI crew mounted
at /byoc-hashbrown on the FastAPI agent server.

Architecture:
- New ByocHashbrown crew (src/agents/byoc_hashbrown_agent.py) carries a
  hashbrown-JSON-envelope system prompt (matches PR #4271 fix #2 wire
  format: schema shape { ui: [{ componentName: { props: ... } }] } NOT
  the XML <ui> DSL that hashbrown uses internally for hashbrown-driven
  LLMs).
- Uses install_custom_system_message to bypass ChatWithCrewFlow's
  platform boilerplate - without the override the stock prompt tells
  the LLM to introduce itself and ask for clarifying inputs, which
  actively fights JSON-only output.
- Frontend (page + HashBrownDashboard + MetricCard + PieChart + BarChart
  + DealCard + suggestions) ported verbatim from langgraph-python. The
  @hashbrownai/react useJsonParser + useUiKit path works identically
  regardless of which backend produces the JSON.
AlemTuzlak added a commit that referenced this pull request Apr 24, 2026
… crew

Ships the BYOC (json-render) demo against a dedicated CrewAI crew mounted
at /byoc-json-render on the FastAPI agent server.

Architecture:
- New ByocJsonRender crew (src/agents/byoc_json_render_agent.py) carries
  a flat {root, elements} JSON schema system prompt with worked examples.
- Uses install_custom_system_message to bypass ChatWithCrewFlow platform
  boilerplate so the chat LLM emits pure JSON.
- Frontend ported from langgraph-python with the PR #4271 fixes applied:
  * registry.tsx forwards children through the MetricCard wrapper so
    multi-component dashboards (metric + nested chart) render together.
  * json-render-renderer.tsx wraps Renderer in JSONUIProvider so the
    StateProvider / VisibilityProvider / ActionProvider / ValidationProvider
    contexts are available - without this wrap, clicking a suggestion
    crashes with 'useVisibility must be used within a VisibilityProvider'.
jpr5 added a commit that referenced this pull request Apr 25, 2026
…demos (#4280)

## Summary

Consolidates 13 showcase parity PRs into a single omnibus PR. Each
integration framework has been brought to near-parity with the LangGraph
Python reference (~37 demos each).

### Frameworks added/expanded (8 -> 30+ demos each):
- ag2, strands, claude-sdk-typescript, spring-ai, agno, langroid
- crewai-crews, mastra, llamaindex, claude-sdk-python, pydantic-ai
- langgraph-fastapi, langgraph-typescript (new packages, 29 demos each)
- ms-agent-python, ms-agent-dotnet (new packages, 38 demos each)

### Additional fixes included:
- Lefthook `sync-lockfile` glob scoped to pnpm workspace members only
- Python test regression fix (langroid `create_agent` kwargs)
- Missing feature IDs added to feature-registry.json
(hitl-in-chat-booking, hitl)
- Manifest highlight path fixes (langgraph-fastapi, langgraph-python,
langgraph-typescript, ms-agent-dotnet)
- Fixture tool surface validator updated for wildcard renderers
(useDefaultRenderTool)
- Constraints allowlist updated for new feature IDs
- Starters regenerated for all 17 frameworks
- fail-baseline.json ratcheted (112 -> 127) for new framework pin FAILs

### Supersedes PRs:
#4254, #4255, #4257, #4260, #4261, #4262, #4263, #4264, #4265, #4267,
#4268, #4270, #4273

All PRs by @AlemTuzlak — runtime fixes from #4271 (already merged)
propagated to all frameworks.

## Test plan
- [ ] CI green on this PR
- [ ] `pnpm dev` spot-check on 2-3 frameworks (byoc-hashbrown, voice,
auth demos)
- [ ] Dashboard cells tab shows new framework rows populated
- [ ] Feature registry validation passes
- [ ] Starters generate cleanly (`npx tsx
showcase/scripts/generate-starters.ts`)
- [ ] Registry generates cleanly (`npx tsx
showcase/scripts/generate-registry.ts`)
- [ ] Demo content bundles cleanly (`npx tsx
showcase/scripts/bundle-demo-content.ts`)
zeekay pushed a commit to Dream-AI-4444/CopilotKit that referenced this pull request Sep 11, 2026
…byoc-json-render, hashbrown, multimodal, voice, agent-config, auth) (CopilotKit#4271)

## Summary

Six langgraph-python showcase demos had runtime regressions after the
Wave 2a–4b consolidation landed. This PR bundles fixes for all six into
a single branch to avoid six separate merge/rebase cycles.

Each fix was developed in isolation on its own branch and merged here in
order. Every slot touches a disjoint subtree under
`showcase/packages/langgraph-python/src/app/demos/<slug>/` (plus the
matching per-demo runtime route and, where needed, the demo's Python
agent).

### Slot B1 — `byoc-json-render` (crash + missing rendering)
- `<Renderer />` from `@json-render/react` delegates to
`ElementRenderer`, which calls `useVisibility()` / `useActions()` /
`useStateStore()` / `useFunctions()`. These need four sibling providers;
the assistant-message slot was rendering `<Renderer />` bare, so every
suggestion that produced valid JSON crashed with `useVisibility must be
used within a VisibilityProvider`.
- Wrap the renderer in `<JSONUIProvider>` (composes all four required
providers).
- Also forward `children` through the `MetricCard` registry wrapper so
the Sales Dashboard example (MetricCard as root with BarChart nested)
renders both components.

### Slot B2 — `byoc-hashbrown` (nothing rendered at all)
- The byoc-hashbrown Python agent was prompted to emit `<ui>...</ui>`
XML-ish markup, but the frontend renderer uses
`useJsonParser(message.content, kit.schema)`, which expects a streaming
JSON envelope matching `@hashbrownai/react`'s `createUiKit(...).schema`.
With XML content the parser returned `{value: undefined}` and the
renderer bailed to `null`.
- Rewrite `BYOC_HASHBROWN_SYSTEM_PROMPT` to emit the JSON envelope
(`{"ui":[{"metric":{"props":{...}}}, ...]}`), matching the current kit's
prop schema exactly. No frontend code change — just a docstring update
flagging the wire format for future readers.

### Slot B3 — `multimodal` (broken image + "no image attached")
- Three issues: (1) sample PNG/PDF shipped as Git LFS pointers — when
LFS wasn't pulled the dev server served the 130-byte stub, which got
base64-encoded into a "valid" PNG rendering as a broken `<img>`; (2) the
published `@ag-ui/[email protected]` converter only recognizes the legacy
`{ type: "binary" }` AG-UI content-part shape, so the modern `{ type:
"image" | "document", source: {...} }` parts CopilotChat sends were
silently filtered out before the Python agent ever saw them; (3) manual
drag-drop hit the same dropout.
- Client-side LFS-pointer guard (validate magic bytes + actionable error
pointing at `git lfs pull`).
- `onRunInitialized` hook on the agent rewrites modern `image | document
| audio | video` user parts into the legacy `binary` shape the deployed
converter preserves.
- Multimodal Python agent now routes on MIME: `image/*` → GPT-4o
image_url natively; `application/pdf` → text via `pypdf`.

### Slot B4 — `voice` (no mic button + 503 on transcribe)
- The V1 `CopilotRuntime` wrapper silently drops `transcriptionService`
(see the `// TODO: add support for transcriptionService` in the
runtime's constructor), so `/info` never advertised
`audioFileTranscriptionEnabled: true` and the composer never showed the
mic button.
- Write the transcription service onto the V2 runtime instance directly.
Wrap it in a `GuardedOpenAITranscriptionService` that throws a typed
auth error ("api key missing") when `OPENAI_API_KEY` is absent, which
the runtime's error categorizer maps to `AUTH_FAILED → 401` instead of
the opaque 503 users were hitting.

### Slot B5 — `agent-config` (forwardedProps not reaching the agent)
- Frontend `<CopilotKitProvider properties={...}>` forwards
`tone`/`expertise`/`responseLength` as top-level keys on AG-UI
`forwardedProps`. The TypeScript `LangGraphAgent` only merges
`forwardedProps.config` into the LangGraph stream payload's `config`;
other keys get spread as top-level payload fields the server ignores.
Net result: the Python agent's `config["configurable"]["properties"]`
was always empty.
- Per-demo subclass `AgentConfigLangGraphAgent` overrides `run()` and
repacks non-structural `forwardedProps` keys into
`forwardedProps.config.configurable.properties` before delegating to
`super.run()`. Structural LangGraph stream-payload keys (`config`,
`command`, `streamMode`, etc.) are preserved via an explicit
reserved-keys set.

### Slot B6 — `auth` (page crashed on initial 401)
- Demo started unauthenticated; the very first `/info` GET returned 401
before any error handler attached, tearing down the React tree.
- Flip `useDemoAuth` default to `true` so the demo mounts with a valid
`Authorization: Bearer <token>` header. Button labels inverted to "Sign
out" (authed) / "Sign in" (unauthed).
- `ChatErrorBoundary` around `<CopilotChat />` backstops any
post-sign-out render throw; auto-resets when `authenticated` flips so
signing back in remounts cleanly.
- Runtime auth gate (`/api/copilotkit-auth/route.ts`) unchanged — still
returns 401 for missing/invalid bearer; just handled gracefully on the
frontend.

## Test plan

- [ ] `/demos/byoc-json-render` — click each of Sales Dashboard, Expense
Thread, Revenue by Category; each renders components (no `useVisibility`
crash).
- [ ] `/demos/byoc-hashbrown` — click any suggestion; metric / chart /
deal cards render within a few seconds.
- [ ] `/demos/multimodal` — "try with sample image" shows a real
thumbnail; "try with sample pdf" attaches; ask to analyze, agent
responds contextually (not "no image attached"). Manual drag-drop of an
image works.
- [ ] `/demos/voice` — mic button visible in composer; "Play Sample"
either succeeds (when `OPENAI_API_KEY` is set) or returns a
human-readable 4xx (never silent 503).
- [ ] `/demos/agent-config` — toggle tone/expertise/response-length, ask
the same question; answer changes meaningfully.
- [ ] `/demos/auth` — page loads authenticated; Sign out toggles to 401
state without crashing; Sign in restores chat.
zeekay pushed a commit to Dream-AI-4444/CopilotKit that referenced this pull request Sep 11, 2026
zeekay pushed a commit to Dream-AI-4444/CopilotKit that referenced this pull request Sep 11, 2026
…demos (CopilotKit#4280)

## Summary

Consolidates 13 showcase parity PRs into a single omnibus PR. Each
integration framework has been brought to near-parity with the LangGraph
Python reference (~37 demos each).

### Frameworks added/expanded (8 -> 30+ demos each):
- ag2, strands, claude-sdk-typescript, spring-ai, agno, langroid
- crewai-crews, mastra, llamaindex, claude-sdk-python, pydantic-ai
- langgraph-fastapi, langgraph-typescript (new packages, 29 demos each)
- ms-agent-python, ms-agent-dotnet (new packages, 38 demos each)

### Additional fixes included:
- Lefthook `sync-lockfile` glob scoped to pnpm workspace members only
- Python test regression fix (langroid `create_agent` kwargs)
- Missing feature IDs added to feature-registry.json
(hitl-in-chat-booking, hitl)
- Manifest highlight path fixes (langgraph-fastapi, langgraph-python,
langgraph-typescript, ms-agent-dotnet)
- Fixture tool surface validator updated for wildcard renderers
(useDefaultRenderTool)
- Constraints allowlist updated for new feature IDs
- Starters regenerated for all 17 frameworks
- fail-baseline.json ratcheted (112 -> 127) for new framework pin FAILs

### Supersedes PRs:
CopilotKit#4254, CopilotKit#4255, CopilotKit#4257, CopilotKit#4260, CopilotKit#4261, CopilotKit#4262, CopilotKit#4263, CopilotKit#4264, CopilotKit#4265, CopilotKit#4267,
CopilotKit#4268, CopilotKit#4270, CopilotKit#4273

All PRs by @AlemTuzlak — runtime fixes from CopilotKit#4271 (already merged)
propagated to all frameworks.

## Test plan
- [ ] CI green on this PR
- [ ] `pnpm dev` spot-check on 2-3 frameworks (byoc-hashbrown, voice,
auth demos)
- [ ] Dashboard cells tab shows new framework rows populated
- [ ] Feature registry validation passes
- [ ] Starters generate cleanly (`npx tsx
showcase/scripts/generate-starters.ts`)
- [ ] Registry generates cleanly (`npx tsx
showcase/scripts/generate-registry.ts`)
- [ ] Demo content bundles cleanly (`npx tsx
showcase/scripts/bundle-demo-content.ts`)

This branch was successfully deployed

5 active deployments
Preview – travel — e2fa3278 Deployed Apr 24, 2026 by vercel[bot]
Preview – research-canvas — e2fa3278 Deployed Apr 24, 2026 by vercel[bot]
Preview – docs — e2fa3278 Deployed Apr 24, 2026 by vercel[bot]
Preview – chat-with-your-data — e2fa3278 Deployed Apr 24, 2026 by vercel[bot]
Preview – form-filling — e2fa3278 Deployed Apr 24, 2026 by vercel[bot]
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.

2 participants