Skip to content

fix(a2ui): omit component schemas from catalog context when includeSchema is false (React, Vue, Angular) - #7810

Merged
BenTaylorDev merged 5 commits into
CopilotKit:mainfrom
Arpit-Khandelwal:fix/a2ui-include-schema-false
Oct 27, 2026
Merged

BenTaylorDev merged 5 commits into
CopilotKit:mainfrom
Arpit-Khandelwal:fix/a2ui-include-schema-false

Conversation

@Arpit-Khandelwal

@Arpit-Khandelwal Arpit-Khandelwal commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

a2ui={{ includeSchema: false }} is meant to stop component schemas being sent to the agent, but the "A2UI catalog capabilities" context entry always embedded every custom component's JSON schema. With a 5-component catalog that was still ~10k characters of agent context with the flag off. React, Vue and Angular each build this entry with their own copy of the logic, and all three had the gap.

Following option 1 from #7802: when includeSchema is false, the capabilities entry lists the catalog ID and the custom component names only, without JSON schemas. All three frameworks now send the same string for the same catalog:

Available A2UI catalog:
- copilotkit://custom-catalog
  Custom catalog (does NOT include all basic components).
  Custom components:
  - FlightCard
  - PieChart
  • React: buildCatalogContextValue (packages/a2ui-renderer) takes an optional { includeSchema } argument; A2UICatalogContext (packages/react-core) passes the provider's flag through.
  • Vue: same change in packages/vue/src/v2/components/a2ui/A2UICatalogContext.ts; registerA2UICatalogContext passes the provider's includeSchema through (still reactive).
  • Angular: same change in packages/angular/src/lib/components/a2ui/a2ui-catalog-context.ts; CopilotKit passes a2ui.includeSchema through.

What stays the same:

  • With includeSchema: true (the default) the entry is byte-for-byte unchanged in all three frameworks, including the full schemas.
  • The - <catalogId> first line and the entry's description are unchanged, so the LangGraph middleware still finds the entry and reads the catalog ID from it.
  • The basic-catalog output is unchanged.

LangGraph consequence

The LangGraph middleware (packages/sdk-js/src/langgraph/middleware.ts, sdk-python/copilotkit/copilotkit_lg_middleware.py) finds this entry by its "A2UI catalog" description and passes its whole value to the injected A2UI tool's subagent as the composition guide. So a host that sets includeSchema: false and uses the injected A2UI tool now gives the subagent the component names only, not their schemas. That matches what false says it does. A host that wants the subagent to have more can still pass a composition guide through the middleware's guidelines, which take precedence over the catalog entry:

  • TypeScript: createCopilotkitMiddleware({ a2uiParams: { guidelines: { compositionGuide } } })
  • Python: CopilotKitMiddleware(a2ui_params={"guidelines": {"composition_guide": ...}})

Docs

  • includeSchema JSDoc on the React, Vue and Angular providers now says what false still sends (catalog ID and custom component names; no schemas, no generation/design guidelines) and the LangGraph note above.
  • Provider references: React CopilotKit, Vue CopilotKitProvider and Angular provideCopilotKit, plus the Angular A2UI guide (showcase/shell-docs/src/content/...), and the older example docs page examples/v2/docs/reference/copilotkit-provider.mdx.

Tests

  • React: catalog-utils.test.ts covers default, true, false (exact string) and the basic catalog, plus provider tests in CopilotKitProvider.a2ui.test.tsx checking the registered capabilities value with includeSchema: false and by default.
  • Vue: new A2UICatalogContext.test.ts for the builder, plus provider tests in CopilotKitProvider.a2ui.test.ts checking the registered capabilities value with includeSchema: false and by default.
  • Angular: new a2ui-catalog-context.spec.ts for the builder, plus copilotkit.spec.ts tests checking the registered capabilities value with includeSchema: false and by default.

The false tests assert the same literal string in all three packages.

Not in this PR: the duplicate schemas when includeSchema is true (option 2 in the issue), which the maintainers chose to leave as is for now.

Related PRs and Issues

Checklist

  • I have read the Contribution Guide
  • If the PR changes or adds functionality, I have updated the relevant documentation
  • If the PR contains a breaking change, the title has ! (not breaking)

Summary by CodeRabbit

  • New Features
    • A2UI catalog context can now include or omit custom component schemas. Schemas are included by default; when omitted, the context retains the catalog ID and custom component names.
    • This option is supported across React, Angular, and Vue, and updates are reflected when the setting changes.
  • Documentation
    • Updated provider and integration guidance to explain what context each setting includes and how to provide additional composition guidance.

…includeSchema is false

buildCatalogContextValue always embedded the JSON schema of every custom
component in the "A2UI catalog capabilities" context entry, so
`a2ui={{ includeSchema: false }}` still sent all of them to the agent.

It now takes an optional `{ includeSchema }` argument. When it is false,
custom components are listed by name only. A2UICatalogContext passes the
provider's flag through. The default output is unchanged.

Fixes CopilotKit#7802
@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between c540f7e and 3e535d0.

Files selected for processing: 2
  • packages/react-core/src/v2/providers/__tests__/CopilotKitProvider.a2ui.test.tsx
  • showcase/shell-docs/src/content/reference/components/CopilotKit.mdx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

The catalog context builders and provider integrations now support includeSchema. When it is false, custom component schemas are omitted from catalog context while catalog IDs and custom component names remain.

Changes: A2UI schema context

Layer / File(s) Summary
Catalog context builders
packages/a2ui-renderer/src/react-renderer/catalog-utils.ts, packages/angular/src/lib/components/a2ui/a2ui-catalog-context.ts, packages/vue/src/v2/components/a2ui/A2UICatalogContext.ts, packages/*/a2ui/*catalog-context* tests
The builders accept includeSchema and omit custom component schemas when it is false. Tests cover default inclusion, explicit inclusion, omission, and unchanged basic-catalog output.
Provider context wiring and documentation
packages/react-core/src/v2/a2ui/A2UICatalogContext.tsx, packages/angular/src/lib/copilotkit.ts, packages/vue/src/v2/components/a2ui/A2UICatalogContext.ts, packages/* provider tests and documentation, examples/v2/docs/reference/copilotkit-provider.mdx, showcase/shell-docs/src/content/*
Provider paths pass the setting to catalog context generation. Angular returns after adding catalog context when schemas are disabled, so it omits the additional schema and guideline contexts. Provider tests and documentation describe the option and its context behavior.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

  • None. The retrieved issue is directly linked to this pull request.
Merge Risk: Minimal · up to 3e535

No actionable merge-blocking risk remains in the reviewed changes.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Linked Issues check Warning Issue #7802 has two coding requirements. The title and Expected Behavior both state that the default path must send each custom component schema once. Requirement 1, includeSchema: false omits custo… In the default path (includeSchema unset or true), emit each custom component schema once. Preferred approach: remove schemas from the capabilities entry and keep the component-schema entry, as the issue suggests. Apply the same change …
Docstring Coverage Warning Docstring coverage is 35.71% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 14 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: omitting component schemas when includeSchema is false across React, Vue, and Angular A2UI implementations.
Out of Scope Changes check Passed The changes support #7802. They include: the includeSchema option on buildCatalogContextValue in React, Vue and Angular; forwarding of the provider flag in A2UICatalogContext.tsx, `registerA2UIC…
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Out of Scope Changes check

Explanation

The changes support #7802. They include: the includeSchema option on buildCatalogContextValue in React, Vue and Angular; forwarding of the provider flag in A2UICatalogContext.tsx, registerA2UICatalogContext and CopilotKit (Angular); and builder and provider tests. The documentation updates describe the false behavior and the LangGraph consequence. The docs cover the a2ui prop, the Angular A2UI guide and the provideCopilotKit reference. The basic-catalog output is unchanged and no unrelated module is modified. The PR description notes an overlap with #6550 in catalog-utils.ts, but that overlap does not add unrelated behavior in this diff. The LangGraph middleware files are referenced in the docs and not modified in a way that changes behavior.

Full details: Linked Issues check

Explanation

Issue #7802 has two coding requirements. The title and Expected Behavior both state that the default path must send each custom component schema once. Requirement 1, includeSchema: false omits custom component schemas, is implemented. buildCatalogContextValue receives includeSchema in React (packages/a2ui-renderer, packages/react-core), Vue (packages/vue/src/v2/components/a2ui/A2UICatalogContext.ts) and Angular (a2ui-catalog-context.ts, copilotkit.ts). Tests assert the same literal names-only string. Requirement 2 is unmet. At head, A2UICatalogContext.tsx calls buildCatalogContextValue(catalog, { includeSchema: includeSchema !== false }), which embeds schemas when the flag is true or unset. The same component also builds schemaValue from extractCatalogComponentSchemas(catalog) and registers it under A2UI_SCHEMA_CONTEXT_DESCRIPTION. Each custom schema therefore still appears twice in the default path. The PR description defers this as option 2. That decision does not remove the requirement from the linked issue, and no default-path test checks single emission.

Resolution

In the default path (includeSchema unset or true), emit each custom component schema once. Preferred approach: remove schemas from the capabilities entry and keep the component-schema entry, as the issue suggests. Apply the same change in React, Vue and Angular so the three frameworks stay aligned. Add context-registration tests that assert one schema payload per component for the default and explicit true paths. If the maintainers instead decide to keep the duplicate, record that decision in the issue and do not close #7802 with this PR.

Full details: Docstring Coverage

Explanation

Docstring coverage is 35.71% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 14 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…cludeSchema is false

The Vue and Angular providers build their own "A2UI catalog capabilities"
context entry and, like React did, always embedded every custom
component's JSON schema in it, so `includeSchema: false` still sent them.

Both builders now take an optional `{ includeSchema }` argument and list
custom components by name only when it is false, producing the same
string as the React builder. The providers pass their `includeSchema`
setting through. Output with `includeSchema: true` (the default) is
unchanged, as is the `- <catalogId>` line the LangGraph middleware reads.

The `includeSchema` JSDoc on the React, Vue and Angular providers now says
what `false` still sends, and that a LangGraph A2UI subagent then gets
component names only unless the host passes a composition guide through
the middleware's guidelines.

Refs CopilotKit#7802
With `includeSchema: false` the A2UI catalog context still carries the
catalog ID and custom component names, without schemas or the generation
and design guidelines. Say so in the Vue and Angular provider references,
the Angular A2UI guide and the React provider reference in examples, and
note that a LangGraph A2UI subagent then gets component names only unless
the host passes a composition guide through the middleware's guidelines.

Refs CopilotKit#7802
@Arpit-Khandelwal Arpit-Khandelwal changed the title fix(a2ui-renderer): omit component schemas from catalog context when includeSchema is false fix(a2ui): omit component schemas from catalog context when includeSchema is false (React, Vue, Angular) Oct 23, 2026

@BenTaylorDev BenTaylorDev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking up the Vue and Angular copies so quickly. The code does what we asked. With includeSchema: false, all three frameworks now send the catalog ID and the custom component names only. With true, the output is the same as before. I checked this through a real CopilotKitProvider render. On main, the capabilities entry was 655 characters with both schemas. On this branch, it is 160 characters with names only. The default output is byte-identical. I also checked the LangGraph consumers in sdk-js, sdk-python and the ag-ui toolkit. They still read the catalog ID from the - <catalogId> line, and a host composition guide still wins. Your new tests fail when I put back the main source, which is what we want.

Two things are left before this can merge.

  1. React provider reference in the live docs. The file you edited, examples/v2/docs/reference/copilotkit-provider.mdx, is the old example docs site. It is not the published docs. The live React reference is showcase/shell-docs/src/content/reference/components/CopilotKit.mdx. Its a2ui entry, near line 192, is typed as { theme?: Theme } and does not mention includeSchema. Please add includeSchema there, with the same text you used for Vue and Angular. Say that false still sends the catalog ID and custom component names. Add the LangGraph note too: the A2UI subagent gets names only, and a host can pass a2uiParams.guidelines.compositionGuide or a2ui_params["guidelines"]["composition_guide"]. You can leave the examples/v2/docs edit in or take it out.

  2. A React provider-level test. Vue and Angular each have a test that mounts the provider and checks the registered capabilities value. React only tests buildCatalogContextValue. Nothing checks that A2UICatalogContext passes includeSchema through. Please add a react-core test that renders CopilotKitProvider with a2ui={{ catalog, includeSchema: false }} and asserts the exact capabilities value from copilotkit.context. Also cover the default case. Do not mock A2UICatalogContext. One tip: the react-core test setup pins randomUUID from @copilotkit/shared to one value. Override it in the test, or the four context entries will overwrite each other.

The branch is behind main but merges cleanly, so you do not need to rebase for this. Thanks again.

@Arpit-Khandelwal

Copy link
Copy Markdown
Contributor Author

@BenTaylorDev thanks for the thorough check. Both are pushed:

  1. Live React docs: showcase/shell-docs/src/content/reference/components/CopilotKit.mdx now types a2ui with its real fields (theme, catalog, loadingComponent, includeSchema, recovery) and has the same includeSchema paragraph as the Vue and Angular pages, including the LangGraph note and both composition-guide spellings. I left the examples/v2/docs edit in.

  2. React provider test: packages/react-core/src/v2/providers/__tests__/CopilotKitProvider.a2ui.test.tsx renders a real CopilotKitProvider (no mock of A2UICatalogContext) with a FlightCard + PieChart catalog and reads copilotkit.context:

    • includeSchema: false: the capabilities value equals the exact names-only string, and it's the only A2UI entry registered.
    • default: the value equals what main sent, schemas included, and all four A2UI entries are registered.

    randomUUID is overridden with a counter for these tests and restored afterwards; without it the default case fails as you said. With A2UICatalogContext.tsx put back to main, the false case fails and the default case still passes.

No rebase, just two commits on top.

@pkg-pr-new

pkg-pr-new Bot commented Oct 27, 2026

Copy link
Copy Markdown
@copilotkit/a2ui-renderer

pnpm add https://pkg.pr.new/@copilotkit/a2ui-renderer@7810

@copilotkit/agentcore-runner

pnpm add https://pkg.pr.new/@copilotkit/agentcore-runner@7810

@copilotkit/angular

pnpm add https://pkg.pr.new/@copilotkit/angular@7810

@copilotkit/channels

pnpm add https://pkg.pr.new/@copilotkit/channels@7810

@copilotkit/channels-core

pnpm add https://pkg.pr.new/@copilotkit/channels-core@7810

@copilotkit/channels-discord

pnpm add https://pkg.pr.new/@copilotkit/channels-discord@7810

@copilotkit/channels-intelligence

pnpm add https://pkg.pr.new/@copilotkit/channels-intelligence@7810

@copilotkit/channels-slack

pnpm add https://pkg.pr.new/@copilotkit/channels-slack@7810

@copilotkit/channels-teams

pnpm add https://pkg.pr.new/@copilotkit/channels-teams@7810

@copilotkit/channels-ui

pnpm add https://pkg.pr.new/@copilotkit/channels-ui@7810

@copilotkit/channels-whatsapp

pnpm add https://pkg.pr.new/@copilotkit/channels-whatsapp@7810

@copilotkit/core

pnpm add https://pkg.pr.new/@copilotkit/core@7810

@copilotkit/intelligence-langgraph

pnpm add https://pkg.pr.new/@copilotkit/intelligence-langgraph@7810

@copilotkit/intelligence-mastra

pnpm add https://pkg.pr.new/@copilotkit/intelligence-mastra@7810

@copilotkit/learning

pnpm add https://pkg.pr.new/@copilotkit/learning@7810

@copilotkit/mcp-apps-renderer

pnpm add https://pkg.pr.new/@copilotkit/mcp-apps-renderer@7810

@copilotkit/react-core

pnpm add https://pkg.pr.new/@copilotkit/react-core@7810

@copilotkit/react-native

pnpm add https://pkg.pr.new/@copilotkit/react-native@7810

@copilotkit/react-textarea

pnpm add https://pkg.pr.new/@copilotkit/react-textarea@7810

@copilotkit/react-ui

pnpm add https://pkg.pr.new/@copilotkit/react-ui@7810

@copilotkit/runtime

pnpm add https://pkg.pr.new/@copilotkit/runtime@7810

@copilotkit/runtime-client-gql

pnpm add https://pkg.pr.new/@copilotkit/runtime-client-gql@7810

@copilotkit/sdk-js

pnpm add https://pkg.pr.new/@copilotkit/sdk-js@7810

@copilotkit/shared

pnpm add https://pkg.pr.new/@copilotkit/shared@7810

@copilotkit/sqlite-runner

pnpm add https://pkg.pr.new/@copilotkit/sqlite-runner@7810

@copilotkit/voice

pnpm add https://pkg.pr.new/@copilotkit/voice@7810

@copilotkit/vue

pnpm add https://pkg.pr.new/@copilotkit/vue@7810

@copilotkit/web-components

pnpm add https://pkg.pr.new/@copilotkit/web-components@7810

@copilotkit/web-inspector

pnpm add https://pkg.pr.new/@copilotkit/web-inspector@7810

commit: 3e535d0

@BenTaylorDev BenTaylorDev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both follow-ups check out. The React reference now types a2ui with its real fields and documents what includeSchema: false still sends, with the LangGraph note. The new provider test renders a real CopilotKitProvider without mocking A2UICatalogContext; it passes on this branch merged with current main, and with A2UICatalogContext.tsx reverted to main the includeSchema: false case fails while the default case passes. Thanks for turning both around so fast.

I bless the code with a glad heart

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.

🐛 Bug: includeSchema: false still sends every custom component's JSON schema (and the default sends it twice)

2 participants