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/diegoc1005/hackAI --skill copilotkit-develop-diegoc1005
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: copilotkit-develop
Source: https://github.com/diegoc1005/hackAI/tree/main/.cursor/skills/copilotkit-develop
Command: npx skills add https://github.com/diegoc1005/hackAI --skill copilotkit-develop-diegoc1005

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @copilotkit/react, @copilotkit/runtime, @copilotkit/core, @ag-ui/client, @ag-ui/langgraph, zod, and includes references (resource) components.

What problem does it solve? Building AI-powered features with CopilotKit v2 requires knowing the correct hooks, components, and runtime setup across the React, Core, and Runtime layers, and this Skill provides the exact API patterns and workflow steps to wire them together correctly. ## Core Features & Use Cases - Chat UI Integration: Add CopilotChat, CopilotPopup, or CopilotSidebar components connected to an agent through CopilotKitProvider. - Agent Interaction Hooks: Register frontend tools with useFrontendTool, share app state with useAgentContext, handle interrupts with useInterrupt, and render tool calls with useRenderTool. - Runtime Setup: Configure CopilotRuntime with LangGraph agents and expose it via createCopilotEndpoint (Hono/Next.js) or createCopilotEndpointExpress. - Use Case: Add a sidebar chat to a Next.js app, register a setTheme frontend tool validated with Zod, and share the user's cart data as agent context so the AI can act on it. ## Quick Start Add a CopilotSidebar chat interface to my React app connected to a CopilotKit runtime endpoint at /api/copilotkit.

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 chat interface to a React app with CopilotKit?▼

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

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

Use the useFrontendTool hook with a name, description, Zod parameters schema, and a handler function. The agent can then invoke the tool in the browser, and the hook re-registers when the name, availability, or 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, calls createCopilotEndpoint with basePath /api/copilotkit, and exports GET and POST handlers from app.fetch.

Does CopilotKit v2 support Express servers?▼

Yes, createCopilotEndpointExpress returns an Express router with all CopilotKit routes mounted under your basePath. Mount it with app.use() after creating a CopilotRuntime 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 agent execution.

What is the difference between useFrontendTool and useHumanInTheLoop?▼

useFrontendTool executes a handler immediately when the agent calls it, while useHumanInTheLoop pauses agent execution and renders a UI with a respond callback until the user replies. Use the latter for approval workflows.