Skip to content

Function describe document and ABI

A function is first-party code run by the platform. Its describe document states what it needs: which paths it answers and how callers authenticate, which events it subscribes to, which schedules fire it, and which capabilities (config, secrets, databases, outbound hosts, events, dispatch) it uses. Publishing a version reads and validates the document; promoting the version to live makes the platform match it. Concepts are on Functions; what is frozen for function authors is on The function stability promise; the runner protocol is on Function control-plane protocol.

Concept Definition
Function Owned by an application (optionally a client). Its identity is the address {applicationCode}.{name}; name matches ^[a-z][a-z0-9-]{0,62}$. The address is immutable and unique.
Version An immutable artifact (identified by its sha256 digest) plus its describe document, numbered 1, 2, 3 per function. Status PUBLISHED, then READY (a runner loaded it) or FAILED; later RETIRED.
Alias A named pointer to a version. live drives wiring (subscriptions, schedules); other names (canary, qa) are HTTP-only.
Runtime wasm (an ABI v1 module), js (a script on the shared JS engine) or jvm (a jar run by the ingestor’s function host).

Publish validates; promote materialises. Publishing creates nothing but the version. Promoting a READY version to live reconciles the platform objects to match the describe document in one transaction: subscriptions and scheduled jobs owned by the function are created, updated or deleted, and the function’s dispatch pool is created if missing. Promote refuses when a declared config or secret key or database binding has no value (SETTINGS_MISSING).

Decoded strictly: an unknown key is an error, and every problem is reported together.

{
"abi": 1,
"endpoints": [
{"method": "POST", "path": "/events/order-created", "auth": "webhook"},
{"method": "GET", "path": "/api/orders/{id}", "auth": "platform",
"cors": {"origins": ["https://app.example.com"]}},
{"path": "/healthz", "auth": "none", "maxBodyBytes": 0}
],
"subscriptions": [
{"eventType": "orders:sales:order:created", "path": "/events/order-created",
"mode": "IMMEDIATE", "maxRetries": 3, "dataOnly": false}
],
"schedules": [{"cron": "0 */5 * * * *", "timezone": "UTC", "path": "/events/tick"}],
"config": ["GREETING"],
"secrets": ["PAYMENT_KEY"],
"db": ["main"],
"httpAllow": ["api.example.com", "*.example.net"],
"emits": ["orders:sales:order:shipped"],
"dispatches": [{"target": "orders.invoice-logger", "path": "/deliver",
"connection": "billing-conn", "pool": "billing-pool"}],
"platformToken": true,
"traceContexts": [{"name": "pricing", "description": "price rule evaluation"}]
}
Field Type Rules
abi integer Must be 1.
endpoints array At least one.
subscriptions array Event types delivered to a webhook endpoint.
schedules array Cron firings delivered to a webhook endpoint.
config string[] Declared config keys. Key pattern ^[A-Za-z][A-Za-z0-9_./-]{0,99}$, no duplicates.
secrets string[] Declared secret keys; same pattern. Secret values are write-only.
db string[] Declared database names, ^[a-z][a-z0-9_-]{0,62}$. Each is bound to a DSN held in a secret.
httpAllow string[] Outbound hosts the function may call. A host name with an optional port; *. wildcard prefix allowed. IP addresses, loopback names, and wildcards with fewer than two labels after *. are refused.
emits string[] Event types the function may emit. Each is a four-segment type (app:domain:aggregate:event) whose application is the function’s own (checked at publish).
dispatches array Dispatch targets the function may create jobs for.
platformToken boolean true declares the platform-token capability. Any other JSON type is refused.
traceContexts array Named trace points. At most 20.
jvm object Present only in a jvm-runtime describe: {"entrypoint": "<Java binary class name>"}.
Field Rules
method Optional upper-case HTTP method (3 to 10 letters). A webhook endpoint accepts POST only.
path Must start with /. Uses Go ServeMux pattern syntax: {id}, {rest...}. Patterns are matched with Go’s own router, so precedence, conflicts and the 404/405 split are Go’s.
auth Required: webhook, platform or none. There is no default.
maxBodyBytes Optional, not negative. Defaults to the function’s limit.
timeoutMs Optional, positive; at most the function’s own limit.
cors Optional {origins[] (required), methods[], headers[], allowCredentials}. allowCredentials cannot combine with origin *.

The three auth modes decide how the runner authenticates the caller:

auth Caller What the runner checks
webhook The platform delivering a subscription, schedule or dispatch The HMAC signature, with the secret the platform signs this function’s deliveries with. See Delivery and webhook signatures. Caller kind webhook.
platform A caller holding a platform access token The bearer token against the platform’s issuer and audience. Caller kind principal, with verified claims.
none Anyone Nothing. Caller kind anonymous.
Field Rules
eventType Four colon-separated non-empty segments.
path A literal path that a POST reaches on an endpoint whose auth is webhook.
mode IMMEDIATE, NEXT_ON_ERROR or BLOCK_ON_ERROR. Omitted means the platform default, NEXT_ON_ERROR. A function that wants IMMEDIATE says so.
maxRetries, timeoutSeconds Optional; maxRetries not negative, timeoutSeconds positive.
dataOnly Optional boolean.

cron (required; six fields with seconds first, see Cron syntax), optional timezone, path (a literal path reaching a webhook endpoint), optional JSON payload. Cron syntax is checked by publish, not by the strict decode.

{target, path, connection, pool?} and nothing else.

Field Rules
target A function address (application.name) in the same application (publish refuses another application’s: DISPATCH_NOT_OWNED).
path A literal absolute path: no pattern, query, fragment, escape, empty or dot segment.
connection Required. A connection code (^[a-z][a-z0-9-]{0,99}$). The job carries it, so pausing the connection holds the job, and the connection’s service account signs the delivery.
pool Optional dispatch pool code (^[a-z][a-z0-9_-]{0,99}$), the rate and concurrency pool for the job. Absent means the client’s default pool.

A (target, path) pair is declared once. Whether the target exists, is live and accepts a signed POST at that path is checked per call, not at publish, because the target may be deployed after its creator. The pool and connection are named by the declaration and never by the call: the guest cannot choose them at run time.

{name, description?}. name matches ^[a-z][a-z0-9-]{0,39}$; http is built in and cannot be declared; description at most 200 characters; names are unique. An operator switches each context on for a bounded time.

Defaults for a new function, adjustable per function up to platform ceilings:

Limit Default
memoryMb (per instance) 64
maxConcurrency (per function per runner) 16
timeoutMs 30 000 (an endpoint may lower it)
maxBodyBytes 1 MiB (per endpoint)

A wasm module talks to the runner through a small fixed ABI. Everything here is frozen for ABI v1; additions are made as new ops that older runners answer with UNKNOWN_OP.

Export Signature Contract
memory memory The guest’s linear memory. Exactly one.
fc_abi_v1 () -> () Marker. Its presence declares ABI v1; a module without a known marker is refused (LOAD:ABI_UNKNOWN).
fc_alloc (size i32) -> ptr i32 Allocate size bytes for the host to write into. The guest owns and frees them.
fc_handle (ptr i32, len i32) -> i64 Handle one request frame. Returns ptr<<32 | len of a response frame, valid until the next call into the guest.
fc_describe () -> i64 Returns ptr<<32 | len of the describe JSON. Must not depend on any host call.
_initialize () -> () (optional) The wasip1 reactor initialiser, called once per instance before anything else.

The only allowed import modules are fc and wasi_snapshot_preview1; any other import refuses the module (LOAD:IMPORT_NOT_ALLOWED). WASI has no preopened directories, empty args and environment, the real clock, crypto random, and stdout/stderr routed to the function’s log.

Import Signature Contract
fc.call (op i32, ptr i32, len i32) -> i64 Run capability op with the request frame at ptr/len. Returns code<<32 | resultLen; code 0 is success, otherwise an error code. The result frame (or an error frame {"code","message"}) is buffered host-side.
fc.take (dst i32) -> () Copy the buffered result into guest memory at dst; the guest has allocated resultLen bytes. Clears the buffer.

Two calls instead of the host calling fc_alloc avoid re-entrancy and keep the host independent of the guest’s allocator.

Every payload in both directions uses one layout, so bodies are never base64-encoded:

u32 little-endian metaLen
metaLen bytes meta (UTF-8 JSON)
remaining bytes body (raw)

Request meta (what fc_handle receives): id, address, version, method, path, rawQuery, headers ({name: [values]}), route (the matched endpoint pattern), pathParams, caller, deadlineUnixMs, and optionally host, remoteAddr, public (true for calls through the public entry).

caller is one of:

  • {"kind":"webhook"}: signature verified;
  • {"kind":"anonymous"};
  • {"kind":"principal","id","type","tier","clients","clientCodes","roles","applications","allApplications","permissions"}: verified token claims. email and name are withheld. clients holds client ids; clientCodes is the parallel list of client identifiers (["*"] for anchors).

Response meta: {"status": <int>, "headers": {name: [values]}}. A function’s terminal “do not retry” answer to a delivery is 422 with the header FlowCatalyst-Outcome: reject (see Delivery).

Op Name Request meta / body Result meta / body
1 log {level, msg, attrs} none
2 config.get {key} {found} / value
3 secret.get {key} {found} / value
4 http.fetch {method, url, headers, timeoutMs} / body {status, headers} / body
5 event.emit {type, source, subject, dedupId, correlationId, causationId, messageGroup, contentType} / data {eventId}
6 db.query {db, sql, params, tx} {truncated} / rows JSON (array of objects, keys in select order)
7 db.exec same {rowsAffected}
8 db.begin {db} {tx}
9 db.commit {tx} none
10 db.rollback {tx} none
11 dispatch.create {target, path, code?, subject?, metadata?[{key,value}], messageGroup?, mode?, correlationId?, causationId?, contentType?, descriptor?, maxRetries?, timeoutSeconds?, dataOnly?} / payload {jobId}
12 trace {context, level?, msg, data?, reference?} empty success
13 tracing {context} {live}
14 trace.reference {reference} empty success
15 platform.token {refresh?} (may be empty) {accessToken, expiresAt} (unix ms, host clock)

Notes:

  • http.fetch reaches only hosts in httpAllow; the runner also blocks loopback and private destinations. event.emit accepts only types in emits. dispatch.create needs target and path to equal one dispatches entry; dataOnly defaults to true (the target is a function, which wants the data, not an envelope); the job’s default code is {application}:function:{name}:dispatch; metadata is always an array of {key, value}. platform.token returns the token of the service account linked to the function’s application; it is a live credential and is never logged.
  • Ops 11 to 15 are additive. A runner that predates one answers UNKNOWN_OP; SDKs treat that as “not available” (tracing is simply off).
  • Trace limits: message 4096 bytes, data 32 768 bytes encoded, reference 200 characters.

A capability failure is always one of these, never a trap.

Code Meaning
NOT_DECLARED The capability or value was not declared in describe.
NOT_ALLOWED Outside the allowlist, an event type not owned, or a dispatch the platform refuses.
DEADLINE The invocation’s deadline passed.
TOO_LARGE A size limit was exceeded.
UNAVAILABLE Retryable.
BAD_REQUEST Malformed request frame.
CAPABILITY_UNAVAILABLE Describe-time: the runner does not provide it.
UNKNOWN_OP The runner does not know the op.
DB_CONSTRAINT, DB_SYNTAX, DB_TIMEOUT, DB_UNAVAILABLE, DB_ERROR, DB_TX_UNKNOWN Database failures, classed from the SQLSTATE.
  • js: a script run on the shared JS engine. It gets the same describe document, request frame and capabilities through the SDK.
  • jvm: a jar (zip magic). Its describe document is read, without executing anything, from the entry META-INF/flowcatalyst/function.json (at most 1 MiB uncompressed, at most 50 000 entries): the ordinary describe plus jvm: {entrypoint}, the class implementing the function interface. A jar without the entry, with an invalid document or no jvm.entrypoint is refused; a jvm block in a non-jar artifact is refused. Whether a function is JVM is fixed by its first version (409 RUNTIME_MISMATCH otherwise; wasm and js may follow each other).

After each publish the function keeps at most FC_FUNCTIONS_KEEP_VERSIONS (default 20) untagged versions; older ones are deleted for good, along with their artifact when no remaining version of any function shares the digest. A version an alias points at is never pruned. The function’s highest-numbered version and a PUBLISHED version younger than one hour are also kept. Version numbers are never reused.