with one click
iii-cron
Schedule any registered function on a 6- or 7-field cron expression, with once-only execution across a fleet when backed by the redis adapter. Its whole surface is the `cron` trigger type.
Schedule any registered function on a 6- or 7-field cron expression, with once-only execution across a fleet when backed by the redis adapter. Its whole surface is the `cron` trigger type.
| name | iii-cron |
| description | Schedule any registered function on a 6- or 7-field cron expression, with once-only execution across a fleet when backed by the redis adapter. Its whole surface is the `cron` trigger type. |
The iii-cron worker schedules a registered function to run on a recurring cron expression. It exposes no callable functions — its entire surface is one trigger type, cron, bound via iii.registerTrigger({ type: 'cron', function_id, config }). On every firing the engine builds an event payload, optionally evaluates a condition function, acquires a distributed lock through the configured adapter, and invokes the target function. Each firing reports scheduled_time vs. actual_time so drift and reentrancy are observable from inside the handler.
The schedule grammar is the seven-field cron dialect — second minute hour day-of-month month day-of-week [year] — where the year is optional and defaults to *. Both six- and seven-field forms work; the leading field is always seconds, so 0 */5 * * * * fires every 5 minutes at second 0, not every 5 seconds.
Two adapters govern once-only execution: kv (default) takes a process-local lock and is single-instance only — on a multi-instance fleet every engine fires the same job (tunables lock_ttl_ms, lock_index); redis takes a distributed lock and is required for once-only firing across a fleet (tunable redis_url).
redis adapter.condition_function_id without threading the check through the handler.cron::* id; everything flows through iii.registerTrigger.kv adapter only locks process-local; never rely on it for once-only jobs in a multi-instance deployment — use redis.iii-state / iii-stream; iii-cron fires on the clock only.Bind a cron trigger when a handler should run on a recurring schedule. The handler runs server-side on a tokio task spawned by the engine; with the redis adapter it fires once across the fleet per scheduled run.
Reach for it when:
condition_function_id and the engine evaluates it before each run, skipping the handler (and releasing the lock) on a falsy or erroring result.iii.registerFunction('jobs::cleanup-old-data', handler).iii.registerTrigger({
type: 'cron',
function_id: 'jobs::cleanup-old-data',
config: {
expression: '0 0 2 * * * *', // required. sec min hour dom month dow [year]; daily at 02:00:00.
// condition_function_id is also supported.
},
})
expression is required and must parse, or registration fails synchronously. Bind one function_id to several triggers with distinct ids to drive multiple schedules into one handler — the trigger id arrives as job_id in the event. The handler's return value is ignored.
For the firing event payload (trigger, job_id, scheduled_time, actual_time), call iii get function info on the trigger type or handler function id.
Ephemeral microVM sandboxes for running untrusted or agent-generated code in isolation — a one-call run path, a create/exec/stop lifecycle, and a set of filesystem operations.
Expose registered functions as HTTP endpoints via an `http` trigger, with a preHandler middleware chain for auth, rate limiting, and logging. Reach for it to serve REST without standing up a separate web server.
Connect this engine to another iii engine over a long-lived WebSocket so functions call across the boundary. Wire stable ids with `forward:`/`expose:`; `bridge.invoke` is the ad-hoc escape hatch.
WebSocket-routed worker mesh — the engine's Function/Trigger/Worker model and the iii-sdk surface for authoring them. Teaches the ordered way to gain a capability before writing code — (1) check functions already registered in the engine, (2) search the public registry via iii-directory, (3) build a worker. Single self-contained skill — meant for system-prompt injection; do not re-fetch.
OpenTelemetry-backed tracing, structured logs, metrics with rollups, alerts, sampling, and baggage for the engine — emit and query telemetry through `engine::*` functions and react to logs with a `log` trigger.
Fire-and-forget topic pub/sub: broadcast an event with `publish` and every matching `subscribe` trigger receives it. Use for real-time notifications where missed events are acceptable.