Deployment Guide
1. Create Your Project
# Create new project using template
npm create cloudflare@latest -- my-first-worker --template 0xkoda/agent-template
cd my-first-worker
2. Set Up KV Storage
Create KV namespaces for your agent's memory system:
# Create KV namespaces
npx wrangler kv:namespace create AGENT_MEMORY
npx wrangler kv:namespace create AGENT_MEMORY --preview
3. Configure Environment
Update your wrangler.toml
:
# wrangler.toml
name = "farcaster-agent"
main = "src/index.ts"
compatibility_date = "2024-01-01"
[vars]
ENABLE_TELEGRAM = true
ENABLE_FARCASTER = true
ENABLE_TWITTER = true
LLM_MODEL = "openai/gpt-4o-mini" # Model to use for LLM responses, choose any on openrouter
[[kv_namespaces]]
binding = "AGENT_MEMORY"
id = "your_kv_namespace_id"
preview_id = "your_preview_namespace_id"
4. Set Up Platform Secrets
Configure the required API keys and tokens for each platform you want to enable:
# Add platform-specific secrets
npx wrangler secret put TELEGRAM_BOT_TOKEN
npx wrangler secret put FARCASTER_NEYNAR_API_KEY
npx wrangler secret put FARCASTER_NEYNAR_SIGNER_UUID
npx wrangler secret put FARCASTER_FID
npx wrangler secret put TWITTER_API_KEY
npx wrangler secret put TWITTER_API_SECRET
npx wrangler secret put TWITTER_ACCESS_TOKEN
npx wrangler secret put TWITTER_ACCESS_SECRET
npx wrangler secret put OPENROUTER_API_KEY
Note: You only need to configure the secrets for the platforms you've enabled in your wrangler.toml
. For example, if you've set ENABLE_TELEGRAM = false
, you can skip setting the Telegram-related secrets.
5. Deploy
# Build and deploy
npx wrangler deploy