Documentation/docs/function

#Functions

Sandbox0 Functions publish a Sandbox Service behind a stable function domain. A function keeps its identity, slug, and host across revisions, so callers can keep using the same URL while you publish new sandbox-backed code.

Functions are created from Sandbox Services, not from uploaded ZIP files or container images. Publish starts from a sandbox_id and service_id; Sandbox0 snapshots the service configuration and restore mounts into an immutable revision.

Model#

ObjectDescription
Sandbox ServiceA named port, ingress routes, and restartable runtime inside a sandbox
FunctionStable function identity, slug, and host under the configured function domain
RevisionImmutable snapshot of the source service plus the SandboxVolume restore mounts needed to restore it
AliasMutable pointer from a name such as production to a revision
RuntimeRestored sandbox and process context currently serving a function revision, when the source sandbox is gone

The production alias is the serving pointer used by the function host. Creating a function creates revision 1 and points production at it. Creating another revision can either promote it immediately or leave it available for a later alias update.

How Serving Works#

Function traffic is handled by function-gateway. The gateway resolves the host to a function, loads the production revision, enforces the revision's service route policy, and proxies the request to the service port.

If the source sandbox still exists, the gateway routes to that sandbox and resumes it when needed. If the source sandbox has been deleted, the gateway claims a new runtime sandbox from the revision's template, mounts the revision-owned volumes, starts the service runtime command or binds to the referenced warm process, and reuses that runtime for later requests.

Publishable Services#

Only publishable Sandbox Services can become function revisions. A service is publishable when it is public and has a restartable runtime:

BlockerMeaning
not_publicThe service does not expose public ingress routes
missing_runtimeThe service has no restartable runtime
manual_runtimeThe service runtime is manual and cannot be started by Function Gateway
missing_commandA cmd runtime is missing its command
missing_warm_process_nameA warm_process runtime is missing its warm process name

For Functions, a warm_process runtime must reference an existing cmd warm process alias or context ID. REPL warm processes are interactive execution contexts and cannot serve HTTP traffic.

Use Sandbox Services route policy for path matching, allowed methods, bearer/header auth, CORS, rate limits, path rewrite, and upstream timeout. Functions reuse the same route model.

Next Steps#

Publish Functions

Configure a publishable service and create a function from it.

Revisions And Aliases

Publish new revisions, promote them, and roll back with aliases.

Runtime

Inspect, restart, disable, and delete function runtimes.