building-ai-agent-on-cloudflare

Build stateful AI agents on Cloudflare Workers with the Agents SDK.

2|Updated Mar 29, 2026
One-click install
npx skills add https://github.com/NagyVikt/codex-plugins --skill building-ai-agent-on-cloudflare-nagyvikt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: building-ai-agent-on-cloudflare
Source: https://github.com/NagyVikt/codex-plugins/tree/main/plugins/cloudflare/skills/building-ai-agent-on-cloudflare
Command: npx skills add https://github.com/NagyVikt/codex-plugins --skill building-ai-agent-on-cloudflare-nagyvikt

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill addresses the complexity of building stateful, persistent AI agents that require real-time communication, scheduled tasks, and reliable state management on serverless infrastructure.

Core Features & Use Cases

  • Stateful Persistence: Automatically manages agent state across sessions using Durable Objects and embedded SQLite.
  • Real-time Communication: Supports WebSocket-based interactions for low-latency chat and event streaming.
  • Advanced Orchestration: Enables tool calling, RAG (Retrieval Augmented Generation), and multi-agent workflows for complex tasks.

Quick Start

Run the create cloudflare command with the agents-starter template to initialize your new agent project in the current directory.

Frequently Asked Questions about building-ai-agent-on-cloudflare

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build stateful AI agents on Cloudflare Workers?

To build stateful AI agents on Cloudflare Workers, use the Agents SDK to automatically manage persistent state across sessions with Durable Objects and embedded SQLite, enabling reliable chat and background tasks.

Can I use WebSockets for real-time chat with Cloudflare AI agents?

Yes, real-time chat with Cloudflare AI agents uses WebSockets for low-latency communication and event streaming. The Agents SDK supports WebSocket-based interactions directly on the edge for stateful assistant workflows.

How does RAG work with Cloudflare Vectorize and Workers AI?

RAG with Cloudflare Vectorize and Workers AI enables advanced orchestration by retrieving external context for your agents. This integration supports tool calling and multi-agent workflows for complex, knowledge-augmented tasks.

What's the best way to manage persistent state in serverless AI applications?

The best way to manage persistent state in serverless AI applications is using Durable Objects with embedded SQLite. This approach automatically maintains agent state across sessions without manual database management on serverless infrastructure.

Do I need Durable Objects to run scheduled background tasks on the edge?

Yes, Durable Objects are required to run scheduled background tasks on the edge. They provide the persistent state management needed to facilitate reliable, stateful background workflows alongside your real-time AI agents.

How to quickly initialize a new Cloudflare AI agent project?

To quickly initialize a new Cloudflare AI agent project, run the create cloudflare command with the agents-starter template. This sets up your project directory with the necessary Workers AI and Vectorize configurations for edge deployment.