copilotkit-develop

Implements CopilotKit v2 chat interfaces, frontend tools, and runtime endpoints in React applications.

Updated May 9, 2026
One-click install
npx skills add https://github.com/23wj1a0541/L.E.N.S --skill copilotkit-develop-23wj1a0541
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: copilotkit-develop
Source: https://github.com/23wj1a0541/L.E.N.S/tree/main/.cursor/skills/copilotkit-develop
Command: npx skills add https://github.com/23wj1a0541/L.E.N.S --skill copilotkit-develop-23wj1a0541

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building AI-powered chat features with CopilotKit v2 requires knowing the correct hooks, components, and runtime setup across its React, Core, and Runtime packages. This Skill provides the exact API patterns, code examples, and reference documentation needed to wire up agents, tools, and chat UIs correctly on the first attempt. ## Core Features & Use Cases - Chat UI Setup: Add CopilotChat, CopilotPopup, or CopilotSidebar components connected to an agent via CopilotKitProvider. - Agent Interaction APIs: Register frontend tools with useFrontendTool, share app state with useAgentContext, handle interrupts with useInterrupt, and build approval flows with useHumanInTheLoop. - Runtime Configuration: Stand up CopilotRuntime endpoints in Next.js (Hono) or Express, with middleware, CORS, and Intelligence platform threads. - Use Case: You need the agent to render a custom chart in chat when it calls a tool. Use the useRenderTool pattern from this Skill to register a renderer keyed to the tool name with status-based UI. ## Quick Start Ask the agent to add a CopilotKit sidebar chat connected to your agent and register a frontend tool it can call.

Frequently Asked Questions about copilotkit-develop

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a CopilotKit chat interface to a React app?▼

Wrap your app in CopilotKitProvider with a runtimeUrl, then render CopilotChat, CopilotPopup, or CopilotSidebar with an agentId. The provider connects to the runtime endpoint and the chat component handles message submission and streaming.

How do I register a frontend tool the agent can call?▼

Use the useFrontendTool hook from @copilotkit/react with a name, description, a Zod parameters schema, and a handler function. The agent can then invoke the tool in the browser, and the hook re-registers when dependencies change.

How do I set up a CopilotKit runtime endpoint in Next.js?▼

Create a route at app/api/copilotkit/[[...path]]/route.ts that instantiates CopilotRuntime with your agents and passes it to createCopilotEndpoint with a basePath. Export app.fetch as the GET, POST, PATCH, and DELETE handlers.

Does CopilotKit v2 support Express servers?▼

Yes, createCopilotEndpointExpress returns an Express router with all CopilotKit routes mounted under the given basePath. Mount it with app.use() alongside a CopilotRuntime configured with your agents.

How do I handle agent interrupts for human approval?▼

Use useInterrupt with a render function that receives the interrupt event and a resolve callback. Render your confirmation UI and call resolve with the user's decision to resume the agent run.

Can I customize CopilotKit chat text and labels?▼

Yes, pass a labels prop to CopilotChat with partial overrides such as chatInputPlaceholder, welcomeMessageText, and modalHeaderTitle. All user-visible chat strings have defaults you can replace individually.