skillfed

building-ai-agent-on-cloudflare

This skill generates production-ready AI agents deployed to Cloudflare Workers using the Agents SDK. It handles persistent state management, real-time WebSocket communication, scheduled background tasks, and tool calling—everything needed for stateful, scalable agent applications.

Building AI Agent on Cloudflare lets you create stateful agents on Workers with persistent state and real-time communication.

AI-generated summary based on this skill's SKILL.md

0 0 Apache-2.0 updated by null-shot

Install

null-shot/cloudflare-skills/building-ai-agent-on-cloudflare · repository language: TypeScript

CLI (skillfed)coming soon
git clone https://github.com/null-shot/cloudflare-skills
cp -r cloudflare-skills/building-ai-agent-on-cloudflare ~/.claude/skills/building-ai-agent-on-cloudflare

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do I build an AI agent on Cloudflare?

Building AI agent on Cloudflare uses the Agents SDK to deploy stateful agents directly to Cloudflare Workers. The skill covers the full lifecycle: setting up your agent with the SDK, configuring persistent state via Durable Objects, integrating LLM calls, and deploying to production. You'll learn patterns for handling agent reasoning loops, managing tool calls, and scaling across Cloudflare's global network.

What does the Cloudflare Agents SDK tutorial cover?

The Cloudflare Agents SDK tutorial teaches best practices for building production agents on Workers. It includes SDK initialization, state persistence patterns, WebSocket setup for real-time communication, tool integration, scheduled task execution, and message history management. The tutorial emphasizes patterns that work at scale on Cloudflare's infrastructure.

Can I create a stateful chatbot with WebSocket support on Workers?

Yes. Building AI agent on Cloudflare supports creating real-time chat agents with WebSocket communication. The skill covers establishing persistent WebSocket connections, maintaining conversation state across messages, and routing tool calls asynchronously. Durable Objects provide the state layer, while Workers handle the compute and WebSocket protocol.

How does state management work for Cloudflare agents?

Building AI agent on Cloudflare uses Durable Objects for persistent state storage. Your agent maintains message history, conversation context, and tool execution state within a Durable Object instance. The skill teaches state initialization, updates during agent reasoning, and recovery patterns. This ensures your agent retains context across requests and client reconnections.

Can I schedule background tasks within an AI agent?

Yes. Building AI agent on Cloudflare includes patterns for scheduling background tasks and tool calls within your agent. You can queue long-running operations, retry failed tool calls, and execute scheduled maintenance tasks without blocking real-time interactions. The skill covers integration with Cloudflare's scheduling and queuing primitives.

What are the key patterns for deploying production agents on Workers?

Building AI agent on Cloudflare emphasizes production-ready patterns: error handling across tool calls, graceful state recovery, WebSocket reconnection logic, rate limiting, and observability. The skill teaches how to structure your agent code for reliability, scale message throughput, and monitor agent behavior in production environments.

SKILL.md

rendered from the published skill — quoted content, verbatim

Building Cloudflare Agents

Creates AI-powered agents using Cloudflare's Agents SDK with persistent state, real-time communication, and tool integration.

When to Use

  • User wants to build an AI agent or chatbot
  • User needs stateful, real-time AI interactions
  • User asks about the Cloudflare Agents SDK
  • User wants scheduled tasks or background AI work
  • User needs WebSocket-based AI communication

Prerequisites

  • Cloudflare account with Workers enabled
  • Node.js 18+ and npm/pnpm/yarn
  • Wrangler CLI (npm install -g wrangler)

Quick Start

npm create cloudflare@latest -- my-agent --template=cloudflare/agents-starter
cd my-agent
npm start

Agent runs

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 5 files
building-ai-agent-on-cloudflare/SKILL.md
building-ai-agent-on-cloudflare/references/agent-patterns.md
building-ai-agent-on-cloudflare/references/examples.md
building-ai-agent-on-cloudflare/references/state-patterns.md
building-ai-agent-on-cloudflare/references/troubleshooting.md

Related skills

Tags

edge-ai-deployment serverless-agents persistent-state-ai real-time-websocket agent-orchestration distributed-ai-service stateful-backend production-ready-agents ai-task-scheduling multi-client-sync