Every step between an empty Cloudflare account and an agent on your own server that opens a pull request, in order, with what each one needs. self-hosting.md has the details of each setting; this page is the route through them.
What was tried. One rehearsal, on 2026-11-15, in an empty Cloudflare account whose plan was not noted: the button’s deploy, signing up, a workspace, a model key, an agent and one chat. The two times below are from it. Everything else on this page is from the code, these docs and Cloudflare’s documentation, and is marked not tried: nobody has yet walked steps 3 to 6 on a fresh self-hosted server and written down what happened.
| Step | Needs | Tried | Time |
|---|---|---|---|
| 1. Deploy | A Cloudflare account, a GitHub or GitLab account | Yes | About 67 s |
| 2. A first chat | A model provider’s API key | Yes | Under a minute |
| 3. Connect GitHub | A GitHub account or organization where you may create an App | Not tried | Not timed |
| 4. Turn sandboxes on | Workers Paid; a machine with Docker, Node.js and pnpm | Not tried | Not timed |
| 5. A pull request | Steps 1 to 4 | Not tried | Not timed |
| 6. From an issue | A Gateweave Track server, steps 1 to 4 | Not tried | Not timed |
What Cloudflare’s plans say
Section titled “What Cloudflare’s plans say”What Agents uses, and what Cloudflare’s documentation states about each. Whether a server stays within the Free plan’s limits in daily use has not been tried.
- Containers need Workers Paid. A sandbox is a Cloudflare Container, which Cloudflare bills as part of the Workers Paid plan; its Free column has no allowance. So an agent that edits code (steps 4 to 6) needs the Paid plan, and your account pays for the time sandboxes run. Sandboxes has the price and the limits you can set.
- The rest exists on Workers Free. Durable Objects with SQLite storage (pricing), D1 (pricing), Workflows and Cron Triggers (limits) are all offered on the Free plan, each with daily or per-account limits. When D1’s daily limit is reached, its queries fail until the next day.
- The Free plan gives a request 10 ms of CPU time. The same limits page says that “heavier workloads that handle authentication, server-side rendering, or parse large payloads typically use 10-20 ms”. Agents signs people in and renders its pages on the server, so some of its requests may go over on Free. The Paid plan’s limit is 30 seconds by default. The Free plan also stops at 100,000 requests a day and 50 subrequests per request.
- Not tried on a Free account: scanning repositories, applying a setup, teams of agents, and the Workflow that writes a repository’s wiki. The rehearsal’s deploy, sign-up and chat worked, on an account whose plan was not noted.
Docker comes in at step 4, and only there: a deploy that includes sandboxes builds their
image from sandbox/Dockerfile on the machine that deploys.
Model usage is never on your Cloudflare bill. It goes to the provider whose key the workspace adds.
1. Deploy
Section titled “1. Deploy”Needs a Cloudflare account, and a GitHub or GitLab account for your copy of the repository. About 67 s from submitting the form to a Worker that answers.
On the form, choose + Create new for the D1 database, and for BETTER_AUTH_SECRET paste a
generated value, such as the output of openssl rand -base64 32, not something you type. Keep a
copy of it. Deploy with the button explains every
field.
Nothing has to be set after the build to try the next step. The server signs sessions with that
secret and, until you give it a SECRETS_KEY, also encrypts the keys workspaces store under a
key made from it. A secret that is short or plainly not random is refused for that, and the
Models page then says so. For anything beyond a first try, set a SECRETS_KEY before you store
a key: The key that encrypts workspaces’ secrets
says why and how. The rehearsal ran on the version before this one, where a SECRETS_KEY had
to be added by hand first: a first chat without one is covered by the tests and has not been
tried on Cloudflare.
To deploy from the command line instead, see Deploy from the command line. That was not tried in the rehearsal.
2. A first chat
Section titled “2. A first chat”Needs an API key from Anthropic, OpenAI or Google. Under a minute from the Worker’s address to an agent’s first answer.
- Open the Worker’s address and create an account. The first account runs the server; close sign-up to others when you are ready (Who may sign up).
- Create a workspace.
- Under Settings > Models, add the provider’s key.
- Under Agents, make an agent with a model of that provider, and send it a message.
The answer is a run, with its trace and estimated cost under Runs. This agent has no sandbox and no repository: it can talk and use MCP servers, not edit code.
3. Connect GitHub
Section titled “3. Connect GitHub”Needs a GitHub account or organization where you may create a GitHub App, and admin rights on the account whose repositories you connect. Not tried in the rehearsal.
Each server has a GitHub App of its own, because the app’s addresses point at that server. github-app.md has the steps:
- Open the prefilled link with your server’s address in it. On GitHub’s form, check the name, paste a webhook secret you generate, and create the app.
- Note the App ID, the Client ID and the slug, generate a client secret, and generate a private key.
- Give the server the six
GITHUB_APP_*settings as secrets: in the dashboard under Workers & Pages › your Worker › Settings › Variables and Secrets, or withpnpm wrangler secret putfrom a checkout of your copy. - In the workspace, choose Settings > GitHub, then Connect GitHub, and pick the repositories on GitHub.
From here the workspace lists the coding agents set up in those repositories, and applying a setup opens a pull request. That one needs no sandbox, and so no Containers. It carries the setup’s files, not an agent’s work. Neither was tried on a Free account.
GitLab connects with an access token under Settings > GitLab and needs nothing on the server, but agents cannot open merge requests on GitLab yet. For a pull request, use GitHub.
4. Turn sandboxes on
Section titled “4. Turn sandboxes on”Needs the Workers Paid plan, and a machine with Docker running, Node.js 24 (22+ works) and pnpm 12. Not tried in the rehearsal.
-
Clone your copy of the repository and run
pnpm install. -
In
wrangler.jsonc, at the top level, add the sandbox to the Durable Object bindings and add the container, as thestagingenvironment further down the file has them:"durable_objects": {"bindings": [{ "name": "REGISTRY", "class_name": "RegistryDO" },{ "name": "CONVERSATIONS", "class_name": "ConversationAgent" },{ "name": "RATE_LIMITER", "class_name": "RateLimiter" },{ "name": "SANDBOX", "class_name": "RunnerSandbox" },{ "name": "SANDBOX_METER", "class_name": "SandboxMeterDO" }]},"containers": [{"class_name": "RunnerSandbox","scheduling_policy": "durable_object","images": { "sandbox": { "dockerfile": "./sandbox/Dockerfile" } }}], -
Run
pnpm wrangler login, thenpnpm run deploy. It builds the image and deploys. -
Set the limits you want before anyone uses them:
SANDBOX_WORKSPACES,SANDBOX_DAILY_MINUTESandSANDBOX_MONTHLY_BUDGET(Sandboxes). Without them, every workspace on the server may use sandboxes, up to three at once each.
If you deployed with the button, your copy also deploys on every push, through Workers Builds.
Commit the change to wrangler.jsonc and push it before anything else is pushed: a build of the
repository without it deploys a Worker with no sandbox, and sandbox turns stop until the next
deploy that has it. Whether the builder can build the sandbox image was not tried. A build that
fails there deploys nothing, so the Worker stays as your machine’s deploy left it; if it does
fail, turn automatic deploys off for the Worker (Settings › Builds) and go on deploying from your
machine as above.
5. A pull request
Section titled “5. A pull request”Needs steps 1 to 4, with the GitHub App installed on the repository. Not tried in the rehearsal.
- Edit the agent from step 2, or make another: give it a sandbox, and under Repository choose the one it works in.
- Start a conversation and ask for a change.
- The agent works in a checkout of the repository in its sandbox, on a branch of its own, and
opens the pull request with its
open_pull_requesttool. The run links to it.
The commits are by your GitHub App’s bot account. The agent never writes to the default branch, and the repository’s token never enters the sandbox (Sandboxes).
6. From an issue (optional)
Section titled “6. From an issue (optional)”Needs a Gateweave Track server that yours can reach, and steps 1 to 4. Not tried on a self-hosted pair.
Track is not needed for a pull request. It is what turns “assign an issue” into one:
- Deploy Track, with its own Deploy to Cloudflare button, and create a workspace and a team there.
- In Agents, under Agents, choose Set up next to Work on Track issues, then Connect Track, and approve in Track. track-work.md has each screen.
- Assign the agent an issue in Track.
Two Workers on workers.dev cannot reach each other, as
self-hosting.md notes for sign-in
providers. Agents and Track call each other, so give each a custom domain, or add
global_fetch_strictly_public to compatibility_flags in both. This pairing was not rehearsed.
No self-hosted run has been timed. The one figure there is comes from Gateweave Cloud, not from a server set up by these steps: in one recorded run there, the agent’s pull request was open 3 minutes 45 seconds after the issue was assigned. The README links the recording and the pull request. It is one agent’s working time on one issue, not a setup time.
What is still done by hand
Section titled “What is still done by hand”- The GitHub App: a form on GitHub, a webhook secret, a private key and six settings (step 3).
- Sandboxes: the Paid plan, an edit to
wrangler.jsoncand a deploy with Docker (step 4). - Track: a second deploy, and addresses the two servers can reach each other on (step 6).