copilotkit-agent-patterns
Patterns for building AI agents that integrate with CopilotKit. Use when designing agent architecture, implementing AG-UI event streaming, managing shared state between agent and UI, adding human-in-the-loop checkpoints, or emitting generative UI from agents. Triggers on agent implementation tasks involving CopilotKit runtime, BuiltInAgent, or AG-UI protocol.
- License 许可
- MIT
- 最近更新
- 2026-05-17
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- copilotkit-agent-patterns
- license
- MIT
- metadata
- { "author": "copilotkit", "version": "1.0.0" }
- description
- Patterns for building AI agents that integrate with CopilotKit. Use when designing agent architecture, implementing AG-UI event streaming, managing shared state between agent and UI, adding human-in-the-loop checkpoints, or emitting generative UI from agents. Triggers on agent implementation tasks involving CopilotKit runtime, BuiltInAgent, or AG-UI protocol.
02 资源文件 25
- 参考文档_meta.json308 B
- 参考文档AGENTS.md27.7 KB
- 参考文档README.md857 B
- 参考文档rules/_sections.md1.2 KB
- 参考文档rules/_template.md337 B
- 参考文档rules/agui-error-events.md1.5 KB
- 参考文档rules/agui-event-ordering.md1.3 KB
- 参考文档rules/agui-state-snapshot.md1.6 KB
- 参考文档rules/agui-text-streaming.md1.4 KB
- 参考文档rules/agui-tool-call-lifecycle.md1.2 KB
- 参考文档rules/architecture-built-in-agent.md1.5 KB
- 参考文档rules/architecture-max-steps.md1.1 KB
- 参考文档rules/architecture-mcp-servers.md1.3 KB
- 参考文档rules/architecture-model-resolution.md1017 B
- 参考文档rules/genui-activity-messages.md1.1 KB
- 参考文档rules/genui-streaming-args.md1.5 KB
- 参考文档rules/genui-tool-call-render.md1.2 KB
- 参考文档rules/hitl-approval-gates.md1.1 KB
- 参考文档rules/hitl-context-in-prompt.md1.0 KB
- 参考文档rules/hitl-resume-state.md1.4 KB
- 参考文档rules/hitl-timeout-fallback.md1.2 KB
- 参考文档rules/state-conflict-resolution.md1.2 KB
- 参考文档rules/state-minimal-payload.md1.0 KB
- 参考文档rules/state-snapshot-frequency.md1.3 KB
- 参考文档rules/state-thread-isolation.md1.1 KB
03 SKILL.md 正文
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
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Agent Architecture | CRITICAL | architecture- |
| 2 | AG-UI Protocol | HIGH | agui- |
| 3 | State Management | HIGH | state- |
| 4 | Human-in-the-Loop | MEDIUM | hitl- |
| 5 | Generative UI Emission | MEDIUM | genui- |
Quick Reference
1. Agent Architecture (CRITICAL)
architecture-built-in-agent- Use BuiltInAgent with defineTool for simple agentsarchitecture-model-resolution- Use resolveModel for provider-agnostic model selectionarchitecture-max-steps- Set maxSteps to prevent infinite tool call loopsarchitecture-mcp-servers- Configure MCP servers 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 blocksagui-tool-call-lifecycle- Follow the complete tool call event lifecycleagui-state-snapshot- Emit STATE_SNAPSHOT events for frontend syncagui-error-events- Always emit error events on failure
3. State Management (HIGH)
state-snapshot-frequency- Emit state snapshots at meaningful checkpointsstate-minimal-payload- Keep state snapshots minimal and serializablestate-conflict-resolution- Handle bidirectional state conflicts gracefullystate-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 eventshitl-timeout-fallback- Always set timeouts with fallback behaviorhitl-context-in-prompt- Include sufficient context for user decisionshitl-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 useRenderToolgenui-streaming-args- Stream tool args incrementally for real-time UIgenui-activity-messages- Use activity messages for non-tool UI 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
04 同仓库更多 Skills
zvukogram
Text-to-Speech via Zvukogram API with SSML support. Use when you need to generate speech from text, create podcasts, voice notifications, or work with audio. Supports speed control, stress marks, English word transcription, and audio fragment merging.
zohomail
Zoho Mail API integration with managed OAuth. Send, receive, and manage emails, folders, and labels. Use this skill when users want to send emails, read messages, manage folders, or work with email labels in Zoho Mail. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key.
zoho-recruit
Zoho Recruit API integration with managed OAuth. Manage candidates, job openings, interviews, and recruitment workflows. Use this skill when users want to read, create, update, or search recruitment data like candidates, job openings, interviews, and applications in Zoho Recruit. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key.
zoho-people
Zoho People API integration with managed OAuth. Manage employees, departments, designations, attendance, and leave. Use this skill when users want to read, create, update, or query HR data like employees, departments, designations, and forms in Zoho People. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key.
zoho-mail
Zoho Mail API integration with managed OAuth. Send, receive, and manage emails, folders, and labels. Use this skill when users want to send emails, read messages, manage folders, or work with email labels in Zoho Mail. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key.
zoho-inventory
Zoho Inventory API integration with managed OAuth. Manage items, sales orders, invoices, purchase orders, bills, contacts, and shipments. Use this skill when users want to read, create, update, or delete inventory items, sales orders, invoices, purchase orders, bills, or other inventory records in Zoho Inventory. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key.