/copilotkit:runtimefrom copilotkit
Sets up @copilotkit/runtime on a JS server: configure middleware, agent runner, built-in or external AI agents, durable threads, server tools, and voice transcription.
Ships in copilotkit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
@copilotkit/runtime is the server half of CopilotKit: it accepts AG-UI protocol
requests, dispatches them to an AbstractAgent (built-in or external), runs the
stream through an AgentRunner, and responds as Server-Sent Events.
This SKILL.md is the index. Read the reference under references/ that matches
your task — do not try to absorb the whole package from this file.
CopilotRuntimenew CopilotRuntime({
agents, // Record<string, AbstractAgent> — see wiring-external-agents or built-in-agent
runner, // AgentRunner (optional) — see agent-runners
intelligence, // CopilotKitIntelligence (optional) — see intelligence-mode (auto-wires runner)
mcpApps, // McpAppsConfig (optional) — see wiring-mcp-apps-middleware
a2ui, // A2UIConfig (optional) — see packages/a2ui-renderer skill
hooks, // { onRequest, onBeforeHandler } — see middleware
beforeRequestMiddleware,
afterRequestMiddleware, // legacy — see middleware
transcription, // TranscriptionService (optional) — see transcription
});
You then mount it:
import { createCopilotRuntimeHandler } from "@copilotkit/runtime/v2";
const handler = createCopilotRuntimeHandler({
runtime,
basePath: "/api/copilotkit",
});
export default { fetch: handler };
| Task | Reference |
|---|---|
| Mounting on any fetch-native server (Cloudflare Workers, Bun, Deno, Vercel Edge, Next.js App Router, React Router v7, TanStack Start) or delegating from Express/Node | references/setup-endpoint.md |
Auth / logging / rate-limit / request-scoped guards via hooks.onRequest / hooks.onBeforeHandler (preferred) or legacy beforeRequestMiddleware / afterRequestMiddleware | references/middleware.md |
Choosing between InMemoryAgentRunner, SqliteAgentRunner, or a custom subclass — including thread-locking semantics and the runner/Intelligence mutual exclusion | references/agent-runners.md (+ -in-memory.md, -sqlite.md, -custom.md for backend-specific detail) |
| Enabling durable threads + realtime websocket via CopilotKit Cloud (Intelligence is Cloud-only, not self-hostable) | references/intelligence-mode.md |
Voice transcription — implementing a TranscriptionService subclass for the /transcribe endpoint | references/transcription.md |
Instantiating BuiltInAgent — Simple Mode (classic) or Factory Mode with TanStack AI (preferred AG-UI-compliant default), AI SDK, or custom factory | references/built-in-agent.md (+ -factory-modes.md, -helper-utilities.md, -model-identifiers.md) |
Defining server-side tools via defineTool for BuiltInAgent.config.tools (Simple Mode only) | references/server-side-tools.md |
Wiring an external agent framework into CopilotRuntime({ agents }) | references/wiring-external-agents.md (index) + per-framework refs (wiring-mastra.md, wiring-langgraph.md, wiring-crewai-crews.md, wiring-crewai-flows.md, wiring-pydantic-ai.md, wiring-adk.md, wiring-llamaindex.md, wiring-agno.md, wiring-aws-strands.md, wiring-ms-agent-framework.md, wiring-ag2.md, wiring-a2a.md) |
| Wiring MCP Apps (runtime-level middleware, not an agent) | references/wiring-mcp-apps-middleware.md |
createCopilotRuntimeHandler is the canonical primitive. createCopilotExpressHandler / createCopilotHonoHandler exist but are avoid at all costs — delegate from Express/Hono routes to the fetch primitive instead.publicLicenseKey is the canonical provider-side field. publicApiKey is a deprecated alias — expect to see it in legacy code, emit the canonical name in new code.IntelligenceAgentRunner. Passing both runner and intelligence to CopilotRuntime is rejected at construction.api.cloud.copilotkit.ai) and is not self-hostable.hooks.onRequest runs before beforeRequestMiddleware (hook-based middleware wins for Response short-circuits). beforeRequestMiddleware runs after hooks.onRequest (see fetch-handler.ts:136-147).identifyUser (Intelligence) does not forward thrown Response objects — convert to 500. Gate auth rejection in hooks.onRequest, which does forward Responses.agents__unsafe_dev_only and selfManagedAgents are dev-only aliases of each other; do not reach for them in production. Either signals that the SPA is in dev mode.setup-endpoint — the primitive.built-in-agent or pick one from wiring-external-agents — the agent.agent-runners — production persistence choice.middleware, intelligence-mode, server-side-tools, transcription.references/agent-runners-custom.md (opens in a new tab)references/agent-runners-in-memory.md (opens in a new tab)references/agent-runners-sqlite.md (opens in a new tab)references/agent-runners.md (opens in a new tab)references/built-in-agent-factory-modes.md (opens in a new tab)references/built-in-agent-helper-utilities.md (opens in a new tab)references/built-in-agent-model-identifiers.md (opens in a new tab)references/built-in-agent.md (opens in a new tab)references/intelligence-mode.md (opens in a new tab)references/middleware.md (opens in a new tab)references/server-side-tools.md (opens in a new tab)references/setup-endpoint.md (opens in a new tab)references/transcription.md (opens in a new tab)references/wiring-a2a.md (opens in a new tab)references/wiring-adk.md (opens in a new tab)references/wiring-ag2.md (opens in a new tab)references/wiring-agno.md (opens in a new tab)references/wiring-aws-strands.md (opens in a new tab)references/wiring-crewai-crews.md (opens in a new tab)references/wiring-crewai-flows.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
copilotkit, runtime, agent-runner, middleware, ai-agents, voice-transcription
npx claudepluginhub anmol-baranwal/copilotkit --plugin copilotkit11 skills in this plugin
/a2ui-rendererRender A2UI (Agent-to-UI declarative surfaces) in CopilotKit v2. Enable the runtime via CopilotRuntime({ a2ui: {...} }), then enable the provider via <CopilotKitProvider a2ui={{ theme }}>. Auto-activates via /info — do NOT manually pass renderActivityMessages. createA2UIMessageRenderer ships from @copilotkit/react-core/v2; low-level primitives (A2UIProvider, A2UIRenderer, createCatalog) ship from @copilotkit/a2ui-renderer. Covers theme customization, createSurface dedup, action-bridge try/finally cleanup. Load when an agent emits A2UI operations (createSurface / updateComponents / updateDataModel), when wiring a2ui on CopilotRuntime, or when styling A2UI surfaces.
/copilotkit-aguiUse 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 human-in-the-loop flows./copilotkit-contributeUse when contributing to the CopilotKit open-source project — forking, cloning, setting up the monorepo, creating branches, running tests, and submitting pull requests against CopilotKit/CopilotKit.