Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

copilotkit

БесплатноБез исполняемых скриптовНе проверен

CopilotKit is an open-source framework for putting AI agents inside React apps: a chat sidebar or popup, tools the agent can call in the browser or on the…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

CopilotKit — In-App AI Copilots for React

Overview

CopilotKit connects a React frontend to an AI agent. The frontend gets prebuilt chat components (CopilotSidebar, CopilotPopup, CopilotChat) and hooks that share app state with the agent and let it call functions in the browser. The backend is the Copilot Runtime, an endpoint in your own server that hosts either the built-in agent (it calls an LLM directly) or agents from LangGraph, Mastra, CrewAI, Google ADK and other frameworks over the AG-UI protocol.

The v1 SDK is deprecated. Everything current is imported from the /v2 subpaths — @copilotkit/react-core/v2 and @copilotkit/runtime/v2. Code that imports useCopilotAction, useCopilotReadable, OpenAIAdapter or anything from @copilotkit/react-ui is v1; see the migration table below.

Instructions

Install

npm install @copilotkit/react-core @copilotkit/runtime zod

The chat components and the stylesheet ship in @copilotkit/react-core/v2, so @copilotkit/react-ui is not needed. Put the provider key in .env (OPENAI_API_KEY, ANTHROPIC_API_KEY or GOOGLE_API_KEY). For a new project, npx copilotkit@latest create scaffolds a starter in its own directory; it does not modify an existing app.

Runtime endpoint

// app/api/copilotkit/...slug/route.ts
import { BuiltInAgent, CopilotRuntime, createCopilotRuntimeHandler, defineTool } from "@copilotkit/runtime/v2";
import { z } from "zod";

// Server tool: runs on the backend, can use secrets and the database
const findOverdueTasks = defineTool({
  name: "findOverdueTasks",
  description: "List tasks in a project that are past their due date",
  parameters: z.object({ projectId: z.string().describe("Project identifier") }),
  execute: async ({ projectId }) => {
    return { projectId, overdue: [{ title: "Renew TLS certificate", dueDate: "2026-09-28" }] };
  },
});

const agent = new BuiltInAgent({
  model: "openai:gpt-5.4-mini", // or "anthropic:claude-sonnet-4-6", "google:gemini-2.5-pro"
  prompt: "You help the team manage tasks in the project dashboard.",
  tools: [findOverdueTasks],
  maxSteps: 5, // allow tool call → answer chains; the default is a single step
});

const runtime = new CopilotRuntime({ agents: { default: agent } });
const handler = createCopilotRuntimeHandler({ runtime, basePath: "/api/copilotkit" });

export const GET = handler;
export const POST = handler;
export const PATCH = handler;
export const DELETE = handler;

The v2 handler serves several routes under the base path, which is why the folder is the catch-all ...slug. Express uses createCopilotExpressHandler from @copilotkit/runtime/v2/express.

Provider and chat UI

// app/providers.tsx
"use client";

import { CopilotKitProvider, CopilotSidebar } from "@copilotkit/react-core/v2";

export function Providers({ children }: { children: React.ReactNode }) {
  return (
    <CopilotKitProvider runtimeUrl="/api/copilotkit">
      {children}
      <CopilotSidebar defaultOpen={false} labels={{ modalHeaderTitle: "Project Assistant" }} />
    </CopilotKitProvider>
  );
}
// app/layout.tsx — a server component, so it renders the client Providers file
import { Providers } from "./providers";
import "@copilotkit/react-core/v2/styles.css";

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        <Providers>{children}</Providers>
      </body>
    </html>
  );
}

A relative runtimeUrl works because Next.js serves the app and the runtime from one origin. A client-only app (Vite) needs a standalone runtime server and an absolute URL.

Share app state and expose tools

// app/components/ProjectDashboard.tsx
"use client";

import { useState } from "react";
import { useAgentContext, useFrontendTool } from "@copilotkit/react-core/v2";
import { z } from "zod";

type Task = { id: string; title: string; status: "todo" | "doing" | "done"; assignee?: string };

export function ProjectDashboard({ projectName, initialTasks }: { projectName: string; initialTasks: Task[] }) {
  const [tasks, setTasks] = useState(initialTasks);

  // Shared with the agent; updates whenever `tasks` changes
  useAgentContext({
    description: "The project the user is viewing and its tasks",
    value: { projectName, tasks },
  });

  // A tool the agent can call; the handler runs in the browser
  useFrontendTool(
    {
      name: "createTask",
      description: "Create a new task in the current project",
      parameters: z.object({
        title: z.string().describe("Task title"),
        assignee: z.string().optional().describe("Who the task is assigned to"),
      }),
      handler: async ({ title, assignee }) => {
        setTasks((prev) => [...prev, { id: crypto.randomUUID(), title, status: "todo", assignee }]);
        return `Created task: ${title}`;
      },
    },
    [],
  );

  return (
    <ul>
      {tasks.map((t) => (
Полный SKILL.md на GitHub

Установить copilotkit в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл copilotkit?

CopilotKit is an open-source framework for putting AI agents inside React apps: a chat sidebar or popup, tools the agent can call in the browser or on the server, app state shared with the agent, and human-in-the-loop approvals. Use when a user asks to add an AI assistant or chat sidebar to a React or Next.js app, let an agent read app state or trigger UI actions, connect a LangGraph or other AG-UI agent to a frontend, or migrate CopilotKit v1 code (useCopilotAction, useCopilotReadable, OpenAIAdapter) to the v2 API.

Как установить скилл copilotkit?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл copilotkit запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить copilotkit с