copilotkit-runtime-patterns
Server-side runtime patterns for CopilotKit. Use when setting up CopilotKit runtime endpoints (Express, Hono, Next.js), configuring remote agent endpoints, adding middleware, or securing the runtime. Triggers on backend tasks involving @copilotkit/runtime, CopilotRuntime, agent registration, or API endpoint configuration.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/generaljerel/copilotkit-runtime-patternsCopilotKit Runtime Patterns
Server-side runtime configuration patterns. Contains 15 rules across 5 categories.
When to Apply
Reference these guidelines when:
- Setting up CopilotKit runtime endpoints (Express, Hono, Next.js API routes)
- Configuring CopilotRuntime with service adapters (OpenAIAdapter, etc.)
- Registering agents via remote endpoints (LangGraph, CrewAI)
- Adding middleware for logging, auth, or request modification
- Securing the runtime (CORS, auth, rate limiting)
- Optimizing runtime performance
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Endpoint Setup | CRITICAL | endpoint- |
| 2 | Agent Configuration | HIGH | runner- |
| 3 | Middleware | MEDIUM | middleware- |
| 4 | Security | HIGH | security- |
| 5 | Performance | MEDIUM | perf- |
Quick Reference
1. Endpoint Setup (CRITICAL)
endpoint-express-setup- Configure Express endpoint with CopilotRuntime and CORSendpoint-hono-setup- Configure Hono endpoint for edge runtimesendpoint-nextjs-route- Set up Next.js API route with copilotRuntimeNextJSAppRouterEndpoint
2. Agent Configuration (HIGH)
runner-inmemory-vs-sqlite- Use persistent storage for production thread managementrunner-agent-registration- Register agents via remoteEndpointsrunner-multiple-agents- Configure routing for multi-agent setups
3. Middleware (MEDIUM)
middleware-before-request- Use onBeforeRequest for auth, logging, context injectionmiddleware-after-request- Use onAfterRequest for response logging and cleanupmiddleware-error-handling- Handle errors in middleware without crashing the runtime
4. Security (HIGH)
security-cors-config- Configure CORS for your specific frontend originsecurity-auth-middleware- Authenticate requests before agent executionsecurity-rate-limiting- Rate limit by user or API key
5. Performance (MEDIUM)
perf-streaming-response- Ensure streaming is not buffered by proxies
Full Compiled Document
For the complete guide with all rules expanded: AGENTS.md
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-generaljerel-copilotkit-runtime-patterns": {
"enabled": true,
"auto_update": true
}
}
}Related Skills
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.
copilotkit-react-patterns
CopilotKit React best practices for agentic applications. Use when writing, reviewing, or refactoring React code that uses CopilotKit hooks (useAgent, useFrontendTool, useRenderTool, useCopilotAction, useCopilotReadable), providers (CopilotKit), or chat UI components (CopilotChat, CopilotSidebar, CopilotPopup). Triggers on tasks involving agent integration, tool rendering, shared state, or generative UI in React.