Cloudflare Agents Deployment
Deploy duyetbot-agent to Cloudflare Agents with Durable Objects, SQLite, and WebSocket hibernation
Back to: Deployment Overview
Deploy duyetbot-agent to Cloudflare Agents using Durable Objects for stateful, serverless execution.
Overview
Cloudflare Agents provides:
- Stateful execution via Durable Objects
- Zero-latency SQLite storage for agent memory
- WebSocket hibernation for cost savings
- Real-time communication with clients
- Global edge deployment
Prerequisites
- Cloudflare account (Free tier available)
- Node.js 18+
- Wrangler CLI:
npm install -g wrangler
Quick Start
1. Create Agent Project
2. Install Dependencies
3. Configure wrangler.jsonc
4. Create Agent Entry Point
5. Set Secrets
6. Deploy
Environment Variables
Integrating with duyetbot-agent
To use the existing duyetbot-agent packages:
State Persistence
Cloudflare Agents uses SQLite storage built into Durable Objects:
WebSocket Hibernation
Enable hibernation for cost savings when idle:
Deployment Options
Development
Production
Custom Domain
Monitoring
View logs and metrics in Cloudflare Dashboard:
Cost Considerations
| Resource | Free Tier | Paid |
|---|---|---|
| Requests | 100K/day | $0.15/million |
| Duration | 10ms CPU | $12.50/million GB-s |
| Storage | 1GB | $0.20/GB-month |
WebSocket hibernation reduces costs by pausing execution while maintaining connections.
Troubleshooting
Migration Errors
If you see migration errors, ensure new_sqlite_classes includes your agent class:
State Not Persisting
Ensure you're using this.state.storage methods, not local variables.
WebSocket Disconnections
Check that your agent handles reconnection gracefully and restores state from storage.
Next Steps
- Memory MCP Deployment - Add session persistence
- GitHub Bot Deployment - Deploy webhook handler
- Deployment Overview - Other components