← 返回
内容创作 中文

CopilotKit-agent-patterns

Patterns for building AI agents that integrate with CopilotKit. Use when designing agent architecture, implementing AG-UI event streaming, managing shared st...
构建集成 CopilotKit 的 AI Agent 模式。适用于设计 Agent 架构、实现 AG-UI 事件流及管理共享状态。
generaljerel
内容创作 clawhub v1.0.2 1 版本 100000 Key: 无需
★ 0
Stars
📥 931
下载
💾 30
安装
1
版本
#latest

概述

CopilotKit Agent Patterns

Architecture and implementation patterns for building AI agents that connect to CopilotKit. Contains 20 rules across 5 categories, prioritized by impact.

When to Apply

Reference these guidelines when:

  • Designing agent architecture for CopilotKit integration
  • Implementing AG-UI protocol event streaming
  • Managing state synchronization between agent and frontend
  • Adding human-in-the-loop checkpoints to agent workflows
  • Emitting tool calls that render generative UI in the frontend

Rule Categories by Priority

PriorityCategoryImpactPrefix
------------------------------------
1Agent ArchitectureCRITICALarchitecture-
2AG-UI ProtocolHIGHagui-
3State ManagementHIGHstate-
4Human-in-the-LoopMEDIUMhitl-
5Generative UI EmissionMEDIUMgenui-

Quick Reference

1. Agent Architecture (CRITICAL)

  • architecture-built-in-agent - Use BuiltInAgent from @copilotkit/runtime/v2 for simple agents
  • architecture-model-resolution - Use provider/model string format for model selection
  • architecture-max-steps - Set maxSteps to prevent infinite tool call loops
  • architecture-mcp-servers - Configure MCP endpoints for external tool access

2. AG-UI Protocol (HIGH)

  • agui-event-ordering - Emit events in correct order (start -> content -> end)
  • agui-text-streaming - Stream text incrementally, not as single blocks
  • agui-tool-call-lifecycle - Follow the complete tool call event lifecycle
  • agui-state-snapshot - Emit STATE_SNAPSHOT events for frontend sync
  • agui-error-events - Always emit error events on failure

3. State Management (HIGH)

  • state-snapshot-frequency - Emit state snapshots at meaningful checkpoints
  • state-minimal-payload - Keep state snapshots minimal and serializable
  • state-conflict-resolution - Handle bidirectional state conflicts gracefully
  • state-thread-isolation - Isolate state per thread, not per agent

4. Human-in-the-Loop (MEDIUM)

  • hitl-approval-gates - Use tool calls for approval gates, not custom events
  • hitl-timeout-fallback - Always set timeouts with fallback behavior
  • hitl-context-in-prompt - Include sufficient context for user decisions
  • hitl-resume-state - Preserve full state when resuming after approval

5. Generative UI Emission (MEDIUM)

  • genui-tool-call-render - Emit tool calls that map to frontend useRenderTool
  • genui-streaming-args - Stream tool args incrementally for real-time UI
  • genui-activity-messages - Use text messages for non-tool status updates

How to Use

Read individual rule files for detailed explanations and code examples:

rules/architecture-built-in-agent.md
rules/agui-event-ordering.md

Full Compiled Document

For the complete guide with all rules expanded: AGENTS.md

版本历史

共 1 个版本

  • v1.0.2 当前
    2026-03-29 12:57 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

content-creation

Baidu Wenku AIPPT

ide-rea
使用百度文库 AI 智能生成 PPT,自动根据内容选择模板。
★ 66 📥 46,152
content-creation

Humanizer

biostartechnology
消除AI写作痕迹,使文本更自然真实。基于维基百科"AI写作特征"指南,识别并修正夸张象征、宣传用语、肤浅-ing分析、模糊归因、破折号滥用、三项排比、AI词汇、负面平行结构及冗长连接词等模式。
★ 858 📥 199,498
content-creation

AdMapix

fly0pants
广告情报与应用数据分析助手,支持搜索广告素材、分析应用排名、下载量、收入及市场洞察,用于广告素材和竞品分析。
★ 295 📥 136,444