Skip to main content
An Event tells your factory that something happened—a new support ticket arrived, a customer replied, or an order changed state. When an Event lands in a Room, the factory reads it and decides whether to reply, spawn or steer a Worker, or simply keep it in mind. Send an Event from your backend:

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

Event lifecycle: POST /rooms/{id}/events returns 202 Accepted and routes via queue, steer, or context into the Factory Room and outbound webhooks.Event lifecycle: POST /rooms/{id}/events returns 202 Accepted and routes via queue, steer, or context into the Factory Room and outbound webhooks.
  1. Worklayer validates and persists the Event, returning 202 Accepted with its eventId and resolved delivery mode.
  2. The Event is recorded in Room History with kind: "event" and the same eventId.
  3. Depending on delivery, the factory evaluates the Event and decides whether to reply, launch or steer a Worker, or do nothing.
  4. Whenever the factory replies in the Room, Worklayer dispatches a room.response Subscription 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

The delivery 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":
If the factory is in the middle of a slow tool call, it picks up the 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).
  • attributes and modelContext: up to 32 KiB JSON each, maximum nesting depth 8, and at most 128 keys per object. Keys __proto__, prototype, and constructor are 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.
When injecting waiting Events into the factory’s live context window:
  • queue and steer: up to the first 16,000 characters of content are shown inline (longer text is truncated with …, while the full Event remains readable on demand).
  • context: the newest 20 waiting context Events are included in full (up to 16,000 characters each) within a 120,000-character budget. Beyond that, up to the 60 newest waiting context Events include their first 1,000 characters plus a pointer to the full text.
  • High-volume context backlogs: if more than 60 context Events 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 context Events, skipped older ones are not re-injected automatically, though their full content remains stored and accessible.

Safe retries with Idempotency-Key

Include an Idempotency-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.
Body comparison runs after JSON parsing and default resolution: object key order does not matter, and omitting 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.