Skip to content

Function control-plane protocol

A runner holds function artifacts and answers invocations. The platform decides what a runner should hold (the desired state) and the runner reports what it actually holds (the heartbeat). This page is the wire contract between them. The function side (describe, ABI) is on Function describe document and ABI; the architecture is on Function runners and engines.

The Go runner built into the server, the echo runner, and the ingestor’s JVM function host all speak this protocol. A runner for another runtime implements it and nothing else.

  • Base URL: the platform’s (FC_FUNCTIONS_PLATFORM_URL; when the runner runs in the platform process it is the local API address).
  • Every route requires Authorization: Bearer <token> for a principal holding the platform:function-runner role (permission platform:function:runner:control), minted by the client_credentials grant. The runner re-fetches a token and retries once on a 401.
  • JSON bodies, camelCase. Errors use the standard envelope (see Error codes).
  • The desired document contains secrets. It is served only to the runner role and must never be logged.
Method and path Purpose
GET /control/functions/desired?pool=&wait=&runtimes= The pool’s desired state, long-polled.
POST /control/functions/heartbeat The runner’s report.
GET /control/functions/artifacts/{digest} An artifact: 302 to a presigned storage URL, or the bytes.
POST /control/functions/events Emit an event on a function’s behalf.
POST /control/functions/dispatch-jobs Create a dispatch job on a function’s behalf.
POST /control/functions/token Mint the application’s platform token for a function.
POST /control/functions/trace-log Ship trace records.

GET /control/functions/desired

Query Meaning
pool The function-runner pool the runner serves.
wait Long-poll seconds, at most 60. With If-None-Match set, the platform holds the request until the document changes.
runtimes Comma-separated runtime tags the runner can run (lower case, a letter first, 2 to 16 characters). Only versions of those runtimes are returned, and a function whose versions are all filtered out (with its routes) is omitted. Absent or empty means wasm,js. A malformed list is 400 RUNTIMES_INVALID. Each runtime set has its own ETag.

Request header If-None-Match: <ETag>. Answers: 200 with the document and an ETag (the revision), or 304 when nothing changed. The platform waits on a database notification with a short re-check as fallback, so changes arrive within seconds.

{
"pool": "default",
"revision": 41,
"auth": { "issuer": "https://fc.example.com", "audience": "flowcatalyst" },
"functions": [
{
"id": "fnc_0ABC...",
"address": "orders.invoice-logger",
"applicationId": "app_...",
"clientId": null,
"limits": { "memoryMb": 64, "maxConcurrency": 16, "timeoutMs": 30000, "maxBodyBytes": 1048576 },
"warm": false,
"webhookSecret": "<hex>",
"config": { "GREETING": "hello" },
"secrets": { "PAYMENT_KEY": "..." },
"db": { "main": "postgres://..." },
"trace": [{ "context": "http", "enabledUntilMs": 1789000000000, "sampleRate": 1 }],
"versions": [
{ "number": 7, "digest": "sha256:...", "runtime": "wasm", "abi": 1,
"describe": { "abi": 1, "endpoints": [] }, "roles": ["live", "alias:canary"] }
]
}
],
"routes": [
{ "hostname": "api.example.com", "pathPrefix": "/orders", "address": "orders.api",
"alias": "", "aliasPrefixes": ["canary"] }
]
}
Field Meaning
revision The pool’s revision; also the ETag.
auth The issuer and audience a runner uses to verify platform bearer tokens on auth: platform endpoints.
functions[].address, id, applicationId, clientId Identity.
limits memoryMb, maxConcurrency, timeoutMs, maxBodyBytes.
warm Keep an instance ready rather than loading on first use.
webhookSecret The secret the platform signs this function’s subscription and scheduled-job deliveries with, so the runner verifies exactly what is signed. Empty when no signing account is available yet: an endpoint with auth: webhook then answers 503 WEBHOOK_SECRET_PENDING with Retry-After: 5, not 401, so the delivery is retried.
config, secrets, db Settings values: config strings, secret values, and DSNs by declared database name.
trace Live trace windows: context, enabledUntilMs (unix ms; the runner compares with its own clock), sampleRate (capture one invocation in N).
versions[] number, digest, runtime (wasm or empty, js, jvm), abi, describe (the document), roles.
versions[].roles Why the runner holds it: live, candidate, or alias:<name>.
routes[] Public routes: requests on the runner’s public entry are matched by hostname and pathPrefix (the prefix is stripped before endpoint matching), to a function address at an alias (empty is live). aliasPrefixes opts a route into alias-prefixed hostnames: for each prefix p, host p-<hostname> serves alias p.

The document carries only aliased and PUBLISHED versions: an unaliased READY version is not held.

POST /control/functions/heartbeat, 2xx on success.

{
"runnerId": "runner-1",
"pool": "default",
"startedAt": "2026-11-08T10:00:00Z",
"revision": 41,
"budget": { "compiledBytes": 12345678, "rssBytes": 123456789, "loaded": 4, "evictions": 0 },
"versions": [
{ "functionId": "fnc_...", "number": 7, "state": "LOADED" },
{ "functionId": "fnc_...", "number": 3, "state": "FAILED", "reason": "LOAD:IMPORT_NOT_ALLOWED" }
],
"capabilities": { "protocol": 1, "runtimes": ["wasm", "js"], "runnerKind": "go", "version": "0.16.0", "extra": {} }
}
Field Meaning
revision The desired revision the runner has applied.
budget The runner’s memory picture (plus the allocator’s stats).
versions[].state LOADED (instantiated and answering), COMPILED (checked, no instance yet, lazy), FAILED (reason says why), RETRYING (informational: still preparing, retrying a transient failure; the platform ignores it).
capabilities Optional. protocol (currently 1), runtimes (non-empty valid tags, else 400 CAPABILITIES_INVALID), runnerKind (go, java, echo, ingestor-jvm…), version, extra (runner-specific). A heartbeat without it counts as a wasm,js runner.

The platform marks a PUBLISHED version READY or FAILED from the report. Only a PUBLISHED version changes state, and a FAILED report counts only from a runner whose applied revision is at least the revision at which the version was last re-queued, so a report that predates a reset is ignored. A heartbeat within 60 seconds counts the runner as live.

Promoting a version (PUT /api/functions/{id}/aliases/{name}) whose runtime no live runner of the function’s pool advertises is 409 POOL_LACKS_RUNTIME. For the built-in runtimes the guard applies only once the pool has at least one live runner.

GET /control/functions/artifacts/{digest} returns 302 to a presigned object-store URL, or streams the bytes from the file store. The runner holds no storage credentials (the redirect does not carry its token). It keeps a disk cache by digest and re-verifies the digest on every read. Artifacts are content-addressed by sha256.

These routes carry the function’s id and version. The platform checks each against the version’s describe document, whatever the guest sent.

POST /control/functions/events

{ "functionId": "fnc_...", "version": 7,
"event": { "type": "orders:sales:order:shipped", "dedupId": "ship-1042", "source": "...", "subject": "...",
"correlationId": "...", "causationId": "...", "messageGroup": "...", "contentType": "application/json" },
"data": "<base64>" }

Answer {"eventId": "evn_..."}. The type must be in the version’s emits and owned by the function’s application. The event’s metadata is always an array of {key, value} with the platform’s fn.* provenance entries appended.

POST /control/functions/dispatch-jobs

{ "functionId": "fnc_...", "version": 7, "invocationId": "...", "requestCorrelationId": "...",
"dispatch": { "target": "orders.invoice-logger", "path": "/deliver", "code": "orders:function:invoice:dispatch",
"messageGroup": "...", "mode": "IMMEDIATE", "dataOnly": true, "metadata": [{"key": "k", "value": "v"}] },
"payload": "<base64>" }

Answer 201 {"jobId": "djb_..."}. The (target, path) pair must equal a dispatches entry; the pool and connection come from the declaration. The platform checks the target’s ownership and the usual dispatch-job rules (see Dispatch jobs). A job’s connectionId is set, so pausing the connection holds it and the connection’s service account signs the delivery.

A function may sign only as its own application or as its own service account. The platform checks this for the connection each declaration names, when the version is published and again on every call. If the connection’s service account belongs to another application, or to no application (a shared account) and is not the function’s own, the call is refused 403 DISPATCH_SIGNER_NOT_ALLOWED and no job is written. At publish, a declaration whose connection exists and fails this check refuses the whole version, and nothing is stored; a connection that does not exist yet is checked on the first call. A connection that names no service account, or one that no longer exists, is not refused here: the delivery is declined later with that reason. A connection that is not visible to the function (another application’s or another client’s) is 404 CONNECTION_NOT_FOUND, so codes cannot be enumerated across tenants.

POST /control/functions/token with {"functionId", "version"}. Answer 200 {"accessToken", "tokenType": "Bearer", "expiresIn"}: the access token of the service account linked to the function’s application, the same bearer its client_credentials grant gives, for a version whose describe declares platformToken: true. Runner role and anchor scope. Every mint is audited (TOKEN_MINTED_FOR_FUNCTION); the token is a live credential and is never logged.

Refusal Meaning
400 FUNCTION_ID_REQUIRED
404 Function or version not found.
403 PLATFORM_TOKEN_NOT_DECLARED The version’s describe does not declare it.
409 APPLICATION_SERVICE_ACCOUNT_REQUIRED The application has no linked service account.
400 SERVICE_ACCOUNT_INACTIVE

A runner maps these for the guest: 5xx, 429, 408 and a 401 that outlived the retry are UNAVAILABLE (retryable); every other 4xx is NOT_ALLOWED carrying the platform’s code.

POST /control/functions/trace-log

{ "runnerId": "runner-1", "pool": "default",
"records": [{ "id": "<uuid>", "at": 1789000000123, "address": "orders.api", "version": 7,
"invocationId": "...", "correlationId": "...", "reference": "order-1042",
"context": "http", "kind": "http", "level": "info", "message": "...", "data": {} }] }

Answer 202 {"accepted": n, "dropped": n}.

Rule Value
Batch limits At most 500 records and 1 MiB.
Rate Per function, 200 records/second per platform process (an in-memory bucket each, so N replicas take up to N times that).
Window A record is taken only while its (function, context) window is live, plus 10 s. Switching off sets the window’s end to the switch-off time, so records captured just before are still taken.
Clock A record’s at more than a minute ahead of arrival is clamped to arrival; more than an hour behind is dropped. Retention counts from the platform’s created_at.
Idempotency A record may carry id (the runner’s UUID, the same on every retry); the platform stores it once (ftl_r<id>). Without one, the platform assigns an id.
Unknown fields Accepted at every depth, so a newer runner may add them.
Sizes Message cut at 4096 characters; trace record data at most 32 768 bytes; an http record’s data at most 65 536.

kind is trace (written by the function), http (the built-in request/response capture), log (stdout/stderr and log calls during an http-live invocation) or outbound (a call the function made, recorded by the JVM host). An http record’s data is {request, response, durationMs, outcome} with outcome ok, timeout, trap, out_of_memory, bad_response, busy or error. Readers without platform:function:trace:view-bodies see records with redacted: true and bodies removed.

Delivery URLs for subscriptions, scheduled jobs and function dispatch point at the runner’s invocation route, /fn/{address}{path}, on FC_FUNCTIONS_RUNNER_URL (or FC_FUNCTIONS_RUNNER_URL_<RT> for a version’s runtime) with {pool} substituted. Deliveries are signed with the function’s webhook secret; see Delivery and webhook signatures.

All additions to the protocol are additive. A runner that predates runtimes, capabilities, token or trace-log keeps working unchanged: it is treated as a wasm,js runner and never receives a version it cannot run. Unknown fields in the desired document must be ignored. See The function stability promise.