Registers functions and triggers on the iii engine across TypeScript, Python, and Rust. Use when creating workers, registering function handlers, binding triggers, or invoking functions across languages.
Comparable to: Serverless function runtimes, Lambda, Cloud Functions
Use the concepts below when they fit the task. Not every worker needs all of them.
trigger() regardless of language or worker locationschemars::JsonSchema) and Python (via type hints / Pydantic), or manually provided in Node.jsregisterWorker() connects the worker to the engine, defines handlers, binds event sources to those handlers, and the engine routes incoming events to the correct function. Functions can invoke other functions across workers and languages via .
registerFunctionregisterTriggertrigger()| Primitive | Purpose |
|---|---|
registerWorker(url, options?) | Connect worker to engine |
registerFunction(id, handler) | Define a function handler |
registerTrigger({ type, function_id, config, metadata? }) | Bind an event source to a function |
trigger({ function_id, payload }) | Invoke a function synchronously |
trigger({ ..., action: TriggerAction.Void() }) | Fire-and-forget invocation |
trigger({ ..., action: TriggerAction.Enqueue({ queue }) }) | Durable async invocation via queue |
Each reference shows the same patterns (function registration, trigger binding, cross-function invocation) in its respective language.
Code using this pattern commonly includes, when relevant:
registerWorker('ws://localhost:49134', { workerName: 'my-worker' }) — connect to the engineregisterFunction('namespace::name', async (input) => { ... }) — register a handlerregisterTrigger({ type: 'http', function_id, config: { api_path, http_method, middleware_function_ids? } }) — HTTP trigger (with optional middleware)registerTrigger({ type: 'durable:subscriber', function_id, config: { topic } }) — queue triggerregisterTrigger({ type: 'cron', function_id, config: { expression } }) — cron triggerregisterTrigger({ type: 'state', function_id, config: { scope, key } }) — state change triggerregisterTrigger({ type: 'stream', function_id, config: { stream } }) — stream triggerregisterTrigger({ type: 'subscribe', function_id, config: { topic } }) — pubsub subscriberregisterTrigger({ ..., metadata: { owner: 'team', priority: 'high' } }) — optional trigger metadataFunctions can declare their input/output schemas for documentation and discovery:
schemars::JsonSchema on handler input/output types — RegisterFunction::new() auto-generates JSON Schema (Draft 7) from the typeregister_function() auto-extracts JSON Schema (Draft 2020-12)request_format / response_format manually in the registration message (e.g., via Zod's toJSONSchema())Use the adaptations below when they apply to the task.
namespace::name convention for function IDs to group related functionsapi_path and http_method in the trigger configTriggerAction.Enqueue({ queue }) instead of synchronous triggerTriggerAction.Void()iii-http-endpoints.iii-queue-processing.iii-cron-scheduling.iii-trigger-actions.iii-functions-and-triggers when the primary problem is registering functions, binding triggers, or cross-language invocation.iii-functions-and-triggers in the iii engine.