Worker KV & Stateful Pipelines
Most LyftData actions process one event at a time. When a pipeline needs to remember earlier events — to suppress duplicate alerts inside a time window, reconcile two feeds that disagree, share a watermark across jobs, or catch a feed that stops sending — LyftData gives you two built-in options: in-job stateful actions for single-job tracking and Worker KV for durable key-value and workset state on a Worker.
Choose the right stateful tool
Section titled “Choose the right stateful tool”Start with an in-job stateful action when one Job owns the calculation (time-window summaries, numeric deltas, silence detection, or session grouping). Use Worker KV when state must survive restarts by default, expire per key with a TTL, coordinate across multiple Jobs on the same Worker, or act as a leased work queue.
| Primitive | Best for | State scope & persistence | Edition |
|---|---|---|---|
worker-kv + worker-kv-get |
Deduplication with TTLs, cross-source reconciliation, shared lookups/cursors, leased work queues | Per-Worker SQLite database; shared across jobs on that Worker; survives restarts | All editions |
aggregate |
Tumbling time windows (window.size) or cumulative count-triggered summaries (count, sum, mean, min, max, stddev, z-score) |
Single Job; in-memory by default, optional spill-to-disk |
All editions |
delta |
Difference between consecutive numeric values per key | Single Job; in-memory | All editions |
stream |
Rolling per-key deltas, recency flags, missing-data fill (forward-fill / default-value), and sliding window aggregates (max-keys + lru/ttl eviction) |
Single Job; in-memory | All editions |
transition |
State changes (for example ok → degraded) with threshold-count debouncing and elapsed time |
Single Job; persisted automatically as a job/Worker runtime artifact (optional extra persistent-state-file snapshot) |
All editions |
transaction |
Group multi-event sessions by start/end markers or idle-timeout with counts and durations |
Single Job; in-memory | All editions |
stalled |
Emit silence and recovery markers when an expected key stops arriving within timeout |
Single Job; in-memory, optional save-file |
All editions |
(LyftData 3.0 has no built-in streaming join operator and no cluster-wide KV replication. Redis is a messaging connector for pub/sub and streams, not a Worker KV backend.)
How Worker KV works
Section titled “How Worker KV works”Namespaces, keys, and values
Section titled “Namespaces, keys, and values”Every Worker KV step requires a namespace in <tenant>:<name> format (for example ops:alerts or default:alerts; <tenant>/<name> is also accepted). Omitting namespace fails deserialization, and passing a bare name such as alerts without a tenant prefix fails at runtime — there is no implicit default tenant.
Values are stored as JSON. Each key belongs to one namespace and holds either a JSON value (object, array, string, number, boolean) or null.
All three DSL components place the operation directly under worker-kv: alongside namespace: — do not wrap it in an operation: key:
| Component | Operations | Selector / key options | Common use |
|---|---|---|---|
Input (worker-kv) |
get, iterate, pop-batch |
get: key; iterate: prefix; pop-batch: set |
Scheduled cursor reads, prefix scans, or leasing workset batches |
Action (read) (worker-kv-get) |
Single key lookup | Static key or dynamic key-field; output-field (default /kv_value) |
Look up prior state into an event field |
Action (mutate) (worker-kv) |
set, set-if-absent, delete, add-to-set, remove-from-set, ack-batch |
Key ops: key or key-field; sets: set + member-field; ack-batch: set + batch-handle-field; optional Lua condition |
Conditional mid-pipeline state updates, field-selected keys, and atomic suppression keys |
Output (worker-kv) |
set, set-if-absent, delete, add-to-set, remove-from-set, ack-batch |
Key ops: key string (supports ${field} expansion, no key-field); sets: set + member-field; ack-batch: set + batch-handle-field |
Persist final watermarks, enqueue worksets, or acknowledge leased batches |
Use action.worker-kv when you need a key-field selector, a Lua condition, or mid-pipeline updates before downstream actions. Use output.worker-kv when persisting final state at the end of a job (for example key: "orders/last_sync" or key: "orders/${order_id}").
Missing keys and empty reads
Section titled “Missing keys and empty reads”worker-kv-getaction: When a key does not exist or has expired,worker-kv-getwrites JSONnulltooutput-field(default/kv_value). In Lua expressions, JSONnullbinds asnil, so bothis_null(prior_value)andprior_value == nilmatch (is_null(...)is recommended for readability).output-fieldaccepts JSON pointers like/prioror dotted paths likeprior.value, not JSONPath$expressions.- Missing or blank
key-field: Ifkey-fieldresolves to missing, blank, or non-string, bothworker-kv-getandworker-kvpass the event through untouched (and log a warning only whenwarn-on-missing-key: true). input.worker-kv(get): Emits{"tenant":"...","namespace":"...","key":"...","value":null}when the key is missing or expired.input.worker-kv(iterate): Scans keys matchingprefix(LIKE prefix%, without SQL wildcard escaping) in ascending lexicographical order (defaultpage-size: 100) and skips expired rows. Within one live Job,iteratekeeps its cursor in memory: the last non-empty page carrieshas_more: false, and the next tick emits nothing while clearing the cursor so the following tick starts from the beginning (restarting the Job also starts fresh). Note that because SQLite fetchespage-size + 1rows before filtering expired rows,has_more: falsereflects that filtered page rather than an exhaustive live-key guarantee if expired rows were present.
TTLs and atomic set-if-absent
Section titled “TTLs and atomic set-if-absent”- Setting
ttl-msonsetorset-if-absentsets an expiry duration in milliseconds from the Worker’s write clock (stored internally in SQLite as epoch nanoseconds). There is nottl-secsfield in Job YAML — and becauseoutput.worker-kvsetpermits unknown fields, writingttl-secsthere silently stores a key with no expiry. (The Worker Stores UI accepts seconds and converts them to milliseconds.) - Immediate expiry on read: Both
getanditeratecheck expiry on every read and lazily delete expired rows —getreturnsnullanditerateskips them, so you never read stale expired entries. - Atomic first-writer wins:
set-if-absentexecutes as a single SQLite conflict statement that inserts or overwrites only when the key is absent or already expired. Two writers on the same Worker cannot both win the same fresh key — note, however, that theworker-kvaction does not return the SQLite winner boolean to downstream actions (see Recipe 1’s concurrency note below).
Per-Worker scope, disk paths, and sweeper ownership
Section titled “Per-Worker scope, disk paths, and sweeper ownership”Worker KV is backed by a SQLite database file on disk, so non-expired keys and workset members survive Worker restarts:
- Built-in Worker: uses the Server’s store under the Server staging root (
<staging>/kv-store-db/kv-store.db). - External Workers: each external Worker opens its own local SQLite database under its configured output directory.
State is strictly local to one Worker. Entries written on Worker A are never visible on Worker B, even if both Workers belong to the same Worker group. When correlating events across edge Workers (such as two regional VPN gateways), forward matching events over HTTP or a broker to a single central Worker where the correlator runs:
flowchart LR
accTitle: Per-Worker scope for Worker KV
accDescr: Two edge Workers forward events over HTTP to one central Worker where correlator and alerting jobs share one local SQLite Worker KV store.
e1["Edge Worker A (gw-east)"] -->|HTTP / Kafka| c["Central Worker (correlator job)"]
e2["Edge Worker B (gw-west)"] -->|HTTP / Kafka| c
c <--> kv[("Local SQLite Worker KV (kv-store.db)")]
c --> out["Alert destination"]
Sweeper ownership: The Server runs the periodic background sweeper (every 60s by default under deployments.worker_kv.sweeper_interval) on the Server/built-in store. External Workers do not run a separate background sweeper thread: they expire keys lazily on read (get/iterate) and reclaim expired workset leases during a successful pop-batch. Because the outstanding_leases_limit check runs before the pop transaction without filtering expired rows, an external Worker that reaches its lease limit will not recover just by waiting 60 seconds — acknowledge or drain active leases, or raise the limit.
Worksets (leased queues) and default limits
Section titled “Worksets (leased queues) and default limits”In addition to plain keys, a namespace can hold worksets — durable queues built with add-to-set, pop-batch, and ack-batch. pop-batch leases up to limit members (default 1) for lease-ttl-ms (default 30000 ms) and polls every 1s if trigger is omitted.
ack-mode: ack-batch: Every event emitted from onepop-batchshares the samebatch_handletoken, and each call toack-batchdecrements the remaining count for that batch. Every leased event must reachack-batchexactly once — placeack-batchbefore any fan-out, and do not filter out or duplicate items ahead of it (duplicating an event can acknowledge the batch early, while dropping one leaves the batch unacknowledged until the lease expires).ack-mode: ack-each: Emits an independentbatch_handleper item so members can succeed, fail, or filter independently.
See Advanced workflows: stateful Jobs for a complete producer/consumer workset workflow.
Default limits are configured on the Server under deployments.worker_kv:
Setting (deployments.worker_kv) |
Default | Scope |
|---|---|---|
namespaces_limit |
100 |
Distinct namespaces per tenant in that Worker KV store |
set_cardinality_limit |
250,000 |
Members in a single tenant/namespace/set workset |
outstanding_leases_limit |
10,000 |
Active leased members per tenant in that Worker KV store |
sweeper_interval |
60s |
Background expiry and lease-requeue interval on the Server/built-in store |
Recipe 1: Deduplicate alerts with TTLs
Section titled “Recipe 1: Deduplicate alerts with TTLs”Suppose two regional VPN gateways forward failed logins to one central Worker. You want one alert when the same user fails across both gateways within a 10-minute processing-time window (ttl-ms: 600000 measured from when the Worker writes each key — not from event_time), and you want further repeats inside that window suppressed.
(This recipe uses script and requires a licensed edition: Community+, Growth, Standard, or Enterprise. See Recipe 3 and Recipe 4 for patterns that run in free Community Edition without script.)
Job YAML (vpn-spray-correlator)
Section titled “Job YAML (vpn-spray-correlator)”Stage and deploy this job onto built-in-worker (or your central Worker — see Troubleshooting below for why Worker KV jobs must be deployed rather than run as transient tests):
name: vpn-spray-correlatorinput: http-server: address: 127.0.0.1:8086 path: /vpn-auth only-body: true json: trueactions: - script: overwrite: true let: own_key: '"seen/" .. user_id .. "/" .. gateway' other_gateway: 'gateway == "gw-east" and "gw-west" or "gw-east"' other_key: '"seen/" .. user_id .. "/" .. other_gateway' alert_key: '"alerted/" .. user_id' - worker-kv-get: namespace: ops:vpn-spray key-field: /other_key output-field: /other_seen - worker-kv-get: namespace: ops:vpn-spray key-field: /alert_key output-field: /prior_alert - worker-kv: namespace: ops:vpn-spray set: key-field: /own_key value-field: /gateway ttl-ms: 600000 - script: overwrite: true let: should_alert: 'not is_null(other_seen) and is_null(prior_alert)' alert_message: 'should_alert and ("Cross-gateway failures for " .. user_id .. ": " .. gateway .. " and " .. other_seen) or nil' - worker-kv: namespace: ops:vpn-spray condition: should_alert set-if-absent: key-field: /alert_key value-field: /alert_message ttl-ms: 600000 - filter: how: expression: should_alert - remove: fields: - own_key - other_key - alert_keyoutput: print: output: stdoutSerialized walkthrough (confirm state between requests)
Section titled “Serialized walkthrough (confirm state between requests)”Because http-server returns HTTP 200 as soon as a request is queued (before downstream worker-kv writes finish), confirm each write before sending the next curl command (use a fresh user_id or wait for the TTL to expire on repeat runs):
- Send Request 1 (
gw-east):
curl -sS -X POST http://127.0.0.1:8086/vpn-auth -H 'Content-Type: application/json' \ -d '{"user_id":"user-017","gateway":"gw-east","event_time":"2026-12-03T08:00:00Z"}'other_seen is null and prior_alert is null. The job writes seen/user-017/gw-east = "gw-east" with a 10-minute processing-time TTL and filters the event out (no stdout line). Before continuing, confirm ops:vpn-spray contains seen/user-017/gw-east = "gw-east" in Worker Stores (built-in Worker) or via a same-Worker worker-kv get job (external Worker).
- Send Request 2 (
gw-west):
curl -sS -X POST http://127.0.0.1:8086/vpn-auth -H 'Content-Type: application/json' \ -d '{"user_id":"user-017","gateway":"gw-west","event_time":"2026-12-03T08:03:00Z"}'other_seen returns "gw-east" and prior_alert is still null. The job writes seen/user-017/gw-west, claims alerted/user-017 via set-if-absent for 10 minutes, trims helper keys with remove, and emits one compact JSON alert line to stdout (formatted for readability below). Before continuing, confirm the stdout alert (or alerted/user-017 in ops:vpn-spray) has landed:
{ "user_id": "user-017", "gateway": "gw-west", "event_time": "2026-12-03T08:03:00Z", "other_gateway": "gw-east", "other_seen": "gw-east", "prior_alert": null, "should_alert": true, "alert_message": "Cross-gateway failures for user-017: gw-west and gw-east"}- Send Request 3 (
gw-westrepeat):
curl -sS -X POST http://127.0.0.1:8086/vpn-auth -H 'Content-Type: application/json' \ -d '{"user_id":"user-017","gateway":"gw-west","event_time":"2026-12-03T08:04:00Z"}'prior_alert now returns the stored alert string (not null), so should_alert is false → suppressed until the 10-minute TTL expires.
Recipe 2: Reconcile two conflicting feeds (“When Two Sources Disagree”)
Section titled “Recipe 2: Reconcile two conflicting feeds (“When Two Sources Disagree”)”When two upstream systems report the same entity in different units — and can deliver stale revisions out of order — store each source’s latest accepted revision and normalized value together in one JSON object ({"revision": 2, "value_c": 25}) under a single key state/<entity>/<source>. Storing both fields in one write eliminates torn revision/value pairs on failure or restart.
(Uses script — requires a licensed edition. For the multi-job Workflow version that fans agree, conflict, and ignored events to separate endpoints, see Advanced correlation.)
Job YAML (two-source-reconciler)
Section titled “Job YAML (two-source-reconciler)”Deploy this job onto built-in-worker (or a single designated Worker):
name: two-source-reconcilerinput: http-server: address: 127.0.0.1:8087 path: /readings only-body: true json: trueactions: - script: overwrite: true let: other_source: 'source == "A" and "B" or "A"' own_key: '"state/" .. entity_id .. "/" .. source' other_key: '"state/" .. entity_id .. "/" .. other_source' value_c: 'unit == "F" and (value - 32) * 5 / 9 or value' - worker-kv-get: namespace: demo:reconcile key-field: /own_key output-field: /own_state - worker-kv-get: namespace: demo:reconcile key-field: /other_key output-field: /other_state - script: overwrite: true let: stored_revision: 'not is_null(own_state) and own_state.revision or nil' other_value_c: 'not is_null(other_state) and other_state.value_c or nil' accepted: 'is_null(stored_revision) or revision > stored_revision' has_other: 'not is_null(other_value_c)' diff_c: 'has_other and abs(value_c - other_value_c) or nil' status: 'not accepted and "ignored_stale" or (not has_other and "waiting" or (diff_c > 0.5 and "conflict" or "agree"))' state_record: '{ revision = revision, value_c = value_c }' - worker-kv: namespace: demo:reconcile condition: accepted set: key-field: /own_key value-field: /state_record - remove: fields: - other_source - own_key - other_key - own_state - other_state - state_record - has_otheroutput: print: output: stdoutSerialized walkthrough across all four events
Section titled “Serialized walkthrough across all four events”Because http-server returns HTTP 200 on queue admission while print runs after the conditional worker-kv write, wait for each request’s matching stdout record (waiting, then agree, then conflict) before sending the next curl command. Use a fresh entity_id or namespace when re-running the test (revision keys have no TTL), and keep integer revision values within the 53-bit safe integer range (<= 2^53 - 1, because Lua numbers are IEEE-754 doubles):
- Request 1 (Source A, rev 1) — wait for
"status":"waiting"on stdout:
curl -sS -X POST http://127.0.0.1:8087/readings -H 'Content-Type: application/json' \ -d '{"entity_id":"sensor-001","source":"A","revision":1,"value":20,"unit":"C"}'- Request 2 (Source B, rev 1) — wait for
"status":"agree"on stdout:
curl -sS -X POST http://127.0.0.1:8087/readings -H 'Content-Type: application/json' \ -d '{"entity_id":"sensor-001","source":"B","revision":1,"value":68,"unit":"F"}'- Request 3 (Source B, rev 2) — wait for
"status":"conflict"on stdout:
curl -sS -X POST http://127.0.0.1:8087/readings -H 'Content-Type: application/json' \ -d '{"entity_id":"sensor-001","source":"B","revision":2,"value":77,"unit":"F"}'- Request 4 (Source B, rev 1 stale replay) — emits
"status":"ignored_stale"without overwriting KV:
curl -sS -X POST http://127.0.0.1:8087/readings -H 'Content-Type: application/json' \ -d '{"entity_id":"sensor-001","source":"B","revision":1,"value":68,"unit":"F"}'| Request | stored_revision |
other_value_c |
accepted |
status |
KV updated? |
|---|---|---|---|---|---|
1. Source A, rev 1 (20 °C) |
null |
null |
true |
waiting |
Yes (state/sensor-001/A = {"revision":1,"value_c":20}) |
2. Source B, rev 1 (68 °F = 20 °C) |
null |
20 |
true |
agree (diff_c: 0) |
Yes (state/sensor-001/B = {"revision":1,"value_c":20}) |
3. Source B, rev 2 (77 °F = 25 °C) |
1 |
20 |
true |
conflict (diff_c: 5) |
Yes (state/sensor-001/B = {"revision":2,"value_c":25}) |
4. Source B, rev 1 (68 °F, stale replay) |
2 |
20 |
false |
ignored_stale |
No (condition: accepted is false) |
Formatted conflict record on Request 3 (compact stdout prints on one line; Lua-computed numbers value_c, stored_revision, other_value_c, and diff_c serialize with .0, while original input integers retain integer form):
{ "entity_id": "sensor-001", "source": "B", "revision": 2, "value": 77, "unit": "F", "value_c": 25.0, "stored_revision": 1.0, "other_value_c": 20.0, "accepted": true, "diff_c": 5.0, "status": "conflict"}(As with Recipe 1, this pattern assumes serialized arrivals across both Source A and Source B for the same entity_id — and across any other writers of those keys — because concurrent arrivals can let Source B miss Source A’s first write or let a stale revision read before a newer revision commits.)
Recipe 3: Share cursor and lookup state across jobs (no scripting required)
Section titled “Recipe 3: Share cursor and lookup state across jobs (no scripting required)”Because Worker KV is shared across every job on the same Worker, one job can maintain a checkpoint or lookup value with output.worker-kv, another job can enrich events with worker-kv-get, and a third job can audit keys by prefix with input.worker-kv (iterate). All three jobs below work in every edition, including free Community Edition.
Job A: Write a shared sync cursor (sync-cursor-writer)
Section titled “Job A: Write a shared sync cursor (sync-cursor-writer)”name: sync-cursor-writerinput: echo: json: true event: '{"cursor":{"watermark":"2026-12-03T12:00:00Z","batch":14}}'output: worker-kv: namespace: ops:sync set: key: orders/last_sync value-field: /cursorJob B: Enrich incoming orders with the shared cursor (orders-enrich-from-kv)
Section titled “Job B: Enrich incoming orders with the shared cursor (orders-enrich-from-kv)”name: orders-enrich-from-kvinput: echo: json: true event: '{"order_id":"ORD-1042","amount":99}'actions: - worker-kv-get: namespace: ops:sync key: orders/last_sync output-field: /sync_stateoutput: print: output: stdoutBefore Job A has run on that Worker (missing key), Job B emits null in sync_state:
{ "order_id": "ORD-1042", "amount": 99, "sync_state": null}After Job A runs on the same Worker, Job B enriches the order with the persisted object:
{ "order_id": "ORD-1042", "amount": 99, "sync_state": { "watermark": "2026-12-03T12:00:00Z", "batch": 14 }}Job C: Scan stored keys by prefix (audit-sync-cursors)
Section titled “Job C: Scan stored keys by prefix (audit-sync-cursors)”name: audit-sync-cursorsinput: worker-kv: namespace: ops:sync trigger: interval: duration: 5m iterate: prefix: orders/ page-size: 50output: print: output: stdoutEach matching key emits an envelope with its key, value, Worker write timestamp (updated_at_ns, independent of any business timestamp inside value), and pagination metadata on the last item of each page:
{ "tenant": "ops", "namespace": "sync", "prefix": "orders/", "key": "orders/last_sync", "value": { "watermark": "2026-12-03T12:00:00Z", "batch": 14 }, "updated_at_ns": 1796299200000000000, "next_cursor": "orders/last_sync", "has_more": false}(With a single stable key on a 5-minute interval, tick 1 emits the record with has_more: false, tick 2 emits nothing while resetting the in-memory cursor, and tick 3 scans from the start again.)
Recipe 4: Catch silent, flapping, or flooded feeds (stalled, transition, aggregate)
Section titled “Recipe 4: Catch silent, flapping, or flooded feeds (stalled, transition, aggregate)”When one Job already receives the stream, in-job stateful actions catch common feed-health issues without custom Worker KV logic — and work in all editions.
Detect silent feeds with stalled
Section titled “Detect silent feeds with stalled”Use = in marker (<field>=<value>) so stalled sets that field cleanly on generated silence and recovery events. (Optional save-file persists stall timestamps across restarts; omit it for a quick first test or point it at a writable directory — stalled logs file-open errors without aborting the job.)
name: feed-silence-monitorinput: http-server: address: 127.0.0.1:8085 path: /heartbeats only-body: true json: trueactions: - stalled: marker: "event_type=feed_stalled" input-field: feed_id timeout: 5moutput: print: output: stdoutKey runtime behavior:
- Ordinary heartbeat events pass through downstream unchanged, and the first heartbeat for a
feed_idcan also emit an initial"streaming": "yes"marker. stalledchecks elapsed silence on a periodic wall-clock sweep (sotimeout: 5mis not an exact millisecond deadline), and a feed that has never sent a heartbeat has no entry to expire.- After
{"feed_id":"firewall-eu"}goes silent pasttimeout,stalledemits a silence marker ("streaming": "no"), and when heartbeats resume it emits"streaming": "yes":
{ "event_type": "feed_stalled", "streaming": "no", "stalled": "firewall-eu"}Debounce status flapping with transition
Section titled “Debounce status flapping with transition”For two-state flapping (ok ↔ degraded), threshold-count: 3 requires 3 consecutive non-matching observations before emitting a transition marker (with positive elapsed milliseconds since the previous state began). Note that on multi-state fields, threshold-count counts consecutive observations that differ from the committed state and resets both when an observation matches the committed state and when the counter reaches the threshold — for example, from committed ok, the sequence degraded → down → degraded increments the counter to 3 and emits a transition to degraded.
transition persists its state automatically as a job/Worker runtime artifact (add persistent-state-file only if you also want an extra on-disk snapshot in a writable directory; a failed snapshot write raises a runtime error):
actions: - transition: watch: health group-by: feed_id threshold-count: 3 marker: "event_type=health_changed" elapsed-output-field: state_duration_ms value-at-last-change-output-field: previous_healthOrdinary input events continue downstream alongside generated markers. state_duration_ms measures from the first observation of the previous state’s threshold run (not its commit timestamp) to the commit of the new state — for example, if ok began at 0 s and degraded commits at 60 s, the emitted grouped marker is:
{ "event_type": "health_changed", "health": "degraded", "state_duration_ms": 60000, "previous_health": "ok", "key": "firewall-eu"}Count per-minute volume per feed with aggregate
Section titled “Count per-minute volume per feed with aggregate”Group by feed_id over 1-minute tumbling event-time windows and emit one summary record when each window closes (add a downstream filter on event_count to alert on flood or drop thresholds):
actions: - aggregate: group-by: - feed_id time-field: event_time window: size: 1m aggregate-trigger: on-window-close: true output: per-window-record aggregations: - field: feed_id op: count as: event_countaggregate only counts observed groups (it does not create zero-volume buckets), and closes a window when a later event arrives with event_time >= window_end (for example 08:01:00Z or later with the default zero lateness) or when a document ends. Sending two events for firewall-eu inside 08:00 followed by a third event at 08:01:05Z closes the 08:00 window and emits:
{ "feed_id": "firewall-eu", "window_start": "2026-12-03T08:00:00+00:00", "window_end": "2026-12-03T08:01:00+00:00", "count": 2, "event_count": 2}(Note: when using aggregate-trigger.count: N without a time window, aggregate emits cumulative running counts whenever the group’s count is divisible by N — for example 2, then 4 — without resetting counters.)
Troubleshooting
Section titled “Troubleshooting”| What you see | What to check | What confirms recovery |
|---|---|---|
worker_kv_unavailable_for_transient_job on test run |
Transient job.run executions do not implicitly attach to a Worker’s local KV store. Stage and deploy the job onto the target Worker (for example built-in-worker). |
Deployed job starts cleanly and reads/writes keys on that Worker. |
Job YAML rejected with unknown field on operation |
Remove the operation: wrapper — write set, set-if-absent, delete, get, iterate, pop-batch, add-to-set, or ack-batch directly under worker-kv:. |
Job saves and stages with zero schema validation errors. |
worker-kv namespace must include a tenant prefix |
Use <tenant>:<name> format (for example default:alerts or ops:alerts). A bare string like alerts deserializes but fails at runtime when splitting the namespace. |
Job starts and reads/writes the namespaced keys cleanly. |
| Job B cannot see keys written by Job A | Confirm both jobs run on the exact same Worker ID (a multi-Worker group spreads jobs across separate local SQLite files) and use the exact same namespace and key string. |
worker-kv-get returns the stored value instead of null. |
| Missing key behavior in Lua expressions | worker-kv-get writes JSON null when a key is missing or expired, which binds as Lua nil. Test absence explicitly with is_null(field) (or field == nil) before accessing nested properties like own_state.revision. |
First event takes the missing-key branch cleanly with zero Lua nil-indexing errors. |
| Keys never expire after setting TTL | Confirm Job YAML uses ttl-ms (milliseconds), not ttl-secs (output.worker-kv set ignores unknown fields and leaves the key without an expiry). |
get returns null once ttl-ms milliseconds elapse. |
worker-kv quota exceeded (especially on external Workers) |
Check deployments.worker_kv quotas (namespaces_limit: 100/tenant, set_cardinality_limit: 250,000/set, outstanding_leases_limit: 10,000/tenant). On external Workers, waiting 60s will not clear a tenant lease-cap hit because the Server sweeper does not run on external stores — ack/drain active leases or raise outstanding_leases_limit. |
Backlog drains or quota is raised, and quota errors stop. |
| Need to inspect live Worker KV keys | lyftdata runtime-artifacts inspects job runtime artifacts (such as transition snapshots), not arbitrary Worker KV entries. Inspect the built-in/Server store in Worker Stores in the UI, or run a deployed same-Worker worker-kv get/iterate job on an external Worker. |
Expected keys and values appear in Worker Stores or the iterate job’s output. |
Limits and editions
Section titled “Limits and editions”- All editions (including Community Edition):
worker-kv(input, action, output),worker-kv-get, and all in-job stateful actions (aggregate,delta,stream,transition,transaction,stalled) work in every edition of LyftData 3.0 on single-node deployments. - Licensed editions (
Community+,Growth,Standard,Enterprise): Embeddedscript(Lua) andjava-scriptactions used for custom correlation logic (as in Recipes 1 and 2). - Distributed Workers (
Growth,Standard,Enterprise): External Workers are available in Growth and above. Worker KV remains local to each Worker: pin cooperating stateful jobs to a single-member Worker group (or verify assignment to the exact same Worker ID), or route events into a single central Worker. Reassigning a stateful job to a different Worker starts it against that Worker’s own local SQLite store.
Related guides
Section titled “Related guides”- Advanced workflows: stateful Jobs — multi-step Workflows, workset lease queues (
pop-batch/ack-batch), and Redis Streams handoff. - Advanced correlation — full multi-job Workflow manifests for two-source overlap/conflict and cross-Worker alerting.
- Job Actions — complete chooser across all 48 actions.
- Runtime Evidence and Receipts — inspect and clear saved runtime artifacts (such as cursors and
transitionsnapshots) withlyftdata runtime-artifacts.