Duyetbot Agent
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

ScenarioCommandIncludes Dependencies
Local developmentbun run deploy:telegramYes (deploys dependencies)
Cloudflare Dashboard CIbun run ci:deploy:telegramNo (single app only)

Deployment Models

TypeRuntimeBest ForGuide
Cloudflare AgentWorkers + DOWebhooks, serverless, global edgeTelegram Bot, GitHub Bot
Claude Code AgentVM, DockerLong sessions, code executionClaude Code Agent

Local Deployment

Local commands include dependencies via Turbo:

bun run deploy              # All apps
bun run deploy:telegram     # Telegram bot + dependencies
bun run deploy:github       # GitHub bot + dependencies

Live in 60s! Global edge network.

CI Deployment (Single App)

For Cloudflare Workers Dashboard, use CI commands that deploy single apps:

bun run ci:deploy:telegram       # Deploy telegram only
bun run ci:deploy:github         # Deploy github only

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

  1. Build: bun run build (turbo)
  2. Secrets: bun scripts/config.ts <app>
  3. Deploy: bun run deploy:<app> or bun run ci:deploy:<app>
  4. Verify: Check Cloudflare dashboard

Secrets Configuration

bun run config              # Configure all apps
bun run config:telegram     # Telegram secrets
bun run config:github       # GitHub secrets

Manual Secret Setup

Telegram Bot:

cd apps/telegram-bot
bunx wrangler secret put TELEGRAM_BOT_TOKEN
bunx wrangler secret put OPENROUTER_API_KEY

GitHub Bot:

cd apps/github-bot
bunx wrangler secret put GITHUB_TOKEN
bunx wrangler secret put GITHUB_WEBHOOK_SECRET
bunx wrangler secret put OPENROUTER_API_KEY

Monitoring

# Stream live logs
npx wrangler tail --name duyetbot-telegram
npx wrangler tail --name duyetbot-github
 
# Filter for errors
npx wrangler tail --filter error
 
# List deployments
npx wrangler deployments list

Rollback

# List deployments
npx wrangler deployments list
 
# Rollback to previous
npx wrangler rollback [DEPLOYMENT_ID]

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

IssueSolution
Secrets not loadingbunx wrangler secret list then re-set
DO timeoutCheck logs, delete stuck instance if needed
High latencyCheck AI Gateway, review token usage
Deployment failsbun run check then retry

Platform Comparison

PlatformDifficultyCostBest For
Cloudflare AgentsEasyFree-$5/moStateful agents, global edge
RailwayEasy$5/moBeginners, quick setup
Fly.ioEasyFree-$5/moFree tier, good defaults
RenderEasyFree-$7/moSimple Docker deploys
AWS ECS/FargateAdvanced$10-15/moFull control, enterprise
Docker ComposeMediumVPS costSelf-hosted

Next Steps