This guide outlines the steps to deploy the agent to Cloudflare Workers.
- Wrangler CLI installed (
npm install -g wrangler). - A Cloudflare account.
Authenticate Wrangler with your Cloudflare account:
npx wrangler loginYou need to create the D1 database and KV namespace in your Cloudflare account.
npx wrangler d1 create taichi-dbAction: Copy the database_id from the output and update your wrangler.toml:
[[d1_databases]]
binding = "DB"
database_name = "taichi-db"
database_id = "<PASTE_YOUR_DATABASE_ID_HERE>"npx wrangler kv:namespace create "KV"Action: Copy the id from the output and update your wrangler.toml:
[[kv_namespaces]]
binding = "KV"
id = "<PASTE_YOUR_KV_ID_HERE>"npx wrangler vectorize create taichi-knowledge-base --dimensions=1024 --metric=cosineAction: Copy the configuration output and ensure your wrangler.toml matches. It should look like:
[[vectorize]]
binding = "VECTORIZE_INDEX"
index_name = "taichi-knowledge-base"Apply the schema to your remote D1 database:
npx wrangler d1 execute taichi-db --file=./schema.sqlSet the ADMIN_SECRET for production:
npx wrangler secret put ADMIN_SECRET
# Enter a secure password when promptedDeploy your Worker to the edge:
npx wrangler deploySuccess: You should see your deployed URL (e.g., https://taichi-ni-agent.your-subdomain.workers.dev).
Use the verify_prod.sh script (created in the next step) or curl commands to verify your deployment.