WolfFunctions are cluster-scoped, Lambda-style functions. Definitions replicate to all peers in the cluster, and any node can accept an invocation. The cluster leader manages warm instances and schedules.
Runtimes
- Python 3.12: Use
def handler(event, context) - Node 22: Use
exports.handler = async (event, context)
Execution & Sandbox
- Sandbox: Uses gVisor
runsc by default (auto-downloaded and verified). A Docker fallback is available via local.json configuration (ExecutionMode set to Docker), though gVisor is the primary isolation method. - Placement: Controlled by
replicas (number of nodes keeping warm copies; default 2) and max_per_node (burst instances per node; default 4). Instances are reaped after 300s of idleness.
Triggers
- Public URL: Accessible via
/fn/{slug} (requires opt-in; rate-limited to 60/min/node). - Schedules: Interval-based triggers (minimum 60s interval).
- Internal Events: Triggered by system events like
alert_fired, node_offline, backup_completed, container_failover, etc.
API Semantics
Public /fn/{slug} endpoints use AWS Lambda proxy-integration semantics. The handler should return an object with:
statusCodeheadersbodyisBase64Encoded
If any other value is returned, it is JSON-encoded with a 200 status code. The event object contains {trigger: "http", method, query, body, source_ip}.
// Node 22 Example
exports.handler = async (event, context) => {
return {
statusCode: 200,
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ message: 'Hello from WolfFunction!' }),
isBase64Encoded: false
};
};