Guides
Cloudflare Deploy
Deploy agents to Cloudflare Workers. Local commands with dependencies, CI commands for Cloudflare Dashboard.
Cloudflare Deploy
Deploy edge AI agents to Cloudflare Workers + Durable Objects. Fire-and-forget global deployment.
Quick Reference
| Scenario | Command | Includes Dependencies |
|---|---|---|
| Local development | bun run deploy:telegram | Yes (deploys dependencies) |
| Cloudflare Dashboard CI | bun run ci:deploy:telegram | No (single app only) |
Deployment Models
| Type | Runtime | Best For | Guide |
|---|---|---|---|
| Cloudflare Agent | Workers + DO | Webhooks, serverless, global edge | Telegram Bot, GitHub Bot |
| Claude Code Agent | VM, Docker | Long sessions, code execution | Claude Code Agent |
Local Deployment
Local commands include dependencies via Turbo:
Live in 60s! Global edge network.
CI Deployment (Single App)
For Cloudflare Workers Dashboard, use CI commands that deploy single apps:
Cloudflare Workers Dashboard Setup
Configure build commands in Cloudflare Dashboard → Workers & Pages → Your Worker → Settings → Builds.
Build Configuration
telegram-bot:
- Build command:
bun run ci:build:telegram - Deploy command:
bun run ci:deploy:telegram - Branch deploy:
bun run ci:deploy-version:telegram
github-bot:
- Build command:
bun run ci:build:github - Deploy command:
bun run ci:deploy:github - Branch deploy:
bun run ci:deploy-version:github
Prerequisites
- Env setup: Env Setup
-
bun install -
bunx wrangler login - Secrets configured:
bun scripts/config.ts <app>
Deploy Flow
- Build:
bun run build(turbo) - Secrets:
bun scripts/config.ts <app> - Deploy:
bun run deploy:<app>orbun run ci:deploy:<app> - Verify: Check Cloudflare dashboard
Secrets Configuration
Via Script (Recommended)
Manual Secret Setup
Telegram Bot:
GitHub Bot:
Monitoring
Rollback
Durable Objects
Each bot deploys a single Durable Object implementing Cloudflare Agent Patterns:
- CloudflareChatAgent (loop-based agent with tool iterations)
- Built-in tools: bash, git, github, research, plan
- MCP integration: duyet-mcp, github-mcp
Troubleshooting
| Issue | Solution |
|---|---|
| Secrets not loading | bunx wrangler secret list then re-set |
| DO timeout | Check logs, delete stuck instance if needed |
| High latency | Check AI Gateway, review token usage |
| Deployment fails | bun run check then retry |
Platform Comparison
| Platform | Difficulty | Cost | Best For |
|---|---|---|---|
| Cloudflare Agents | Easy | Free-$5/mo | Stateful agents, global edge |
| Railway | Easy | $5/mo | Beginners, quick setup |
| Fly.io | Easy | Free-$5/mo | Free tier, good defaults |
| Render | Easy | Free-$7/mo | Simple Docker deploys |
| AWS ECS/Fargate | Advanced | $10-15/mo | Full control, enterprise |
| Docker Compose | Medium | VPS cost | Self-hosted |
Next Steps
- Telegram Bot Setup - Telegram bot configuration
- GitHub Bot Setup - GitHub bot configuration
- Getting Started - Deployment checklists
- External Docs - Cloudflare Workers documentation