Gateway architecture
How a workspace request reaches its sandbox, and which service owns each responsibility.
- Your clientSDK, HTTP client or dashboard
- Edge gatewayAuthenticate and select a host
- Host agentAuthorize and manage the runtime
- SandboxRun the assigned workload
Two ways to reach the same workspace#
An SDK or HTTP client calls the public gateway at https://api.runtabs.dev with a workspace API key. A browser uses its account session to call the website backend; that backend forwards authorized workspace requests to the gateway. The dashboard and SDK should see the same workspace's sandboxes.
The Cloudflare Worker handles management requests at the edge. Sandbox execution happens on registered compute hosts. Deploying the Worker does not create regional compute or move existing workloads closer to a caller.
Responsibilities and credentials#
| Component | Responsibility | Credential boundary |
|---|---|---|
| Account backend | Sign-in, verified account sessions and workspace access. | Account session and CSRF proof. |
| Gateway | Workspace authorization, placement and pinned lifecycle routing. | Workspace API key. |
| Fleet coordinator | Host registry, heartbeat freshness, reservations and provisioning demand. | Operator enrollment and host reporting credentials. |
| Host agent | Local quotas, approved templates, ownership and runtime operations. | Separate host service credential. |
| Sandbox | The guest workload and its configured access profile. | Management credentials are not guest login credentials. |
What is a Durable Object?#
A Cloudflare Durable Object is a server-side object with an identity, code and durable storage. This gateway uses a fleet object for shared registration and admission state, plus workspace objects for operation routing and idempotency records. These are control-plane services, not the sandbox VMs.
The fleet coordinator serializes capacity reservations across workspaces so simultaneous creates cannot independently consume the same reported free slot. Workspace operation records preserve the selected host and result across coordinator restarts. Durable records do not establish that a guest or its memory survived a host failure.
Placement is admission plus routing#
A create first checks authorized hosts, fresh healthy reports, approved templates and capacity. Eligible placement can use edge-to-host probes, with geographic fallback. A capacity reservation is made before forwarding the create to the host. The host independently checks its quotas.
Keep the same idempotency key after an uncertain response. Its existing host binding remains authoritative; the gateway does not silently move that create to a different host. See regions and placement and API idempotency.
Why one host can fail while the gateway is healthy#
The public gateway can answer health and authenticated contract requests while a host agent, its HTTPS tunnel or its runtime is unavailable. Workspace calls that require that host may fail even though the Worker is running. An aggregate capacity read may also fail instead of silently omitting a host.
Distinguish gateway liveness, fresh node heartbeats, authenticated management reachability, image readiness and guest access. Each check establishes a different fact. See the host operations runbook.
Growth and recovery boundaries#
New hosts require operator enrollment and correct workspace assignment. Provisioning demand is a durable request for capacity; it is not proof that a provider VM was purchased or booted. Existing sandbox IDs remain pinned to their host.
The current compatibility path does not provide verified migration, portable snapshots, native fork or general host-restart recovery. Do not infer those capabilities from durable control-plane storage.
