About cloudflare-agents
A skill guide for building agents on Cloudflare, aimed at developers working with LLM-based applications. It covers tool registration, provider options, Cloudflare bindings, MCP integration, and reusable implementation templates.
Key features
- 01Register and execute tools
- 02OpenAI, Anthropic, and Gemini providers
- 03Cloudflare D1, KV, R2, and Durable Objects
- 04HTTP, SSE, and WebSocket patterns
- 05State management and scheduled tasks
- 06Agent and MCP integration templates
Use cases
- 01Build an agent that calls registered tools
- 02Connect an agent to Cloudflare storage bindings
- 03Implement streaming or WebSocket agent interfaces
- 04Add MCP integration to a Cloudflare agent
MCP support
The guide includes MCP protocol support, an MCP integration reference, and a template for integrating an MCP server with an agent.
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ secondsky/ claude-skills --skill cloudflare-agentsAfter installing, type/cloudflare-agentsin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
references/advanced-features.mdagent-api.mdconfiguration-guide.mderror-catalog.mdhttp-sse-guide.mdmcp-integration.mdpatterns-concepts.mdstate-management.mdwebsockets-guide.mdtemplates/basic-agent.tsbrowser-agent.tscalling-agents-worker.tschat-agent-streaming.tshitl-agent.tsmcp-server-basic.tsrag-agent.tsreact-useagent-client.tsxscheduled-agent.tsstate-sync-agent.tswebsocket-agent.tsworkflow-agent.tswrangler-agents-config.jsoncDetails
From the project READMECloudflare Agents
Last Updated: 2025-11-21
Quick Start
export default {
async fetch(request, env, ctx) {
const agent = {
tools: [
{ name: 'getTodo', handler: async ({id}) => ({id, title: 'Task'}) }
],
async run(input) {
return await processWithLLM(input, this.tools);
}
};
return Response.json(await agent.run(await request.text()));
}
};
Core Features
- Tool Integration: Register and execute tools
- LLM Providers: OpenAI, Anthropic, Google Gemini
- MCP Protocol: Model Context Protocol support
- Cloudflare Bindings: D1, KV, R2, Durable Objects
Agent Pattern
const agent = {
tools: [...],
systemPrompt: 'You are a helpful assistant',
model: 'gpt-4o',
async run(input) {
// Process with LLM
}
};
Resources
Core Documentation
references/patterns-concepts.md(317 lines) - What is Cloudflare Agents, patterns & concepts, critical rules, known issues preventionreferences/configuration-guide.md(152 lines) - Complete configuration deep divereferences/agent-api.md(115 lines) - Complete Agent Class API reference
Integration Guides
references/http-sse-guide.md(74 lines) - HTTP & Server-Sent Eventsreferences/websockets-guide.md(110 lines) - WebSocket integrationreferences/state-management.md(388 lines) - State management, scheduled tasks, workflowsreferences/mcp-integration.md(130 lines) - Model Context Protocol integration
Advanced Features
references/advanced-features.md(637 lines) - Browser automation, RAG, AI model integration, calling agents, client APIs
Error Reference
references/error-catalog.md(10 lines) - Common errors and solutions
Templates
templates/basic-agent.ts- Basic agent setuptemplates/browser-agent.ts- Browser automationtemplates/calling-agents-worker.ts- Calling other agentstemplates/chat-agent-streaming.ts- Streaming chat agenttemplates/hitl-agent.ts- Human-in-the-looptemplates/mcp-server-basic.ts- MCP server integrationtemplates/rag-agent.ts- RAG implementationtemplates/react-useagent-client.tsx- React client integrationtemplates/scheduled-agent.ts- Scheduled taskstemplates/state-sync-agent.ts- State synchronizationtemplates/websocket-agent.ts- WebSocket agenttemplates/workflow-agent.ts- Workflows integrationtemplates/wrangler-agents-config.jsonc- Wrangler configuration
Official Docs: https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-agents/
Comments
Markdown supported