Skip to content

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

Closed

Description

@Laptopmini

♻️ Reproduction Steps

  1. Mount the provider with a custom catalog (5 custom components) and includeSchema: false:
    <CopilotKit agents__unsafe_dev_only={{ default: agent }} a2ui={{ catalog, includeSchema: false }}>
  2. Read the registered agent context (useCopilotKit().copilotkit.context).
  3. Repeat with includeSchema: true (the default).

✅ Expected Behavior

The provider reference describes includeSchema as "When true (default), full component schemas are sent as agent context so the agent knows what's available", and the JSDoc on CopilotKitProvider says "Set to false to disable". So with false I expected the custom components' JSON schemas not to be sent, e.g. only the catalog ID and component names/descriptions. With true I expected each schema to be sent once.

❌ Actual Behavior

Measured on 1.79.0 with a 5-component custom catalog:

includeSchema A2UI context entries chars of agent context
false 1: "A2UI catalog capabilities" 10,484, including the full JSON schema of all 5 custom components
true 4: capabilities (10,484) + "A2UI Component Schema" (56,043) + generation (4,208) + design guidelines (1,509) 72,244

A2UICatalogContext always registers the capabilities entry, built by buildCatalogContextValue(catalog), which embeds zodToJsonSchema of each custom component. includeSchema only gates the other three entries (packages/react-core/src/v2/a2ui/A2UICatalogContext.tsx, lines 36–48). So:

  • includeSchema: false still sends every custom component's schema;
  • the default sends each custom component's schema twice, once in capabilities and again in the Component Schema entry.

Why it matters to me: I use a direct-connect setup with a local model, where the Python tool emits the A2UI operations itself, so the agent never needs the schemas. 10.5k chars of agent context is a real share of a local model's context window, and includeSchema: false looked like the switch for it. The fallback is to not pass a2ui at all and mount A2UIProvider / A2UIRenderer myself, which works but skips the provider's built-in renderer.

Screenshots

No response

𝌚 CopilotKit Version

`@copilotkit/react-core` / `@copilotkit/a2ui-renderer` 1.79.0 (also seen on 1.67.1).

Is this intended? A few options, if any is useful:
1. When `includeSchema` is `false`, have the capabilities entry list catalog IDs plus component names and descriptions only.
2. When it's `true`, drop the schemas from the capabilities entry, since the Component Schema entry already has them.
3. If the current behaviour is intended, document that `includeSchema: false` only removes the schema and guideline entries, so readers know the per-component schemas are still sent.

Happy to send a PR for whichever you prefer.

📄 Logs (Optional)

Activity

  1. added
    bug
    on Oct 13, 2026
  2. copilotkit-outpost-bot commented on Oct 13, 2026

    @copilotkit-outpost-bot

    ⚠️ This is an AI-generated response. We've escalated this to our engineering team — someone will follow up in this thread shortly.

    The behavior you've described is accurate based on the source code.

    buildCatalogContextValue in packages/a2ui-renderer/src/react-renderer/catalog-utils.ts (lines 74–82) always calls zodToJsonSchema for every custom component and embeds the result in the capabilities string. That entry is registered unconditionally. includeSchema in packages/react-core/src/v2/a2ui/A2UICatalogContext.tsx (lines 43–48) only gates the three additional entries (Component Schema, generation guidelines, design guidelines). So your measurements are correct: includeSchema: false still sends the full per-component JSON schemas via the capabilities entry, and includeSchema: true sends them a second time in the Component Schema entry.

    Whether this is intended or a gap in the current design is a call for engineering to make — I won't speculate on that. Your three proposed options are clearly articulated, and a PR offer is noted. The team will pick this up from here.


    🤖 Generated by CopilotKit AI Support · Documentation


    Was this helpful? React with 👍 or 👎

  3. BenTaylorDev commented on Oct 23, 2026

    @BenTaylorDev
    Contributor

    Thanks for the measurements. This is a gap, not intended behavior. Please go with option 1: when includeSchema is false, the capabilities entry lists the catalog IDs and component names only, without the JSON schemas.

    Please keep the following in the PR:

    • Keep the full schemas in the capabilities entry when includeSchema is true. That rules out option 2 for now. The LangGraph middleware (packages/sdk-js/src/langgraph/middleware.ts and sdk-python/copilotkit/copilotkit_lg_middleware.py) finds this entry by its "A2UI catalog" description and sends its whole value to the subagent as the composition guide.
    • Keep the - <catalogId> first-line format. The middleware reads the catalog ID from it.
    • Make the same change in the Vue and Angular copies (packages/vue/src/v2/components/a2ui/A2UICatalogContext.ts, packages/angular/src/lib/components/a2ui/a2ui-catalog-context.ts), so all three frameworks send the same context.
    • Update the includeSchema JSDoc and the provider reference to say what false still sends.

    One consequence to call out in the PR: the LangGraph middleware's A2UI subagent currently gets its custom-component schemas from this entry. With option 1, a host that sets includeSchema: false and uses the injected A2UI tool will give the subagent names only. That matches what false says it does, but please state it in the PR description and the includeSchema docs, and mention that a host can still pass a composition_guide through the middleware's guidelines.

  4. Laptopmini commented on Oct 23, 2026

    @Laptopmini
    ContributorAuthor

    Thanks @BenTaylorDev, option 1 it is.

    Heads-up: @Arpit-Khandelwal already opened #7810 for this. It does option 1 for React (catalog-utils.ts + A2UICatalogContext.tsx), with tests. true stays byte-for-byte the same and the - <catalogId> line is unchanged, so the first two points on your list are covered. It doesn't include the Vue and Angular copies, the includeSchema JSDoc and reference docs, or the LangGraph note.

    Those changes are in different files from #7810, so I can open a separate PR with them that doesn't conflict with it:

    • Vue (packages/vue/src/v2/components/a2ui/A2UICatalogContext.ts) and Angular (packages/angular/src/lib/components/a2ui/a2ui-catalog-context.ts): same name-only output when includeSchema is false, with tests;
    • includeSchema JSDoc on the React, Vue and Angular providers, plus the provider reference pages: what false still sends (catalog ID and component names);
    • the note that a LangGraph A2UI subagent gets names only with false, and that a host can pass a composition_guide through the middleware's guidelines.

    @Arpit-Khandelwal, if you'd rather add these to #7810 yourself, that works for me too. Just say so here and I'll leave it to you.

  5. Arpit-Khandelwal commented on Oct 23, 2026

    @Arpit-Khandelwal
    Contributor

    Thanks @BenTaylorDev, and thanks @Laptopmini for the heads-up. I'll add these to #7810 myself: the Vue and Angular copies with tests, the includeSchema JSDoc and provider reference docs, and the LangGraph subagent note (names only with false, composition_guide through the middleware's guidelines). I'll ping here when it's pushed.

  6. Arpit-Khandelwal commented on Oct 23, 2026

    @Arpit-Khandelwal
    Contributor

    @BenTaylorDev pushed to #7810:

    • Vue and Angular now match React: with includeSchema: false the entry lists the catalog ID and component names only. All three frameworks emit the identical string for the same catalog, and each package's tests assert that literal.
    • true (and the default) is byte-for-byte unchanged in all three, schemas included. The - <catalogId> first line and the "A2UI catalog" description are untouched.
    • Docs: the includeSchema JSDoc on the React, Vue and Angular providers and the provider reference pages now say what false still sends.
    • LangGraph note (PR description and docs): with false, the injected A2UI subagent gets component names only. A host can still pass a composition guide through the middleware's guidelines: a2uiParams.guidelines.compositionGuide in JS, a2ui_params["guidelines"]["composition_guide"] in Python.

    Vue (1186) and Angular (548) test suites pass, and the new tests fail without the source change.

  7. added 2 commits that reference this issue on Oct 27, 2026
    352cbd1
    a57920b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions