How work enters a factory
Every inbound Event—whether sent from your backend, a Channel, or a Signal—flows through the same durable event pipeline before being routed to its target Room (and, when a Worker is already following that thread, directly to the relevant Worker).
Two additional mechanisms run without an inbound Room Event:
- Scheduled runs (Loops): recurring tasks you configure in the web app—for example, “Every Monday at 9:00 AM, summarize open issues”. Each run starts a fresh task.
- Monitors: background checks a Worker sets up for itself while working on a task—for example, “Watch PR #412 until CI passes” or “Watch order 1188 until the carrier marks it delivered”. Monitors poll on a timer and resume the task as soon as something changes. You can inspect active Monitors in the web app.
Event routing vs. outbound Subscriptions
Worklayer separates inbound Event routing from outbound webhook Subscriptions:- Inbound Events flow into your factory (via
POST /v1/rooms/{roomId}/events, Channels, or Signals) and route to a specific Room. - Outbound Subscriptions (
/v1/subscriptions) flow out of your factory—pushing signed HTTPS webhooks (room.response,room.status,worker.status,reviews.*) to your backend across all Rooms whenever the factory replies, changes state, or requests a Review.
Today, API-created Rooms receive only the Events your backend sends to
/v1/rooms/{roomId}/events. Configuring per-Room subscriptions to external Signals or surfacing auto-created Channel Rooms in GET /v1/rooms is not yet supported in /v1. To feed third-party webhooks (such as GitHub, Sentry, or PostHog alerts) into per-item Rooms today, receive them on your backend and forward them to POST /v1/rooms/{roomId}/events.Event lifecycle
- Worklayer validates and persists the Event, returning
202 Acceptedwith itseventIdand resolveddeliverymode. - The Event is recorded in Room History with
kind: "event"and the sameeventId. - Depending on
delivery, the factory evaluates the Event and decides whether to reply, launch or steer a Worker, or do nothing. - Whenever the factory replies in the Room, Worklayer dispatches a
room.responseSubscription event.
202 Accepted guarantees the Event is durably stored—not that the factory has finished reading or acting on it. Use Subscriptions or Room History to track outcomes.
Choose when the factory reads an Event
Thedelivery field tells Worklayer how urgently the factory should process an Event. If omitted, it defaults to queue.
In the support example, the initial ticket arrives with
delivery: "queue". If Dana Lee immediately corrects the order number while the factory is already investigating, send the update with delivery: "steer":
steer Event as soon as that step completes.
Which webhooks an Event causes
Waiting for a webhook after sending a
context Event will time out until a queue or steer Event arrives. That is by design.Event payload
Put everything the factory needs to reason and act inside
content and modelContext. Use attributes for IDs and labels your own systems need when reading the Event back via Get an Event, which returns all fields including delivery.
Size and context limits
- Request body: up to 1 MiB (larger requests return
413). attributesandmodelContext: up to 32 KiB JSON each, maximum nesting depth 8, and at most 128 keys per object. Keys__proto__,prototype, andconstructorare disallowed, and unknown top-level fields are rejected.- Full storage: Worklayer persists the complete Event text, available anytime via Get an Event and accessible on demand by the factory inside its Room.
queueandsteer: up to the first 16,000 characters ofcontentare shown inline (longer text is truncated with…, while the full Event remains readable on demand).context: the newest 20 waitingcontextEvents are included in full (up to 16,000 characters each) within a 120,000-character budget. Beyond that, up to the 60 newest waitingcontextEvents include their first 1,000 characters plus a pointer to the full text.- High-volume
contextbacklogs: if more than 60contextEvents accumulate before the factory wakes, older ones are rolled up into a single summary line showing the count and time span so the factory can look them up if needed. - Read-once delivery: once the factory processes newer
contextEvents, skipped older ones are not re-injected automatically, though their full content remains stored and accessible.
Safe retries with Idempotency-Key
Include anIdempotency-Key header (1–191 visible ASCII characters, single header) so retries after timeouts or 503 responses never duplicate Events:
Idempotency keys are unique across the entire factory, not just a single Room. Prefix keys with your Room or entity ID—for example,
zendesk-ticket-4821-created.delivery is treated identically to "delivery": "queue".
Errors
Channels
Connect Slack or build your own conversational Channel.
Workers
Track, stream, and steer background tasks spawned by Events.