Build Agents on Cloudflare
Build and deploy AI-powered Agents on Cloudflare that can autonomously perform tasks, communicate with clients in real time, persist state, execute long-running and repeat tasks on a schedule, send emails, run asynchronous workflows, browse the web, query data from your Postgres database, call AI models, support human-in-the-loop use-cases, and more.
Use the agent started template to create your first Agent with the agents-sdk
:
# install itnpm create cloudflare@latest agents-starter -- --template=cloudflare/agents-starter# and deploy itnpx wrangler@latest deploy
Head to the guide on building a chat agent to learn how to build and deploy an Agent to prod.
If you're already building on Workers, you can install the agents-sdk
package directly into an existing project:
npm i agents-sdk
Dive into the Agent SDK reference to learn more about how to use the agents-sdk
package and defining an Agent
.
We built the agents-sdk
with a few things in mind:
- Batteries (state) included: Agents come with built-in state management, with the ability to automatically sync state between an Agent and clients, trigger events on state changes, and read+write to each Agent's SQL database.
- Communicative: You can connect to an Agent via WebSockets and stream updates back to client in real-time. Handle a long-running response from a reasoning model, the results of an asynchronous workflow, or build a chat app that builds on the
useAgent
hook included in theagents-sdk
. - Extensible: Agents are code. Use the AI models you want, bring-your-own headless browser service, pull data from your database hosted in another cloud, add your own methods to your Agent and call them.
Agents built with agents-sdk
can be deployed directly to Cloudflare and run on top of Durable Objects — which you can think of as stateful micro-servers that can scale to tens of millions — and are able to run wherever they need to. Run your Agents close to a user for low-latency interactivity, close to your data for throughput, and/or anywhere in between.
Build serverless applications and deploy instantly across the globe for exceptional performance, reliability, and scale.
Observe and control your AI applications with caching, rate limiting, request retries, model fallback, and more.
Build full-stack AI applications with Vectorize, Cloudflare’s vector database. Adding Vectorize enables you to perform tasks such as semantic search, recommendations, anomaly detection or can be used to provide context and memory to an LLM.
Run machine learning models, powered by serverless GPUs, on Cloudflare's global network.
Build stateful agents that guarantee executions, including automatic retries, persistent state that runs for minutes, hours, days, or weeks.
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Products
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark