# Cloudflare Workers Serverless JavaScript modules on Cloudflare's global edge. Create a worker with POST, deploy code with PUT — instant deploy, no git needed. Supports cron triggers. ## Prerequisites Provision this resource before use. Edge requests without provisioning will error. ### Provision curl -s -X POST https://cohesivity.ai/api/resources/cloudflare-workers \ -H "Authorization: Bearer " ### Delete curl -s -X DELETE https://cohesivity.ai/api/resources/cloudflare-workers \ -H "Authorization: Bearer " **Important:** Provision this resource now, before building or running the application. Provisioning is the agent's job, not the application's. ## Worker Management All endpoints require `Authorization: Bearer ` header. - **List workers:** `GET https://cohesivity.ai/api/workers` - **Create worker:** `POST https://cohesivity.ai/api/workers` with `{ "name": "my-worker" }` - **Worker status:** `GET https://cohesivity.ai/api/workers/:name` - **Deploy code:** `PUT https://cohesivity.ai/api/workers/:name` with `{ "code": "...", "cron": "*/5 * * * *" }` - **Delete worker:** `DELETE https://cohesivity.ai/api/workers/:name` ## Examples **Create:** curl -s -X POST https://cohesivity.ai/api/workers \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{"name":"my-worker"}' **Deploy:** curl -s -X PUT https://cohesivity.ai/api/workers/my-worker \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{"code":"export default { async fetch(request) { return new Response(\\"Hello!\\"); } };"}' ## Writing Worker Code Use ES module syntax (Cloudflare Workers V8 runtime): ``` export default { async fetch(request) { return new Response("Hello from my worker!"); }, async scheduled(event, env, ctx) { // Handle cron triggers }, }; ``` Worker names: 2-50 chars, lowercase alphanumeric + hyphens, must start/end with alphanumeric. ## Limits - Worker inventory, deploys, and cron schedules are governed by the Launch Rate Limits section below. - Runtime request analytics are not a published hard cap at launch; Cohesivity will document them when the poller is in the enforcement path. ## Launch Rate Limits Ephemeral tenants pause as a whole if any authoritative hard cap below is exceeded. Claimed tiers use account-scoped buckets shared across every project owned by the Cohesivity user; OpenAI, Deepgram, and Exa are fluid-only after tier, rate, and concurrency checks; Deepgram has no fixed monthly usage bucket for claimed tiers. **Ephemeral** - workers: 3 max total - deploys: 10 per ephemeral tenant lifetime before claim or expiry - cron schedules: 3 max total - deploys: 3 per minute **Claimed Free** - workers: 10 max total - cron schedules: 5 max total - deploys: 3 per minute - deploys: 30 per month **Claimed Plus** - workers: 30 max total - cron schedules: 20 max total - deploys: 10 per minute - deploys: 100 per month **Claimed Pro** - workers: 100 max total - cron schedules: 100 max total - deploys: 10 per minute - deploys: 300 per month ### Notes - Launch hard caps cover worker inventory, deploys, and cron schedules. Tenant-worker runtime traffic is not yet published as a per-tier hard cap because that analytics poller is not in the launch path yet.