Skip to content

参考

基于 CopilotKit/skills 各 SKILL.mdskills-lock.json.mcp.json 与 docs.copilotkit.ai 编写。

速查

  • npx skills add CopilotKit/CopilotKit/skills -y(权威源 = 主 monorepo skills/
  • 8 sub-skill:setup / develop / integrations / debug / upgrade / agui / contribute / self-update(+ 路由 skill copilotkit
  • v2 包@copilotkit/react · @copilotkit/core · @copilotkit/runtime · @copilotkit/agent · @copilotkit/shared
  • AG-UI 包@ag-ui/core(协议)· @ag-ui/client(SDK)· @ag-ui/encoder(SSE/protobuf 编码)
  • MCPcopilotkit-docs @ mcp.copilotkit.ai/mcpsearch-docs/search-code/search-ag-ui-docs/search-ag-ui-code
  • MIT · 遵 agentskills.io · Copyright 2026 CopilotKit

8 sub-skill 全表

Sub-skill触发覆盖
copilotkit(路由)用 CopilotKit / 任务模糊Routing Table 分派到下列 sub-skill;默认 setup
copilotkit-setup初装 / 加进项目框架检测、装包、runtime、provider、聊天 UI、Key、验证
copilotkit-develop建功能useFrontendTool/useAgentContext/useRenderToolCall/useInterrupt/useHumanInTheLoop
copilotkit-integrations接 agent 框架LangGraph/CrewAI/PydanticAI/Mastra/ADK/LlamaIndex/Agno/Strands/MS/A2A/MCP Apps
copilotkit-debug排障版本/模式/传输/错误码/AG-UI 事件追踪/CORS/转录
copilotkit-upgrade版本迁移v1(GraphQL)→ v2(AG-UI)弃用 API 替换
copilotkit-agui自建后端 / 协议事件族、SSE、AbstractAgent.run()、状态同步、人在环路
copilotkit-contribute贡献fork、Nx monorepo、Vitest、conventional commit、PR
copilotkit-self-update技能过时fresh clone 刷新 SKILL.md 知识(非项目依赖升级)

v2 API 速查

Hook(@copilotkit/react

Hook用途
useFrontendTool注册 agent 可在浏览器调的工具
useComponent把 React 组件注册成 chat 内工具(useFrontendTool 便捷封装)
useAgentContext把可 JSON 序列化的应用状态共享给 agent
useAgent拿 agent 实例、订阅消息/状态/run 状态
useInterrupt处理 agent 的 on_interrupt 事件(render + 可选 handler/filter)
useHumanInTheLoop注册暂停执行、等用户经 UI 响应的工具
useRenderToolCall按名字(或通配 "*")注册工具调用的渲染器
useSuggestions / useConfigureSuggestions读/注册建议列表(静态或 LLM 生成)
useThreadsIntelligence 平台线程列/改名/归档/删

组件(@copilotkit/react

CopilotKitProvider(根 provider)· CopilotChat(内联)· CopilotPopup(浮动弹窗)· CopilotSidebar(侧栏)· CopilotChatView(无头,带 slot)· CopilotChatInput · CopilotChatMessageView · CopilotChatSuggestionView

Runtime(@copilotkit/runtime

导出用途
CopilotRuntime自动选 SSE / Intelligence 模式的兼容 shim
CopilotSseRuntime显式 SSE 模式(默认,内存线程)
CopilotIntelligenceRuntimeIntelligence 模式(持久线程、实时事件)
createCopilotEndpoint建含所有 CopilotKit 路由的 Hono app(多路由)
createCopilotEndpointSingleRoute单路由 Hono 端点
createCopilotEndpointExpress / ...SingleRouteExpressExpress 版(从 @copilotkit/runtime/express
InMemoryAgentRunner默认 runner,线程状态存进程内存

Agent(@copilotkit/agent

BuiltInAgentmodel: "provider/model-name",如 openai/gpt-4oanthropic/claude-sonnet-4.5google/gemini-2.5-pro;按前缀自动取 env key)· defineTool

CopilotKitProvider 关键 props

runtimeUrl(runtime 端点)· useSingleEndpoint(用单路由后端时设 true)· headers · credentials · publicApiKey(Copilot Cloud)· showDevConsole"auto" = 仅开发)· renderToolCalls · frontendTools · onError

AG-UI 事件族

事件用途
LifecycleRUN_STARTED / RUN_FINISHED / RUN_ERROR / STEP_STARTED / STEP_FINISHEDrun 边界与进度
TextTEXT_MESSAGE_START / _CONTENT / _END流式文本
Tool CallsTOOL_CALL_START / _ARGS / _END / _RESULTagent 工具调用
StateSTATE_SNAPSHOT / STATE_DELTA / MESSAGES_SNAPSHOT状态同步(delta = RFC 6902 JSON Patch)
ReasoningREASONING_START / _MESSAGE_* / _END / _ENCRYPTED_VALUE思维链可见性
ActivityACTIVITY_SNAPSHOT / ACTIVITY_DELTA结构化进度
CustomRAW / CUSTOM扩展点

便捷 chunk:TEXT_MESSAGE_CHUNK / TOOL_CALL_CHUNK 自动展开成 Start/Content/End。SSE 线格式:data: {"type":"RUN_STARTED",...}\n\n。协议包:@ag-ui/core(事件/类型/schema)· @ag-ui/clientAbstractAgent/HttpAgent/中间件)· @ag-ui/encoderEventEncoder)。

集成矩阵(AG-UI client 选型)

框架AG-UI client服务端适配器
LangGraph(Python 自托管)LangGraphHttpAgentag-ui-langgraphadd_langgraph_fastapi_endpoint
LangGraph(Platform / JS)LangGraphAgentLangGraph Platform / @copilotkit/sdk-js/langgraph
CrewAI Flows / CrewsHttpAgent / CrewAIAgentag-ui-crewai
PydanticAIHttpAgentpydantic-ai-slim[ag-ui]agent.to_ag_ui()
MastraMastraAgent内建于 @ag-ui/mastra
Google ADKHttpAgentag-ui-adk
LlamaIndexLlamaIndexAgentllama-index-protocols-ag-ui
Agno / StrandsHttpAgentagno(AgentOS)/ ag_ui_strands
MS Agent FrameworkHttpAgentagent-framework-ag-ui / MapAGUI(.NET)
A2A(多 agent)A2AMiddlewareAgent每 agent 混合
MCP AppsBuiltInAgent + MCPAppsMiddleware中间件

安装与格式

bash
# 装/更新(fresh clone,永远拿最新)
npx skills add CopilotKit/CopilotKit/skills -y
  • 每个 skill = 一个含 SKILL.md 的目录(遵 agentskills.io),可带 references/ 支撑文档
  • 一份技能跨 Claude Code / Codex / Cursor / OpenCode 通用
  • 配套 .mcp.json 声明 copilotkit-docs MCP(Claude Code 自动配置;Codex 需手动写 .codex/config.toml
  • skills-lock.json 锁 8 个 sub-skill 的源与 hash

资源链接