/copilotkit-upgrade
Use when migrating a CopilotKit v1 application to v2 -- updating package imports, replacing deprecated hooks and components, switching from GraphQL runtime to AG-UI protocol runtime, and resolving breaking API changes.
$ npx -y skills add CopilotKit/CopilotKit --skill copilotkit-upgrade --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/copilotkit-upgrade
Context preview
The summary Claude sees to decide when to auto-load this skill.
Use when migrating a CopilotKit v1 application to v2 -- updating package imports, replacing deprecated hooks and components, switching from GraphQL runtime to AG-UI protocol runtime, and resolving breaking API changes.
SKILL.md
copilotkit-upgrade.SKILL.mdname: copilotkit-upgrade
description: "Use when migrating a CopilotKit v1 application to v2 -- updating package imports, replacing deprecated hooks and components, switching from GraphQL runtime to AG-UI protocol runtime, and resolving breaking API changes."
version: 1.0.1
CopilotKit v1 to v2 Migration Skill
Live Documentation (MCP)
This plugin includes an MCP server (`copilotkit-docs`) that provides `search-docs` and `search-code` tools for querying live CopilotKit documentation and source code. Useful for looking up current v2 API signatures during migration.
- **Claude Code:** Auto-configured by the plugin's `.mcp.json` -- no setup needed.
- **Codex:** Requires manual configuration. See the [copilotkit-debug skill](../copilotkit-debug/SKILL.md#mcp-setup) for setup instructions.
Overview
CopilotKit v2 is a ground-up rewrite built on the AG-UI protocol (`@ag-ui/client` / `@ag-ui/core`). Users continue to install and import `@copilotkit/*` packages -- the v2 changes are exposed through the same package names (under their `/v2` subpaths) with updated APIs (new hook names, component names, runtime configuration). The underlying `@ag-ui/*` packages are an internal implementation detail re-exported through `@copilotkit/react-core/v2`, so users never need to install them directly.
Migration Workflow
1. Audit Current Usage
Scan the codebase for all v1 imports and API usage:
@copilotkit/react-core -> hooks, CopilotKit provider, types
@copilotkit/react-ui -> CopilotChat, CopilotPopup, CopilotSidebar
@copilotkit/react-textarea -> CopilotTextarea (removed in v2)
@copilotkit/runtime -> CopilotRuntime, service adapters, framework integrations
@copilotkit/runtime-client-gql -> GraphQL client, message types
@copilotkit/shared -> utility types, constants
@copilotkit/sdk-js -> LangGraph/LangChain SDK
2. Identify Deprecated APIs
Key hooks and components to find and replace:
| v1 API | v2 Replacement | | ---------------------------------- | ---------------------------------------------------------- | | `useCopilotAction` | `useFrontendTool` | | `useCopilotReadable` | `useAgentContext` | | `useCopilotChat` | `useAgent` | | `useCoAgent` | `useAgent` | | `useCoAgentStateRender` | `useRenderTool` / `useRenderActivityMessage` | | `useCopilotContext` | `useCopilotKit` (from `@copilotkit/react-core/v2/context`) | | `useLangGraphInterrupt` | `useInterrupt` | | `useCopilotChatSuggestions` | `useConfigureSuggestions` + `useSuggestions` | | `useCopilotAdditionalInstructions` | `useAgentContext` | | `useMakeCopilotDocumentReadable` | `useAgentContext` | | `CopilotKit` (root import) | `CopilotKit` (from `@copilotkit/react-core/v2`) | | `CopilotTextarea` | Removed -- use standard textarea + `useFrontendTool` |
3. Map to v2 Equivalents
Refer to `references/v1-to-v2-migration.md` for detailed before/after code examples.
4. Update Package Dependencies
The `@copilotkit/*` package names stay the same. v2 does **not** introduce new package names -- the v2 APIs ship from the **`/v2` subpath** of the existing packages (`@copilotkit/react-core/v2`, `@copilotkit/runtime/v2`). There is no `@copilotkit/react` or `@copilotkit/agent` package. Update to the latest v2 versions:
@copilotkit/react-core -> @copilotkit/react-core (v2 symbols under the /v2 subpath)
@copilotkit/react-ui -> chat components move to @copilotkit/react-core/v2; react-ui contributes only styles in v2
@copilotkit/react-textarea -> removed (no v2 equivalent)
@copilotkit/runtime -> @copilotkit/runtime (v2 symbols under the /v2 subpath)
@copilotkit/runtime-client-gql -> removed (replaced by AG-UI protocol; @ag-ui/client types are re-exported from @copilotkit/react-core/v2)
@copilotkit/shared -> @copilotkit/shared (same package)
@copilotkit/sdk-js -> removed (BuiltInAgent now ships from @copilotkit/runtime/v2)
5. Update Runtime Configuration
The v1 `CopilotRuntime` accepted service adapters (OpenAI, Anthropic, LangChain, etc.) and endpoint definitions. The v2 `CopilotRuntime` accepts AG-UI `AbstractAgent` instances directly.
**v1 pattern** (service adapter + endpoints):
import { CopilotRuntime, OpenAIAdapter } from "@copilotkit/runtime";
const runtime = new CopilotRuntime({ actions: [...] });
// used with framework handlers like copilotRuntimeNextJSAppRouterEndpoint() (Next.js), etc.**v2 pattern** (agents + Hono endpoint):
import {
CopilotRuntime,
BuiltInAgent,
createCopilotHonoHandler,
} from "@copilotkit/runtime/v2";
const runtime = new CopilotRuntime({
agents: { myAgent: new BuiltInAgent({ model: "openai/gpt-4o" }) },
});
const app = createCopilotHonoHandler({ runtime, basePath: "/api/copilotkit" });> Use `createCopilotHonoHandler` (from `@copilotkit/runtime/v2`) as the canonical Hono endpoint factory. `createCopilotEndpoint` is a **deprecated** alias for it -- avoid it in new code. For Express, use `createCopilotExpressHandler` from `@copilotkit/runtime/v2/express` (`createCopilotEndpointExpress` is its deprecated alias).
6. Update Provider
The provider component keeps the name `CopilotKit` -- only the import path changes. The package root (`@copilotkit/react-core`) is the legacy v1 provider; the `/v2` subpath is the migration target.
**v1 (root import):**
import { CopilotKit } from "@copilotkit/react-corRead more
name: copilotkit-upgrade description: "Use when migrating a CopilotKit v1 application to v2 -- updating package imports, replacing deprecated hooks and components, switching from GraphQL runtime to AG-UI protocol runtime, and resolving breaking API changes." version: 1.0.1
CopilotKit v1 to v2 Migration Skill
Live Documentation (MCP)
This plugin includes an MCP server (`copilotkit-docs`) that provides `search-docs` and `search-code` tools for querying live CopilotKit documentation and source code. Useful for looking up current v2 API signatures during migration.
- **Claude Code:** Auto-configured by the plugin's `.mcp.json` -- no setup needed.
- **Codex:** Requires manual configuration. See the [copilotkit-debug skill](../copilotkit-debug/SKILL.md#mcp-setup) for setup instructions.
Overview
CopilotKit v2 is a ground-up rewrite built on the AG-UI protocol (`@ag-ui/client` / `@ag-ui/core`). Users continue to install and import `@copilotkit/*` packages -- the v2 changes are exposed through the same package names (under their `/v2` subpaths) with updated APIs (new hook names, component names, runtime configuration). The underlying `@ag-ui/*` packages are an internal implementation detail re-exported through `@copilotkit/react-core/v2`, so users never need to install them directly.
Migration Workflow
1. Audit Current Usage
Scan the codebase for all v1 imports and API usage:
@copilotkit/react-core -> hooks, CopilotKit provider, types @copilotkit/react-ui -> CopilotChat, CopilotPopup, CopilotSidebar @copilotkit/react-textarea -> CopilotTextarea (removed in v2) @copilotkit/runtime -> CopilotRuntime, service adapters, framework integrations @copilotkit/runtime-client-gql -> GraphQL client, message types @copilotkit/shared -> utility types, constants @copilotkit/sdk-js -> LangGraph/LangChain SDK
2. Identify Deprecated APIs
Key hooks and components to find and replace:
| v1 API | v2 Replacement | | ---------------------------------- | ---------------------------------------------------------- | | `useCopilotAction` | `useFrontendTool` | | `useCopilotReadable` | `useAgentContext` | | `useCopilotChat` | `useAgent` | | `useCoAgent` | `useAgent` | | `useCoAgentStateRender` | `useRenderTool` / `useRenderActivityMessage` | | `useCopilotContext` | `useCopilotKit` (from `@copilotkit/react-core/v2/context`) | | `useLangGraphInterrupt` | `useInterrupt` | | `useCopilotChatSuggestions` | `useConfigureSuggestions` + `useSuggestions` | | `useCopilotAdditionalInstructions` | `useAgentContext` | | `useMakeCopilotDocumentReadable` | `useAgentContext` | | `CopilotKit` (root import) | `CopilotKit` (from `@copilotkit/react-core/v2`) | | `CopilotTextarea` | Removed -- use standard textarea + `useFrontendTool` |
3. Map to v2 Equivalents
Refer to `references/v1-to-v2-migration.md` for detailed before/after code examples.
4. Update Package Dependencies
The `@copilotkit/*` package names stay the same. v2 does **not** introduce new package names -- the v2 APIs ship from the **`/v2` subpath** of the existing packages (`@copilotkit/react-core/v2`, `@copilotkit/runtime/v2`). There is no `@copilotkit/react` or `@copilotkit/agent` package. Update to the latest v2 versions:
@copilotkit/react-core -> @copilotkit/react-core (v2 symbols under the /v2 subpath) @copilotkit/react-ui -> chat components move to @copilotkit/react-core/v2; react-ui contributes only styles in v2 @copilotkit/react-textarea -> removed (no v2 equivalent) @copilotkit/runtime -> @copilotkit/runtime (v2 symbols under the /v2 subpath) @copilotkit/runtime-client-gql -> removed (replaced by AG-UI protocol; @ag-ui/client types are re-exported from @copilotkit/react-core/v2) @copilotkit/shared -> @copilotkit/shared (same package) @copilotkit/sdk-js -> removed (BuiltInAgent now ships from @copilotkit/runtime/v2)
5. Update Runtime Configuration
The v1 `CopilotRuntime` accepted service adapters (OpenAI, Anthropic, LangChain, etc.) and endpoint definitions. The v2 `CopilotRuntime` accepts AG-UI `AbstractAgent` instances directly.
**v1 pattern** (service adapter + endpoints):
import { CopilotRuntime, OpenAIAdapter } from "@copilotkit/runtime";
const runtime = new CopilotRuntime({ actions: [...] });
// used with framework handlers like copilotRuntimeNextJSAppRouterEndpoint() (Next.js), etc.**v2 pattern** (agents + Hono endpoint):
import {
CopilotRuntime,
BuiltInAgent,
createCopilotHonoHandler,
} from "@copilotkit/runtime/v2";
const runtime = new CopilotRuntime({
agents: { myAgent: new BuiltInAgent({ model: "openai/gpt-4o" }) },
});
const app = createCopilotHonoHandler({ runtime, basePath: "/api/copilotkit" });> Use `createCopilotHonoHandler` (from `@copilotkit/runtime/v2`) as the canonical Hono endpoint factory. `createCopilotEndpoint` is a **deprecated** alias for it -- avoid it in new code. For Express, use `createCopilotExpressHandler` from `@copilotkit/runtime/v2/express` (`createCopilotEndpointExpress` is its deprecated alias).
6. Update Provider
The provider component keeps the name `CopilotKit` -- only the import path changes. The package root (`@copilotkit/react-core`) is the legacy v1 provider; the `/v2` subpath is the migration target.
**v1 (root import):**
import { CopilotKit } from "@copilotkit/react-corDocs · Examples · Enterprise Intelligence Platform · Build agent-native applications — on any framework, on any surface. Generative UI, shared state, and human-in-the-loop workflows for React, Angular, Vue, React Native — and beyond the browser.
Repo: CopilotKit/CopilotKit
Other skills on copilotkit.
- /a2ui-renderer
Render A2UI (Agent-to-UI declarative surfaces) in CopilotKit v2. Enable the runtime via CopilotRuntime({ a2ui: {...} }), then enable the provider via <CopilotKit a2ui={{ theme }}>. Auto-activates via /info — do NOT manually pass renderActivityMessages. createA2UIMessageRenderer
Open skill - /react-core
@copilotkit/react-core — mount the CopilotKit provider (from @copilotkit/react-core/v2) in a Next.js App Router / React Router v7 / TanStack Start / SPA app, drop in CopilotChat/CopilotPopup/CopilotSidebar (v2 chat components ship from react-core/v2 — NOT react-ui, which is
Open skill - /runtime
@copilotkit/runtime — mount a fetch-native CopilotRuntime on any JS server, wire middleware, pick an AgentRunner, instantiate BuiltInAgent (Factory Mode with TanStack AI is the preferred default) or plug in any of 12 external agent frameworks (Mastra, LangGraph, CrewAI
Open skill - /a2ui-renderer
Render A2UI (Agent-to-UI declarative surfaces) in CopilotKit v2. Enable the runtime via CopilotRuntime({ a2ui: {...} }), then enable the provider via <CopilotKit a2ui={{ theme }}>. Auto-activates via /info — do NOT manually pass renderActivityMessages. createA2UIMessageRenderer
Open skill - /channels-setup
Use when a developer wants to build their first CopilotKit Channels agent and get it answering in Slack or Microsoft Teams — "set up a channel", "connect my agent to Slack", "get my agent into Teams", or starting from nothing and wanting a working channel end to end. Covers the
Open skill - /copilotkit-agui
Use when building custom agent backends, implementing the AG-UI protocol, debugging streaming issues, or understanding how agents communicate with frontends. Covers event types, SSE transport, AbstractAgent/HttpAgent patterns, state synchronization, tool calls, and
Open skill

