Skip to content

feat(showcase/claude-sdk-python): bring closer to parity with langgraph-python (frontend-only demos) - #4268

Closed
AlemTuzlak wants to merge 18 commits into
mainfrom
feat/showcase-claude-sdk-python-parity
Closed

AlemTuzlak wants to merge 18 commits into
mainfrom
feat/showcase-claude-sdk-python-parity

Conversation

@AlemTuzlak

Copy link
Copy Markdown
Contributor

Summary

Brings showcase/packages/claude-sdk-python/ closer to feature parity with showcase/packages/langgraph-python/ by porting the frontend-only demos that run against the shared default Claude agent. Additional demos that require new agent-side plumbing (extended thinking streams, langgraph interrupt primitive, MCP client, A2UI catalogs, reasoning chains, etc.) are deferred and documented in PARITY_NOTES.md.

Lands alongside parallel PRs for pydantic-ai and claude-sdk-typescript.

Ported

  • cli-start — manifest-only entry with the framework-slug init command.
  • prebuilt-sidebar — default <CopilotSidebar /> over the shared agent.
  • prebuilt-popup — default <CopilotPopup /> over the shared agent.
  • chat-slots — welcomeScreen / input.disclaimer / messageView.assistantMessage slot overrides.
  • chat-customization-css — scoped CSS variable + class overrides.
  • headless-simple — useAgent + useComponent minimal custom chat surface.

Each port ships:

  • src/app/demos/<id>/ (page + any supporting components)
  • manifest.yaml entry in both features: and demos: (with highlight: paths matching the langgraph-python shape).
  • qa/<id>.md — QA checklist pattern-matched to existing claude-sdk-python QA files.
  • tests/e2e/<id>.spec.ts — minimal Playwright specs that navigate to the route and assert the page renders.

src/app/api/copilotkit/route.ts registers the five new agent ids against the shared HttpAgent.

Skipped (documented in PARITY_NOTES.md)

  • gen-ui-interrupt, interrupt-headless — require LangGraph's interrupt() primitive; Claude Agent SDK has no equivalent graph-interrupt primitive.
  • agentic-chat-reasoning, reasoning-default-render, tool-rendering-reasoning-chain — require streaming Claude extended-thinking content blocks as separate AG-UI parts; the existing agents/agent.py AG-UI bridge does not translate thinking blocks.
  • mcp-apps — MCP client + dedicated runtime route; agent-side MCP glue out of scope for this pass.
  • declarative-gen-ui, a2ui-fixed-schema — A2UI catalog plus agent-side render_a2ui wiring. Deferred to an A2UI follow-up.
  • beautiful-chat — 28 supporting files (layout, canvas, chart gen UI, hooks, theme CSS). Skeleton to be added in a follow-up.
  • frontend-tools, frontend-tools-async, hitl-in-app, readonly-state-agent-context, open-gen-ui, open-gen-ui-advanced, tool-rendering-default-catchall, tool-rendering-custom-catchall, headless-complete — deferred per PARITY_NOTES.md (each needs a dedicated demo agent and/or multi-file frontend surface).

Test plan

  • pnpm typecheck / next build passes at showcase/packages/claude-sdk-python (local environment produced broken node_modules symlinks on Windows during this pass — see CONCERNS).
  • Manual smoke: each ported demo route loads without runtime error, chat input is visible, and sending a message reaches the agent.
  • Each new Python module (none added this pass) imports cleanly — n/a here.

@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 6:27pm
docs Ready Ready Preview, Comment Apr 24, 2026 6:27pm
form-filling Ready Ready Preview, Comment Apr 24, 2026 6:27pm
research-canvas Ready Ready Preview, Comment Apr 24, 2026 6:27pm
travel Ready Ready Preview, Comment Apr 24, 2026 6:27pm

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

Copy link
Copy Markdown
Contributor Author

Follow-up pass (B2') — closing the parity gap

Adding 9 more demos on top of the initial B2 set, bringing this package from 6 ported demos to 15:

New demos

  • frontend-tools — useFrontendTool with sync handler (change_background).
  • frontend-tools-async — useFrontendTool with async handler (query_notes).
  • hitl-in-app — async frontend-tool HITL with app-level approval modal. Uses fixed inset-0 overlay instead of createPortal to avoid adding @types/react-dom (same approach the pydantic-ai port took).
  • readonly-state-agent-context — useAgentContext read-only context pattern.
  • tool-rendering-default-catchall — zero-config built-in DefaultToolCallRenderer.
  • tool-rendering-custom-catchall — branded useDefaultRenderTool wildcard.
  • open-gen-ui — minimal Open Generative UI with dedicated /api/copilotkit-ogui route and openGenerativeUI flag.
  • open-gen-ui-advanced — OGUI with frontend sandbox functions (evaluateExpression, notifyHost).
  • headless-complete — full custom chat built on useAgent with per-tool renderers, frontend component (useComponent / highlight_note), and wildcard catch-all. Routed through /api/copilotkit since this package doesn't port mcp-apps.

Skipped — documented honestly in PARITY_NOTES.md

  • declarative-gen-ui, a2ui-fixed-schema — A2UI catalog infrastructure (feasible, deferred).
  • mcp-apps — MCP client wiring (feasible, deferred).
  • beautiful-chat — 28+ supporting files; a standalone effort.
  • gen-ui-interrupt, interrupt-headless, agentic-chat-reasoning, reasoning-default-render, tool-rendering-reasoning-chain — framework-limited (no equivalent Claude Agent SDK primitives without new AG-UI event types / thinking-aware message buffer).

Verification

  • npx tsc --noEmit — only baseline errors (module resolution for next/@playwright/test/@ag-ui/client in route and spec files) pre-exist on this branch. No NEW type errors in the demos added.
  • Python import check passes for each new agent stub (frontend_tools, frontend_tools_async, hitl_in_app, readonly_state_agent_context, open_gen_ui_agent, open_gen_ui_advanced_agent).

Each demo got a qa/<id>.md stub and a minimal tests/e2e/<id>.spec.ts Playwright smoke spec.

…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.
…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.
…chments)

Ports the multimodal attachments demo. Claude's Messages API supports
image content parts natively, so images become Claude image blocks
(base64 inline) and PDFs are flattened to text via pypdf for a
provider-agnostic, self-contained demo.

Dedicated endpoint /multimodal on the agent server swaps in the
vision-oriented system prompt and runs a preprocess_user_parts function
that translates AG-UI image/document parts into Claude's shape.

Importantly, the Claude port does NOT need the legacy-binary
onRunInitialized shim the langgraph-python reference installs. That
shim exists solely to work around the @ag-ui/[email protected] converter
silently dropping modern multimodal parts. HttpAgent forwards the
modern parts to the Claude Agent SDK backend unchanged, so the backend
can consume them directly.

Frontend preserves the LFS-pointer guard and sample injection pipeline
from the reference so the bundled sample.png / sample.pdf behaviour is
identical across packages.
…on service)

Ports the voice input demo. No Python changes — voice is an input-
modality concern handled entirely by the Next.js runtime, and the
underlying agent is the same neutral shared Claude backend used by
other chat demos.

The dedicated /api/copilotkit-voice route mounts a
GuardedOpenAITranscriptionService onto the V2 runtime instance
directly (writing through .instance to bypass the V1 wrapper's silent
drop of transcriptionService) and, when OPENAI_API_KEY is missing,
throws an error containing "api key" so the runtime's error
categorizer maps it to AUTH_FAILED → HTTP 401 instead of a silent 503.

Also exports GET = POST so the V2 runtime client's /info probe fails
cleanly (falling back to single-route POST) instead of logging a 405
as a server error.
…ps routing)

Ports the Agent Config Object demo. Dedicated /agent-config endpoint on
the agent server reads tone / expertise / responseLength off
forwarded_props.config.configurable.properties (with a fallback to
top-level keys for resilience) and composes the system prompt per turn
before invoking Claude.

The Next.js route subclasses HttpAgent to repack provider `properties`
(which arrive as top-level keys on forwardedProps) into the nested
`forwardedProps.config.configurable.properties` shape — matching the
langgraph-python reference's wire format exactly, so the Playwright
specs and debugging lore stay framework-agnostic.

Frontend copies the ConfigCard / useAgentConfig hook verbatim from the
reference; only the runtime URL and agent id change.
… 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.
… 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

Copy link
Copy Markdown
Contributor Author

B2'' — post-#4271 demos ported to claude-sdk-python

Ports the six new reference demos introduced by #4271 onto the Claude Agent SDK (Python) showcase package. The rebase pulled the post-#4271 langgraph-python versions into this branch, and those fixed versions were used as the template so PR #4271 fixes are baked in.

Demos ported

  • byoc-json-render — @json-render/react BYOC with the <JSONUIProvider> wrap + MetricCard children-forwarding fixes. Dedicated /byoc-json-render endpoint emits the flat {root, elements} JSON spec.
  • byoc-hashbrown — Dedicated /byoc-hashbrown endpoint emits the hashbrown JSON envelope {ui: [{tagName: {props: {...}}}, ...]} (NOT XML — the core fix(showcase/langgraph-python): repair six demo runtime regressions (byoc-json-render, hashbrown, multimodal, voice, agent-config, auth) #4271 fix).
  • multimodal — Claude consumes modern AG-UI image/document parts directly, so no legacy-binary onRunInitialized shim is required (that's specific to @ag-ui/[email protected]). Images → Claude image blocks; PDFs → pypdf text flatten. LFS-pointer guard + sample-injection pipeline preserved.
  • voice — Dedicated runtime with GuardedOpenAITranscriptionService written onto the V2 instance directly (bypasses V1 wrapper's silent transcriptionService drop). Missing OPENAI_API_KEY → 401, not 503.
  • agent-config — Dedicated /agent-config endpoint reads tone/expertise/responseLength off forwarded_props.config.configurable.properties. Frontend route subclasses HttpAgent to repack provider properties into the nested shape — wire format matches the langgraph-python reference exactly.
  • auth — Dedicated route uses createCopilotRuntimeHandler from @copilotkit/runtime/v2 directly (V1 adapter drops hooks). useDemoAuth defaults to signed-in, ChatErrorBoundary prevents white-screens, bearer token gate returns 401 on mismatch.

Shared plumbing introduced

  • agents/agent.py run_agent() now accepts system_prompt_override, disable_tools, and preprocess_user_parts kwargs so dedicated endpoints reuse the streaming loop.
  • agent_server.py mounts four new endpoints: /byoc-json-render, /byoc-hashbrown, /multimodal, /agent-config.
  • package.json gains @json-render/core, @json-render/react, @copilotkit/voice, openai; zod bumped to ^4 (required peer of @json-render/core).
  • requirements.txt adds pypdf for the multimodal demo.

Verification

  • npx tsc --noEmit — zero new errors vs baseline. All remaining Cannot find module '@ag-ui/client' / 'next/server' errors are preexisting (same dangling-symlink symptom the existing copilotkit/route.ts and copilotkit-ogui/route.ts report).
  • python -m py_compile on every new Python module — syntax clean.
  • Pre-commit hook (lint, nx build+test across 16 packages, commitlint) passed on every commit.

PARITY_NOTES updated

New ## New demos (post-PR #4271) section at the top documents each port as a one-liner, with explicit call-outs for the claude-specific simplifications (no legacy-binary shim, no extended thinking plumbing needed since these demos don't exercise it).

Deferred demos from B2'

The four previously-deferred demos (declarative-gen-ui, a2ui-fixed-schema, mcp-apps, beautiful-chat) were not picked up in this pass — each requires substantial multi-file catalog / MCP / theme infrastructure that didn't fit alongside the primary six. Left for follow-up.

@jpr5

jpr5 commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

Superseded by #4280 (omnibus parity PR)

@jpr5 jpr5 closed this Apr 25, 2026
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`)
@jpr5
jpr5 deleted the feat/showcase-claude-sdk-python-parity branch June 1, 2026 18:49
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 – research-canvas — 2c5c4912 Deployed Apr 24, 2026 by vercel[bot]
Preview – travel — 2c5c4912 Deployed Apr 24, 2026 by vercel[bot]
Preview – docs — 2c5c4912 Deployed Apr 24, 2026 by vercel[bot]
Preview – chat-with-your-data — 2c5c4912 Deployed Apr 24, 2026 by vercel[bot]
Preview – form-filling — 2c5c4912 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