Atomic functions
The atomic section sets the function runtime limits. You usually don't list
functions at all: drop your handlers into atomic/ as flat source files and the CLI
auto-discovers every @atomic function (that flat set is the default
element, one language, one backend). A function's URL, method, and
authentication come from a one-line directive at the top of its source, never from here:
# @atomic http=post:submit auth=none # an HTTP endpoint
# @atomic http=get:status/:token auth=none # with a path parameter
# @atomic queue=validate auth=none # triggered by a queue messageThe limits below apply to every function in the slice. There is no per-function override.
- Type
- size (
MB/GB) - Default
32MB- Meaning
- Max memory per invocation; exceed it and the invocation is OOM-killed. Bounded to 32MB–256MB, and the resolved value is what you're billed.
- Type
- size (
KB/MB/GB) - Default
- platform default
- Meaning
- Total disk across all deployed functions: their code and the dependencies they vendor, which in practice is your dependency tree. A deploy that would exceed it is refused. Billed as the Atomic storage line.
- Type
- duration (
s/m/h) - Default
- platform default
- Meaning
- Max wall-clock time per invocation before it's killed.
- Type
- rate (
N/s,N/min,N/h) - Default
- platform default
- Meaning
- Max invocations across the whole slice per window. Excess requests get
429.
- Type
- integer
- Default
- platform default
- Meaning
- How many past deploys are kept per function for rollback (
drift atomic rollback). Higher means more restore points, more storage.
- Type
- map
- Default
{ mode: open }- Meaning
- Outbound network posture; see Outbound egress.
- Type
- string | map (optional)
- Default
- auto-discovered
- Meaning
- Usually omitted, because functions are discovered from your flat
atomic/*source. Long form adds a directory, an element, a schedule, or alerts; see below.
function_memory is bounded, not free-form.
function_memory must be between 32MB and 256MB. The ceiling is not a runtime limit in
disguise: a compiled language's own startup floor is a platform-owned allowance added underneath, never
billed, so the number here is your function's working set and nothing else.
The functions[] long form
A bare string is a function name. The map form carries four more keys, and two of them,
cron and alerts, are the only way to put a function on a schedule or
under an alert from the manifest.
- Type
- string
- Default
- required
- Meaning
- The function name. Standard identifier shape.
- Type
- path
- Default
./atomic/<name>- Meaning
- Source directory, relative to the Driftfile.
- Type
- string
- Default
- the flat element
- Meaning
- The sub-app this function belongs to: the group that shares one language, one dependency manifest, one runtime.
- Type
- 5-field cron
- Default
- none
- Meaning
- Run this function on a schedule. The deploy ships a schedule trigger alongside its HTTP route.
- Type
- list of maps
- Default
- none
- Meaning
- Fire a notification when this function errors. Reconciled against the live alert registry on every deploy.
functions:
- nightly-digest # bare name, nothing special
- name: reconcile
element: billing # lives with the other billing functions
cron: "0 3 * * *" # 03:00 daily, 5 POSIX fields
alerts:
- on: errors # errors is the only accepted trigger
threshold: 5 # errors within the window
window: 5m # minimum 60s
notify: webhook=https://hooks.example.com/drift
cron is a 5-field POSIX expression; the parser checks the field count and the scheduler
validates the grammar, so a malformed expression surfaces at deploy. An alert needs
window and notify, and both are errors if missing. threshold
defaults to 1, on to errors, and window must be at
least 60 seconds. The only notify form is webhook=<http(s) URL>.
The reconcile runs both ways: the deploy deletes any live alert the manifest does not declare, so removing an alert from the Driftfile removes it from the slice.
Outbound egress
atomic.egress declares which hosts your functions may reach. It is the source of truth for
the allowlist; drift atomic egress list/refresh/test inspect what the slice has, and there is
no CLI verb to add a host.
atomic:
egress:
mode: allowlist # open (default) | allowlist
hosts:
- api.stripe.com
- "*.amazonaws.com" # accepted, then skipped: name concrete hosts
- smtp.sendgrid.net:587 # host:port; port defaults to 443An allowlist is declared, not yet enforced.
mode says.
Read the Atomic guide → for how to write a function.