Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计通过

copilotkit-setupcopilotkit 设置

Agent Skill

copilotkit-setup 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

3,584

周安装

145

GitHub Stars

22

下载量

1,125
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:copilotkit-setup(copilotkit 设置)
来源仓库:https://github.com/copilotkit/skills
仓库路径:skills/copilotkit-setup
安装命令:
npx skills add https://github.com/copilotkit/skills --skill copilotkit-setup
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/copilotkit/skills --skill copilotkit-setup

简介

提供 CopilotKit 环境搭建指导,涵盖 Node.js 版本、API 密钥与前端依赖配置。

  • 支持通过 MCP 服务器查询实时文档,辅助完成从 v1 到 v2 的迁移准备。
  • 调用时按提示验证环境与凭证,确保 fetch 全局可用与 React 基础就绪。
  • 安装前请核对密钥命名规范(如 OPENAI_API_KEY),避免因权限不足导致初始化失败。
  • copilotkit-setup 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

CopilotKit Setup

Prerequisites

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.

  • Claude Code: Auto-configured by the plugin's .mcp.json -- no setup needed.
  • Codex: Requires manual configuration. See the copilotkit-debug skill for setup instructions.

Environment

Before starting setup, verify:

  1. Node.js >= 18 (required for fetch globals used by the runtime)
  2. An AI provider API key (one of: OPENAI_API_KEY, ANTHROPIC_API_KEY, GOOGLE_API_KEY)
  3. A React-based frontend (Next.js App Router, Next.js Pages Router, Vite + React, or Angular)
  4. A backend capable of running the runtime (same Next.js app via API routes, or a standalone Express/Hono server)

Framework Detection

Before generating any code, detect the project's framework by checking files in the project root. See references/framework-detection.md for the full decision tree.

Quick summary:

Signal FileFramework
next.config.{js,ts,mjs} + app/ directoryNext.js App Router
next.config.{js,ts,mjs} + pages/ directoryNext.js Pages Router
angular.jsonAngular
vite.config.{js,ts} + React deps in package.jsonVite + React

Setup Workflow

Step 1: Install packages

All packages use the @copilotkit namespace.

Frontend (React) packages:

npm install @copilotkit/react @copilotkit/core

Runtime packages (backend):

npm install @copilotkit/runtime @copilotkit/agent

If the runtime runs in the same Next.js app as the frontend, install all four packages together.

For standalone Express backends, also install Express adapter dependencies:

npm install express cors
npm install -D @types/express @types/cors

Step 2: Configure the runtime

The runtime is the server-side component that manages agent execution. See references/runtime-architecture.md for details.

There are two endpoint styles:

  1. Multi-route (Hono) -- uses createCopilotEndpoint. Requires a catch-all route ([[...slug]] in Next.js). Each operation (run, connect, stop, info, transcribe, threads) gets its own HTTP path.
  2. Single-route (Hono or Express) -- uses createCopilotEndpointSingleRoute or createCopilotEndpointSingleRouteExpress. All operations go through a single POST endpoint with method multiplexing.

Next.js App Router (recommended: multi-route with Hono)

Create src/app/api/copilotkit/[[...slug]]/route.ts:

import {
  CopilotRuntime,
  createCopilotEndpoint,
  InMemoryAgentRunner,
} from "@copilotkit/runtime";
import { BuiltInAgent } from "@copilotkit/agent";
import { handle } from "hono/vercel";

const agent = new BuiltInAgent({
  model: "openai/gpt-4o",
  prompt: "You are a helpful AI assistant.",
});

const runtime = new CopilotRuntime({
  agents: {
    default: agent,
  },
  runner: new InMemoryAgentRunner(),
});

const app = createCopilotEndpoint({
  runtime,
  basePath: "/api/copilotkit",
});

export const GET = handle(app);
export const POST = handle(app);

This requires hono as a dependency:

npm install hono

Next.js App Router (alternative: single-route)

Create src/app/api/copilotkit/route.ts:

import {
  CopilotRuntime,
  createCopilotEndpointSingleRoute,
  InMemoryAgentRunner,
} from "@copilotkit/runtime";
import { BuiltInAgent } from "@copilotkit/agent";
import { handle } from "hono/vercel";

const agent = new BuiltInAgent({
  model: "openai/gpt-4o",
  prompt: "You are a helpful AI assistant.",
});

const runtime = new CopilotRuntime({
  agents: {
    default: agent,
  },
  runner: new InMemoryAgentRunner(),
});

const app = createCopilotEndpointSingleRoute({
  runtime,
  basePath: "/api/copilotkit",
});

export const POST = handle(app);

When using single-route, the frontend must set useSingleEndpoint on the provider (see Step 3).

Standalone Express Server

Create src/index.ts:

import express from "express";
import { CopilotRuntime } from "@copilotkit/runtime";
import { createCopilotEndpointSingleRouteExpress } from "@copilotkit/runtime/express";
import { BuiltInAgent, defineTool } from "@copilotkit/agent";
import { z } from "zod";

const agent = new BuiltInAgent({
  model: "openai/gpt-4o",
});

const runtime = new CopilotRuntime({
  agents: {
    default: agent,
  },
});

const app = express();

app.use(
  "/api/copilotkit",
  createCopilotEndpointSingleRouteExpress({
    runtime,
    basePath: "/",
  }),
);

const port = Number(process.env.PORT ?? 4000);
app.listen(port, () => {
  console.log(`CopilotKit runtime listening at http://localhost:${port}/api/copilotkit`);
});

For multi-route Express, use createCopilotEndpointExpress instead (imported from @copilotkit/runtime/express).

Standalone Hono Server (non-Vercel)

import { CopilotRuntime, createCopilotEndpoint } from "@copilotkit/runtime";
import { BuiltInAgent } from "@copilotkit/agent";
import { serve } from "@hono/node-server";

const runtime = new CopilotRuntime({
  agents: {
    default: new BuiltInAgent({ model: "openai/gpt-4o" }),
  },
});

const app = createCopilotEndpoint({
  runtime,
  basePath: "/api/copilotkit",
});

serve({ fetch: app.fetch, port: 8787 });

Requires @hono/node-server:

npm install hono @hono/node-server

Step 3: Set up the frontend provider

Wrap your application with CopilotKitProvider from @copilotkit/react.

Important: Import the stylesheet in your root layout:

import "@copilotkit/react/styles.css";

Next.js App Router

In src/app/page.tsx (or a client component):

"use client";

import { CopilotKitProvider, CopilotChat } from "@copilotkit/react";

export default function Home() {
  return (
    <CopilotKitProvider runtimeUrl="/api/copilotkit">
      <div style={{ height: "100vh" }}>
        <CopilotChat />
      </div>
    </CopilotKitProvider>
  );
}

Connecting to an external runtime

When the runtime runs on a separate server (e.g., Express on port 4000):

<CopilotKitProvider
  runtimeUrl="http://localhost:4000/api/copilotkit"
  useSingleEndpoint
>
  {children}
</CopilotKitProvider>

Set useSingleEndpoint when the backend uses single-route endpoints (createCopilotEndpointSingleRoute or createCopilotEndpointSingleRouteExpress).

CopilotKitProvider key props

PropTypeDescription
runtimeUrlstringURL of the CopilotKit runtime endpoint
useSingleEndpointbooleanSet to true when using single-route endpoints
headersRecord<string, string>Custom headers sent with every request
credentialsRequestCredentialsFetch credentials mode (e.g., "include" for cookies)
publicApiKeystringCopilot Cloud public API key (if using hosted runtime)
showDevConsole`boolean \"auto"`Show the dev inspector ("auto" = development only)
renderToolCallsReactToolCallRenderer[]Custom renderers for tool call UI
frontendToolsReactFrontendTool[]Frontend-defined tools (declarative alternative to useFrontendTool)
onError(event) => voidGlobal error handler

Step 4: Add a chat UI component

CopilotKit provides three pre-built chat layouts:

ComponentUsage
CopilotChatInline chat, fills its container
CopilotSidebarCollapsible sidebar panel
CopilotPopupFloating popup widget

Example with sidebar:

<CopilotKitProvider runtimeUrl="/api/copilotkit" showDevConsole="auto">
  <YourApp />
  <CopilotSidebar
    defaultOpen
    width="420px"
    labels={{
      modalHeaderTitle: "AI Assistant",
      chatInputPlaceholder: "Ask me anything...",
    }}
  />
</CopilotKitProvider>

Step 5: Set environment variables

Create a .env.local (Next.js) or .env file:

OPENAI_API_KEY=sk-...

The BuiltInAgent automatically resolves API keys from environment variables based on the model prefix:

  • openai/* models read OPENAI_API_KEY
  • anthropic/* models read ANTHROPIC_API_KEY
  • google/* models read GOOGLE_API_KEY

You can also pass apiKey directly to BuiltInAgent if needed.

Step 6: Connect to CopilotCloud (telemetry)

CopilotKit uses telemetry to understand adoption, improve the product, and provide better support. Connecting to CopilotCloud gives you access to analytics and optional premium features.

  1. Ask the user if they'd like to connect to CopilotCloud (default: yes).
  2. If yes, run the CopilotKit CLI authentication flow (verify the exact command with npx copilotkit --help as it may vary by version): npx copilotkit auth
  3. Guide the user through the browser-based authentication that opens.
  4. Once authentication completes, the CLI outputs a license key (format: ck_...).
  5. Add the license key to the CopilotKitProvider: <CopilotKitProvider runtimeUrl="/api/copilotkit" licenseKey="ck_..." > Alternatively, store it as an environment variable (COPILOTKIT_LICENSE_KEY in .env.local or .env) and reference it: <CopilotKitProvider runtimeUrl="/api/copilotkit" licenseKey={process.env.NEXT_PUBLIC_COPILOTKIT_LICENSE_KEY} >

See references/telemetry-setup.md for full details on what the license key enables and how to opt out.

Step 7: Verify the setup

  1. Start the dev server
  2. Open the app in a browser
  3. The chat UI should render and connect to the runtime
  4. Send a test message -- you should receive an AI response
  5. Check the runtime's /info endpoint (GET) to confirm it reports available agents

Quick Reference

Package map

PackagePurpose
@copilotkit/reactReact components, hooks, provider
@copilotkit/coreCore types, agent abstraction, state management
@copilotkit/runtimeServer-side runtime, endpoint factories, agent runners
@copilotkit/agentBuiltInAgent, defineTool, model resolution
@copilotkit/sharedShared utilities, logger, types

Endpoint factory functions

FunctionImportProtocolFramework
createCopilotEndpoint@copilotkit/runtimeMulti-route (Hono)Next.js App Router, Hono standalone
createCopilotEndpointSingleRoute@copilotkit/runtimeSingle-route (Hono)Next.js App Router
createCopilotEndpointExpress@copilotkit/runtime/expressMulti-route (Express)Express standalone
createCopilotEndpointSingleRouteExpress@copilotkit/runtime/expressSingle-route (Express)Express standalone

Runtime classes

ClassUse case
CopilotRuntimeCompatibility shim; auto-selects SSE or Intelligence mode
CopilotSseRuntimeExplicit SSE mode (default, in-memory threads)
CopilotIntelligenceRuntimeIntelligence mode (durable threads, realtime events)

Agent runners

RunnerDescription
InMemoryAgentRunnerDefault. Stores thread state in process memory. Suitable for development and single-instance deployments.
IntelligenceAgentRunnerUsed automatically with CopilotIntelligenceRuntime. Connects to CopilotKit Intelligence Platform via WebSocket.

Supported models (BuiltInAgent)

Format: "provider/model-name" string or a Vercel AI SDK LanguageModel instance.

OpenAI: openai/gpt-5, openai/gpt-5-mini, openai/gpt-4.1, openai/gpt-4.1-mini, openai/gpt-4.1-nano, openai/gpt-4o, openai/gpt-4o-mini, openai/o3, openai/o3-mini, openai/o4-mini

Anthropic: anthropic/claude-sonnet-4.5, anthropic/claude-sonnet-4, anthropic/claude-3.7-sonnet, anthropic/claude-opus-4.1, anthropic/claude-opus-4, anthropic/claude-3.5-haiku

Google: google/gemini-2.5-pro, google/gemini-2.5-flash, google/gemini-2.5-flash-lite

Any string is accepted (for custom/unlisted models); the provider is parsed from the prefix before /.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.08%
按下载量换算383

Claude

32.25%
按下载量换算363

Cursor

20.05%
按下载量换算226

Gemini CLI

8.88%
按下载量换算100

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills