@copilotkit/react-core 1.59.5 → 1.60.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/{copilotkit-CFfEVdV4.cjs → copilotkit-BTHcCAVQ.cjs} +93 -78
  2. package/dist/copilotkit-BTHcCAVQ.cjs.map +1 -0
  3. package/dist/{copilotkit-Ctvinul7.d.cts → copilotkit-C9ptuh-b.d.cts} +32 -70
  4. package/dist/copilotkit-C9ptuh-b.d.cts.map +1 -0
  5. package/dist/{copilotkit-DEGlMWM0.mjs → copilotkit-CV519nFv.mjs} +94 -79
  6. package/dist/copilotkit-CV519nFv.mjs.map +1 -0
  7. package/dist/{copilotkit-DqDT5RLa.d.mts → copilotkit-DvbI8G0d.d.mts} +32 -70
  8. package/dist/copilotkit-DvbI8G0d.d.mts.map +1 -0
  9. package/dist/index.cjs +11 -12
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +4 -8
  12. package/dist/index.d.cts.map +1 -1
  13. package/dist/index.d.mts +4 -8
  14. package/dist/index.d.mts.map +1 -1
  15. package/dist/index.mjs +11 -12
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/index.umd.js +47 -54
  18. package/dist/index.umd.js.map +1 -1
  19. package/dist/v2/index.cjs +1 -1
  20. package/dist/v2/index.css +1 -1
  21. package/dist/v2/index.d.cts +1 -1
  22. package/dist/v2/index.d.mts +1 -1
  23. package/dist/v2/index.mjs +1 -1
  24. package/dist/v2/index.umd.js +92 -77
  25. package/dist/v2/index.umd.js.map +1 -1
  26. package/package.json +8 -8
  27. package/skills/react-core/SKILL.md +5 -5
  28. package/skills/react-core/references/chat-components.md +20 -12
  29. package/skills/react-core/references/client-side-tools.md +1 -1
  30. package/skills/react-core/references/custom-message-renderers.md +8 -11
  31. package/skills/react-core/references/debug-mode.md +15 -15
  32. package/skills/react-core/references/provider-setup.md +45 -52
  33. package/skills/react-core/references/rendering-activity-messages.md +6 -12
  34. package/dist/copilotkit-CFfEVdV4.cjs.map +0 -1
  35. package/dist/copilotkit-Ctvinul7.d.cts.map +0 -1
  36. package/dist/copilotkit-DEGlMWM0.mjs.map +0 -1
  37. package/dist/copilotkit-DqDT5RLa.d.mts.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copilotkit/react-core",
3
- "version": "1.59.5",
3
+ "version": "1.60.1",
4
4
  "private": false,
5
5
  "keywords": [
6
6
  "ai",
@@ -58,8 +58,8 @@
58
58
  "access": "public"
59
59
  },
60
60
  "dependencies": {
61
- "@ag-ui/client": "0.0.53",
62
- "@ag-ui/core": "0.0.53",
61
+ "@ag-ui/client": "0.0.57",
62
+ "@ag-ui/core": "0.0.57",
63
63
  "@jetbrains/websandbox": "^1.1.3",
64
64
  "@lit-labs/react": "^2.0.2",
65
65
  "@radix-ui/react-dropdown-menu": "^2.1.15",
@@ -79,11 +79,11 @@
79
79
  "untruncate-json": "^0.0.1",
80
80
  "use-stick-to-bottom": "^1.1.1",
81
81
  "zod-to-json-schema": "^3.24.5",
82
- "@copilotkit/a2ui-renderer": "1.59.5",
83
- "@copilotkit/runtime-client-gql": "1.59.5",
84
- "@copilotkit/shared": "1.59.5",
85
- "@copilotkit/core": "1.59.5",
86
- "@copilotkit/web-inspector": "1.59.5"
82
+ "@copilotkit/a2ui-renderer": "1.60.1",
83
+ "@copilotkit/runtime-client-gql": "1.60.1",
84
+ "@copilotkit/shared": "1.60.1",
85
+ "@copilotkit/core": "1.60.1",
86
+ "@copilotkit/web-inspector": "1.60.1"
87
87
  },
88
88
  "devDependencies": {
89
89
  "@tailwindcss/cli": "^4.1.11",
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: react-core
3
3
  description: >
4
- @copilotkit/react-core — mount CopilotKitProvider in a Next.js App Router / React Router
5
- v7 / TanStack Start / SPA app, drop in CopilotChat/CopilotPopup/CopilotSidebar (v2 chat
4
+ @copilotkit/react-core — mount the CopilotKit provider (from @copilotkit/react-core/v2)
5
+ in a Next.js App Router / React Router v7 / TanStack Start / SPA app, drop in CopilotChat/CopilotPopup/CopilotSidebar (v2 chat
6
6
  components ship from react-core/v2 — NOT react-ui, which is CSS-only in v2), access and
7
7
  subscribe to agents with useAgent / useAgentContext / useCapabilities, switch between
8
8
  multiple agents, manage durable Intelligence threads with useThreads, register
@@ -48,7 +48,7 @@ sources:
48
48
  # CopilotKit React Core
49
49
 
50
50
  `@copilotkit/react-core` is the React frontend half of CopilotKit: it mounts a provider,
51
- speaks AG-UI over SSE to a runtime (or directly to CopilotKit Cloud in SPA mode), and
51
+ speaks AG-UI over SSE to a runtime (or directly to CopilotKit Intelligence in SPA mode), and
52
52
  exposes hooks for every interaction surface.
53
53
 
54
54
  This SKILL.md is the **index**. Read the reference under `references/` that matches
@@ -56,7 +56,7 @@ your task — do not try to absorb the whole package from this file.
56
56
 
57
57
  ## Mental model — three shells you compose
58
58
 
59
- 1. **Provider shell** — `CopilotKitProvider` at or near the root (inside `"use client"` for
59
+ 1. **Provider shell** — the `CopilotKit` provider (from `@copilotkit/react-core/v2`) at or near the root (inside `"use client"` for
60
60
  Next.js App Router). Carries `runtimeUrl` (or `publicLicenseKey` for SPA), `headers`,
61
61
  `credentials`, `properties`, `onError`, `debug`, `showDevConsole`.
62
62
  2. **Chat shell** — `CopilotChat` / `CopilotPopup` / `CopilotSidebar` or a composed
@@ -71,7 +71,7 @@ your task — do not try to absorb the whole package from this file.
71
71
 
72
72
  | Task | Reference |
73
73
  | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
74
- | Mount `CopilotKitProvider`, pick `runtimeUrl` vs `publicLicenseKey`, RSC boundary rules | `references/provider-setup.md` |
74
+ | Mount the `CopilotKit` provider, pick `runtimeUrl` vs `publicLicenseKey`, RSC boundary rules | `references/provider-setup.md` |
75
75
  | Drop in `CopilotChat` / `CopilotPopup` / `CopilotSidebar`, compose `CopilotChatView` with slot primitives | `references/chat-components.md` |
76
76
  | File / image attachments via `useAttachments` — drag-drop, click, paste, custom upload | `references/attachments.md` |
77
77
  | Client-side debug tooling — `showDevConsole`, `debug` prop, lazy-loaded web inspector | `references/debug-mode.md` |
@@ -1,7 +1,8 @@
1
1
  # CopilotKit Chat Components (React)
2
2
 
3
3
  This skill builds on `copilotkit/provider-setup`. Read it first — every
4
- chat component must be inside `CopilotKitProvider`.
4
+ chat component must be inside the `CopilotKit` provider (from
5
+ `@copilotkit/react-core/v2`).
5
6
 
6
7
  All chat components live on `@copilotkit/react-core/v2`. The legacy
7
8
  `@copilotkit/react-ui` package is v1-only; its `/v2` subpath is a CSS-only
@@ -30,7 +31,7 @@ suggestions internally via `useAgent`. You do not pass `messages` or
30
31
  ```tsx
31
32
  import { CopilotPopup } from "@copilotkit/react-core/v2";
32
33
 
33
- <CopilotPopup agentId="default" isModalDefaultOpen={false} />;
34
+ <CopilotPopup agentId="default" defaultOpen={false} />;
34
35
  ```
35
36
 
36
37
  ### Persistent sidebar
@@ -52,8 +53,6 @@ want to manage `messages`/`isRunning` yourself.
52
53
  ```tsx
53
54
  import {
54
55
  CopilotChatView,
55
- CopilotChatInput,
56
- CopilotChatMessageView,
57
56
  useAgent,
58
57
  useCopilotKit,
59
58
  } from "@copilotkit/react-core/v2";
@@ -66,7 +65,7 @@ export function HeadlessChat() {
66
65
  <CopilotChatView
67
66
  messages={agent.messages}
68
67
  isRunning={agent.isRunning}
69
- onSubmitInput={async (text) => {
68
+ onSubmitMessage={async (text) => {
70
69
  agent.addMessage({
71
70
  id: crypto.randomUUID(),
72
71
  role: "user",
@@ -75,8 +74,12 @@ export function HeadlessChat() {
75
74
  await copilotkit.runAgent({ agent });
76
75
  }}
77
76
  >
78
- <CopilotChatMessageView />
79
- <CopilotChatInput />
77
+ {({ messageView, input }) => (
78
+ <>
79
+ {messageView}
80
+ {input}
81
+ </>
82
+ )}
80
83
  </CopilotChatView>
81
84
  );
82
85
  }
@@ -89,7 +92,7 @@ export function HeadlessChat() {
89
92
  agentId="default"
90
93
  labels={{
91
94
  chatInputPlaceholder: "Ask about the data…",
92
- thinking: "Analyzing…",
95
+ welcomeMessageText: "What would you like to analyze?",
93
96
  }}
94
97
  />
95
98
  ```
@@ -157,14 +160,19 @@ Correct:
157
160
  // CopilotChat manages messages and isRunning internally.
158
161
  <CopilotChat agentId="default" />
159
162
 
160
- // For manual control, drop down to headless CopilotChatView:
163
+ // For manual control, drop down to headless CopilotChatView. Its `children`
164
+ // is a render prop that receives the bound slot elements:
161
165
  <CopilotChatView
162
166
  messages={myMessages}
163
167
  isRunning={busy}
164
- onSubmitInput={handleSubmit}
168
+ onSubmitMessage={handleSubmit}
165
169
  >
166
- <CopilotChatMessageView />
167
- <CopilotChatInput />
170
+ {({ messageView, input }) => (
171
+ <>
172
+ {messageView}
173
+ {input}
174
+ </>
175
+ )}
168
176
  </CopilotChatView>
169
177
  ```
170
178
 
@@ -269,7 +269,7 @@ Wrong:
269
269
 
270
270
  ```bash
271
271
  pnpm install @copilotkit/react-core
272
- # zod missing — CopilotKitProvider fails to load
272
+ # zod missing — the CopilotKit provider fails to load
273
273
  ```
274
274
 
275
275
  Correct:
@@ -6,7 +6,7 @@ internally by `<CopilotChat>` / `<CopilotChatView>`.
6
6
 
7
7
  Key rules:
8
8
 
9
- - Renderers are passed to `CopilotKitProvider` via `renderCustomMessages`.
9
+ - Renderers are passed to the `CopilotKit` provider via `renderCustomMessages`.
10
10
  - The hook returns `null` when called outside `CopilotChatConfigurationProvider`.
11
11
  - First non-null result wins — agent-scoped renderers evaluated first.
12
12
  - `stateSnapshot` is `undefined` before the run's `runId` resolves.
@@ -15,7 +15,7 @@ Key rules:
15
15
 
16
16
  ```tsx
17
17
  "use client";
18
- import { CopilotKitProvider } from "@copilotkit/react-core/v2";
18
+ import { CopilotKit } from "@copilotkit/react-core/v2";
19
19
  import type { ReactCustomMessageRenderer } from "@copilotkit/react-core/v2";
20
20
  import { useMemo } from "react";
21
21
  import { Button } from "@/components/ui/button";
@@ -41,12 +41,9 @@ const CopyButton: ReactCustomMessageRenderer = {
41
41
  export function Providers({ children }: { children: React.ReactNode }) {
42
42
  const renderers = useMemo(() => [CopyButton], []);
43
43
  return (
44
- <CopilotKitProvider
45
- runtimeUrl="/api/copilotkit"
46
- renderCustomMessages={renderers}
47
- >
44
+ <CopilotKit runtimeUrl="/api/copilotkit" renderCustomMessages={renderers}>
48
45
  {children}
49
- </CopilotKitProvider>
46
+ </CopilotKit>
50
47
  );
51
48
  }
52
49
  ```
@@ -129,9 +126,9 @@ Correct:
129
126
 
130
127
  ```tsx
131
128
  // Option A — register renderers via the provider prop so <CopilotChat> picks them up:
132
- <CopilotKitProvider renderCustomMessages={renderers}>
129
+ <CopilotKit renderCustomMessages={renderers}>
133
130
  <CopilotChat agentId="default" />
134
- </CopilotKitProvider>;
131
+ </CopilotKit>;
135
132
 
136
133
  // Option B — call the hook only inside a chat-configured subtree:
137
134
  import { CopilotChatConfigurationProvider } from "@copilotkit/react-core/v2";
@@ -207,7 +204,7 @@ Source: `packages/react-core/src/v2/hooks/use-render-custom-messages.tsx:73-95`
207
204
  Wrong:
208
205
 
209
206
  ```tsx
210
- <CopilotKitProvider
207
+ <CopilotKit
211
208
  renderCustomMessages={[CopyButton, DebugBefore]} // fresh array every render
212
209
  />
213
210
  ```
@@ -216,7 +213,7 @@ Correct:
216
213
 
217
214
  ```tsx
218
215
  const renderers = useMemo(() => [CopyButton, DebugBefore], []);
219
- <CopilotKitProvider renderCustomMessages={renderers} />;
216
+ <CopilotKit renderCustomMessages={renderers} />;
220
217
  ```
221
218
 
222
219
  The provider's stable-array-prop diff console-errors when a new array
@@ -1,7 +1,7 @@
1
1
  # CopilotKit Debug Mode (React)
2
2
 
3
3
  This skill builds on `copilotkit/provider-setup`. Both debug surfaces are
4
- props on `CopilotKitProvider`.
4
+ props on the `CopilotKit` provider (from `@copilotkit/react-core/v2`).
5
5
 
6
6
  Two independent knobs:
7
7
 
@@ -14,17 +14,17 @@ Both should be `'auto'` / off in production.
14
14
 
15
15
  ```tsx
16
16
  "use client";
17
- import { CopilotKitProvider } from "@copilotkit/react-core/v2";
17
+ import { CopilotKit } from "@copilotkit/react-core/v2";
18
18
 
19
19
  export function Providers({ children }: { children: React.ReactNode }) {
20
20
  return (
21
- <CopilotKitProvider
21
+ <CopilotKit
22
22
  runtimeUrl="/api/copilotkit"
23
23
  showDevConsole="auto"
24
24
  debug={{ events: true, lifecycle: true, verbose: false }}
25
25
  >
26
26
  {children}
27
- </CopilotKitProvider>
27
+ </CopilotKit>
28
28
  );
29
29
  }
30
30
  ```
@@ -41,7 +41,7 @@ leaking PII by default. For a bug repro, explicitly set `verbose: true` to
41
41
  dump full message/tool-call payloads.
42
42
 
43
43
  ```tsx
44
- <CopilotKitProvider
44
+ <CopilotKit
45
45
  runtimeUrl="/api/copilotkit"
46
46
  debug={{ events: true, lifecycle: true, verbose: true }}
47
47
  />
@@ -50,7 +50,7 @@ dump full message/tool-call payloads.
50
50
  ### Anchor the inspector on narrow viewports
51
51
 
52
52
  ```tsx
53
- <CopilotKitProvider
53
+ <CopilotKit
54
54
  runtimeUrl="/api/copilotkit"
55
55
  showDevConsole="auto"
56
56
  inspectorDefaultAnchor="bottom-left"
@@ -60,7 +60,7 @@ dump full message/tool-call payloads.
60
60
  ### Env-gate the inspector
61
61
 
62
62
  ```tsx
63
- <CopilotKitProvider
63
+ <CopilotKit
64
64
  runtimeUrl="/api/copilotkit"
65
65
  showDevConsole={process.env.NODE_ENV !== "production"}
66
66
  />
@@ -73,13 +73,13 @@ dump full message/tool-call payloads.
73
73
  Wrong:
74
74
 
75
75
  ```tsx
76
- <CopilotKitProvider runtimeUrl="/api/copilotkit" showDevConsole={true} />
76
+ <CopilotKit runtimeUrl="/api/copilotkit" showDevConsole={true} />
77
77
  ```
78
78
 
79
79
  Correct:
80
80
 
81
81
  ```tsx
82
- <CopilotKitProvider runtimeUrl="/api/copilotkit" showDevConsole="auto" />
82
+ <CopilotKit runtimeUrl="/api/copilotkit" showDevConsole="auto" />
83
83
  // "auto" enables only on localhost / 127.0.0.1
84
84
  ```
85
85
 
@@ -93,14 +93,14 @@ Source: `packages/react-core/src/v2/providers/CopilotKitProvider.tsx:301-321`
93
93
  Wrong:
94
94
 
95
95
  ```tsx
96
- <CopilotKitProvider debug={true} />
96
+ <CopilotKit debug={true} />
97
97
  // Then wondering why message contents aren't in the console
98
98
  ```
99
99
 
100
100
  Correct:
101
101
 
102
102
  ```tsx
103
- <CopilotKitProvider debug={{ events: true, lifecycle: true, verbose: true }} />
103
+ <CopilotKit debug={{ events: true, lifecycle: true, verbose: true }} />
104
104
  ```
105
105
 
106
106
  `debug: true` is shorthand for `{ events: true, lifecycle: true, verbose: false }`.
@@ -114,13 +114,13 @@ Source: `docs/snippets/shared/troubleshooting/debug-mode.mdx:85-93`
114
114
  Wrong:
115
115
 
116
116
  ```tsx
117
- <CopilotKitProvider debug={{ events: true, network: true, errors: true }} />
117
+ <CopilotKit debug={{ events: true, network: true, errors: true }} />
118
118
  ```
119
119
 
120
120
  Correct:
121
121
 
122
122
  ```tsx
123
- <CopilotKitProvider debug={{ events: true, lifecycle: true, verbose: true }} />
123
+ <CopilotKit debug={{ events: true, lifecycle: true, verbose: true }} />
124
124
  ```
125
125
 
126
126
  `DebugConfig` has exactly three fields: `events`, `lifecycle`, `verbose`.
@@ -134,13 +134,13 @@ Wrong:
134
134
 
135
135
  ```tsx
136
136
  // App embedded in a sandboxed iframe with showDevConsole on
137
- <CopilotKitProvider runtimeUrl="..." showDevConsole="auto" />
137
+ <CopilotKit runtimeUrl="..." showDevConsole="auto" />
138
138
  ```
139
139
 
140
140
  Correct:
141
141
 
142
142
  ```tsx
143
- <CopilotKitProvider
143
+ <CopilotKit
144
144
  runtimeUrl="..."
145
145
  showDevConsole={typeof window !== "undefined" && window.self === window.top}
146
146
  />
@@ -1,9 +1,12 @@
1
1
  # CopilotKit Provider Setup (React)
2
2
 
3
- Mount `CopilotKitProvider` once near the root of the React tree. Every
4
- CopilotKit hook (`useAgent`, `useFrontendTool`, `useRenderTool`, etc.) and
5
- every chat component (`CopilotChat`, `CopilotPopup`, `CopilotSidebar`) must
6
- be rendered inside this provider.
3
+ Mount the `CopilotKit` provider (from `@copilotkit/react-core/v2`) once
4
+ near the root of the React tree. Every CopilotKit hook (`useAgent`,
5
+ `useFrontendTool`, `useRenderTool`, etc.) and every chat component
6
+ (`CopilotChat`, `CopilotPopup`, `CopilotSidebar`) must be rendered inside
7
+ this provider.
8
+
9
+ > **Which provider component?** Always use `CopilotKit` imported from `@copilotkit/react-core/v2`. It is the compatibility bridge across v1 and v2 and a strict superset of the other provider APIs. Do **not** use `CopilotKit` from the package root (`@copilotkit/react-core`, legacy v1) or `CopilotKitProvider` from `/v2` (a subset of the functionality).
7
10
 
8
11
  All v2 imports use the `@copilotkit/react-core/v2` subpath. Imports from the
9
12
  package root are v1 and will not work with v2 hooks or components.
@@ -20,12 +23,12 @@ pattern is a dedicated client-only `providers.tsx`.
20
23
  // app/providers.tsx
21
24
  "use client";
22
25
 
23
- import { CopilotKitProvider } from "@copilotkit/react-core/v2";
26
+ import { CopilotKit } from "@copilotkit/react-core/v2";
24
27
  import "@copilotkit/react-core/v2/styles.css";
25
28
 
26
29
  export function Providers({ children }: { children: React.ReactNode }) {
27
30
  return (
28
- <CopilotKitProvider
31
+ <CopilotKit
29
32
  runtimeUrl="/api/copilotkit"
30
33
  credentials="include"
31
34
  onError={({ code, error, context }) => {
@@ -33,7 +36,7 @@ export function Providers({ children }: { children: React.ReactNode }) {
33
36
  }}
34
37
  >
35
38
  {children}
36
- </CopilotKitProvider>
39
+ </CopilotKit>
37
40
  );
38
41
  }
39
42
  ```
@@ -66,28 +69,24 @@ export default function RootLayout({
66
69
  ### Vite / React Router v7 / SPA
67
70
 
68
71
  ```tsx
69
- import { CopilotKitProvider } from "@copilotkit/react-core/v2";
72
+ import { CopilotKit } from "@copilotkit/react-core/v2";
70
73
  import "@copilotkit/react-core/v2/styles.css";
71
74
 
72
75
  export function App({ children }: { children: React.ReactNode }) {
73
- return (
74
- <CopilotKitProvider runtimeUrl="/api/copilotkit">
75
- {children}
76
- </CopilotKitProvider>
77
- );
76
+ return <CopilotKit runtimeUrl="/api/copilotkit">{children}</CopilotKit>;
78
77
  }
79
78
  ```
80
79
 
81
- ### SPA with CopilotKit Cloud (no self-hosted runtime)
80
+ ### SPA with CopilotKit Intelligence (no self-hosted runtime)
82
81
 
83
82
  ```tsx
84
- <CopilotKitProvider publicApiKey="ck_pub_..." />
83
+ <CopilotKit publicLicenseKey="ck_pub_..." />
85
84
  ```
86
85
 
87
- `publicApiKey` is the canonical prop for running CopilotKit from a pure
88
- client bundle. `publicLicenseKey` is an alias that resolves to the same
89
- value (`publicApiKey ?? publicLicenseKey`) — accept in old code, but
90
- always write `publicApiKey` in new code.
86
+ `publicLicenseKey` is the canonical prop for running CopilotKit from a
87
+ pure client bundle. `publicApiKey` is a deprecated alias that resolves to
88
+ the same value — accept it in old code, but always write
89
+ `publicLicenseKey` in new code.
91
90
 
92
91
  ## Core Patterns
93
92
 
@@ -117,7 +116,7 @@ UI from getting stuck in "connecting..." when the runtime URL is wrong or
117
116
  CORS is misconfigured.
118
117
 
119
118
  ```tsx
120
- <CopilotKitProvider
119
+ <CopilotKit
121
120
  runtimeUrl="/api/copilotkit"
122
121
  onError={({ code, error, context }) => {
123
122
  telemetry.capture({ code, message: error.message, context });
@@ -136,7 +135,7 @@ const properties = useMemo(
136
135
  [user.tenantId, user.locale],
137
136
  );
138
137
 
139
- <CopilotKitProvider runtimeUrl="/api/copilotkit" properties={properties} />;
138
+ <CopilotKit runtimeUrl="/api/copilotkit" properties={properties} />;
140
139
  ```
141
140
 
142
141
  ## Common Mistakes
@@ -147,12 +146,10 @@ Wrong:
147
146
 
148
147
  ```tsx
149
148
  // app/page.tsx (server component — no "use client")
150
- import { CopilotKitProvider } from "@copilotkit/react-core/v2";
149
+ import { CopilotKit } from "@copilotkit/react-core/v2";
151
150
 
152
151
  export default function Page() {
153
- return (
154
- <CopilotKitProvider runtimeUrl="/api/copilotkit">...</CopilotKitProvider>
155
- );
152
+ return <CopilotKit runtimeUrl="/api/copilotkit">...</CopilotKit>;
156
153
  }
157
154
  ```
158
155
 
@@ -161,14 +158,10 @@ Correct:
161
158
  ```tsx
162
159
  // app/providers.tsx
163
160
  "use client";
164
- import { CopilotKitProvider } from "@copilotkit/react-core/v2";
161
+ import { CopilotKit } from "@copilotkit/react-core/v2";
165
162
 
166
163
  export function Providers({ children }: { children: React.ReactNode }) {
167
- return (
168
- <CopilotKitProvider runtimeUrl="/api/copilotkit">
169
- {children}
170
- </CopilotKitProvider>
171
- );
164
+ return <CopilotKit runtimeUrl="/api/copilotkit">{children}</CopilotKit>;
172
165
  }
173
166
 
174
167
  // app/layout.tsx imports <Providers>.
@@ -185,13 +178,13 @@ Source: `packages/react-core/src/v2/index.ts:1`
185
178
  Wrong:
186
179
 
187
180
  ```tsx
188
- <CopilotKitProvider
181
+ <CopilotKit
189
182
  agents__unsafe_dev_only={{
190
183
  default: new BuiltInAgent({ apiKey: process.env.OPENAI_KEY! }),
191
184
  }}
192
185
  />
193
186
  // or the alias (same thing):
194
- <CopilotKitProvider
187
+ <CopilotKit
195
188
  selfManagedAgents={{ default: new BuiltInAgent({ apiKey: "..." }) }}
196
189
  />
197
190
  ```
@@ -200,10 +193,10 @@ Correct:
200
193
 
201
194
  ```tsx
202
195
  // Route through a runtime that keeps secrets server-side:
203
- <CopilotKitProvider runtimeUrl="/api/copilotkit" />
196
+ <CopilotKit runtimeUrl="/api/copilotkit" />
204
197
 
205
- // Or for a pure SPA, use CopilotKit Cloud:
206
- <CopilotKitProvider publicApiKey="ck_pub_..." />
198
+ // Or for a pure SPA, use CopilotKit Intelligence:
199
+ <CopilotKit publicLicenseKey="ck_pub_..." />
207
200
  ```
208
201
 
209
202
  Both props are aliases for the same dev-only mechanism and ship any embedded
@@ -216,7 +209,7 @@ Source: `packages/react-core/src/v2/providers/CopilotKitProvider.tsx:136-138,393
216
209
  Wrong:
217
210
 
218
211
  ```tsx
219
- <CopilotKitProvider
212
+ <CopilotKit
220
213
  runtimeUrl="/api/copilotkit"
221
214
  headers={{ Authorization: `Bearer ${token}` }}
222
215
  properties={{ tenantId: user.tenantId }}
@@ -232,7 +225,7 @@ const properties = useMemo(
232
225
  [user.tenantId],
233
226
  );
234
227
 
235
- <CopilotKitProvider
228
+ <CopilotKit
236
229
  runtimeUrl="/api/copilotkit"
237
230
  headers={headers}
238
231
  properties={properties}
@@ -251,13 +244,13 @@ Source: `packages/react-core/src/v2/providers/CopilotKitProvider.tsx:324-340,399
251
244
  Wrong:
252
245
 
253
246
  ```tsx
254
- <CopilotKitProvider runtimeUrl="/api/copilotkit" />
247
+ <CopilotKit runtimeUrl="/api/copilotkit" />
255
248
  ```
256
249
 
257
250
  Correct:
258
251
 
259
252
  ```tsx
260
- <CopilotKitProvider
253
+ <CopilotKit
261
254
  runtimeUrl="/api/copilotkit"
262
255
  onError={({ code, error, context }) => {
263
256
  telemetry.capture({ code, error, context });
@@ -272,26 +265,26 @@ forever and users never see the actual error.
272
265
 
273
266
  Source: `packages/react-core/src/v2/providers/CopilotKitProvider.tsx:638-660`
274
267
 
275
- ### HIGH — Writing `publicLicenseKey` in new code
268
+ ### HIGH — Writing `publicApiKey` in new code
276
269
 
277
270
  Wrong:
278
271
 
279
272
  ```tsx
280
- <CopilotKitProvider publicLicenseKey="ck_pub_..." />
273
+ <CopilotKit publicApiKey="ck_pub_..." />
281
274
  ```
282
275
 
283
276
  Correct:
284
277
 
285
278
  ```tsx
286
- <CopilotKitProvider publicApiKey="ck_pub_..." />
279
+ <CopilotKit publicLicenseKey="ck_pub_..." />
287
280
  ```
288
281
 
289
- `publicLicenseKey` still works as an alias, but `publicApiKey` is the
290
- canonical name in v2. The provider resolves
291
- `publicApiKey ?? publicLicenseKey`. Always write the canonical form in
282
+ `publicApiKey` still works as a deprecated alias, but `publicLicenseKey`
283
+ is the canonical name. The `CopilotKit` provider resolves
284
+ `publicLicenseKey || publicApiKey`. Always write the canonical form in
292
285
  new code.
293
286
 
294
- Source: `packages/react-core/src/v2/providers/CopilotKitProvider.tsx:122-128,391`
287
+ Source: `packages/react-core/src/components/copilot-provider/copilotkit.tsx:172`
295
288
 
296
289
  ### MEDIUM — Putting the provider below a layout that uses CopilotKit
297
290
 
@@ -301,7 +294,7 @@ Wrong:
301
294
  <html>
302
295
  <body>
303
296
  <Header>{/* Header uses useFrontendTool internally */}</Header>
304
- <CopilotKitProvider>{children}</CopilotKitProvider>
297
+ <CopilotKit>{children}</CopilotKit>
305
298
  </body>
306
299
  </html>
307
300
  ```
@@ -311,16 +304,16 @@ Correct:
311
304
  ```tsx
312
305
  <html>
313
306
  <body>
314
- <CopilotKitProvider>
307
+ <CopilotKit>
315
308
  <Header />
316
309
  {children}
317
- </CopilotKitProvider>
310
+ </CopilotKit>
318
311
  </body>
319
312
  </html>
320
313
  ```
321
314
 
322
315
  Any component that calls `useCopilotKit`, `useFrontendTool`, `useAgent`, or
323
- any other CopilotKit hook must be a descendant of `CopilotKitProvider`.
324
- Placing the provider beside or below a consumer throws at mount.
316
+ any other CopilotKit hook must be a descendant of the `CopilotKit`
317
+ provider. Placing the provider beside or below a consumer throws at mount.
325
318
 
326
319
  Source: `packages/react-core/src/v2/providers/CopilotKitProvider.tsx` (context)
@@ -2,7 +2,7 @@
2
2
 
3
3
  This skill builds on `copilotkit/provider-setup`. Activity-message
4
4
  renderers are registered as entries in the `renderActivityMessages` array
5
- prop on `CopilotKitProvider` and resolved at render time by
5
+ prop on the `CopilotKit` provider and resolved at render time by
6
6
  `useRenderActivityMessage` (consumed internally by chat components).
7
7
 
8
8
  User renderers are placed first in the array so they override the built-in
@@ -20,7 +20,7 @@ Resolver order:
20
20
 
21
21
  ```tsx
22
22
  "use client";
23
- import { CopilotKitProvider } from "@copilotkit/react-core/v2";
23
+ import { CopilotKit } from "@copilotkit/react-core/v2";
24
24
  import type { ReactActivityMessageRenderer } from "@copilotkit/react-core/v2";
25
25
  import { z } from "zod";
26
26
  import { useMemo } from "react";
@@ -46,12 +46,9 @@ const progressRenderer: ReactActivityMessageRenderer<{
46
46
  export function Providers({ children }: { children: React.ReactNode }) {
47
47
  const renderers = useMemo(() => [progressRenderer], []);
48
48
  return (
49
- <CopilotKitProvider
50
- runtimeUrl="/api/copilotkit"
51
- renderActivityMessages={renderers}
52
- >
49
+ <CopilotKit runtimeUrl="/api/copilotkit" renderActivityMessages={renderers}>
53
50
  {children}
54
- </CopilotKitProvider>
51
+ </CopilotKit>
55
52
  );
56
53
  }
57
54
  ```
@@ -184,7 +181,7 @@ Source: `packages/react-core/src/v2/hooks/use-render-activity-message.tsx`
184
181
  Wrong:
185
182
 
186
183
  ```tsx
187
- <CopilotKitProvider
184
+ <CopilotKit
188
185
  runtimeUrl="/api/copilotkit"
189
186
  renderActivityMessages={[progressRenderer, customMcpRenderer]}
190
187
  />
@@ -194,10 +191,7 @@ Correct:
194
191
 
195
192
  ```tsx
196
193
  const renderers = useMemo(() => [progressRenderer, customMcpRenderer], []);
197
- <CopilotKitProvider
198
- runtimeUrl="/api/copilotkit"
199
- renderActivityMessages={renderers}
200
- />;
194
+ <CopilotKit runtimeUrl="/api/copilotkit" renderActivityMessages={renderers} />;
201
195
  ```
202
196
 
203
197
  The provider uses `useStableArrayProp` and console-errors when a new array