Skip to content
Trigora
Start building →

waitForEvent

function waitForEvent<TPayload>(
eventOrName: EventDefinition<TPayload> | string,
options?: { timeout?: string | number; match?: Record<string, unknown> },
): Promise<TPayload>
def wait_for_event(name: str) -> object

The TypeScript options object is part of the SDK type. The operation you can rely on for Cloud and trigora dev is the event name: trigora send <id> <name> resumes that wait. A send for a different name returns event_mismatch.

  • eventOrName — a string literal, or event("approved") from @trigora/sdk.
  • Python takes the name string only.

The JSON payload of the sent event. Omit --payload and the payload is empty.

The Execution commits the wait and leaves running. Status becomes waiting with { type: "event", event }. No compute is held. Recovery restores that wait. It does not replay earlier effects.

  • An empty name throws.
  • A send while the Execution is not waiting on that name fails with event_mismatch.
  • Outside an Execution, the call throws.
const review = await waitForEvent("approved");
Terminal window
trigora send <execution-id> approved --payload '{"ok":true}'