Skip to main content
Event triggers let you pause workflows and job runs to wait for external input — approvals, webhook callbacks, third-party processing results, or any asynchronous signal. This guide walks through common patterns.

Pattern 1: Human Approval with External System

A KYC pipeline that waits for an external AML check result:
When the AML provider completes their check, they call your webhook endpoint. Your endpoint then forwards the result to strait:
The create-account step starts automatically with the AML result available via {{parent_outputs.aml-check.result}}.

Pattern 2: Multi-Stage Deployment with Manual Gates

QA team signs off via API or a custom dashboard that calls the send endpoint. The workflow can wait up to 7 days without consuming resources.

Pattern 3: Cross-Workflow Coordination

Use event_emit_key to chain workflows. When one workflow completes a step, it auto-resolves a trigger in another workflow: Workflow A (data processing):
Workflow B (aggregation — triggered separately):
When Workflow A’s process-batch step completes, it auto-emits an event that resumes Workflow B’s wait-for-batch step.

Pattern 4: Durable Sleep

Pause a workflow for a specific duration:
The sleep step creates a trigger with an expiry time. The reaper completes it when the time arrives. No goroutines are held.

Pattern 5: SDK Wait for Event

Job runs can pause mid-execution and wait for an external event:
When the event arrives, the run is re-queued and re-dispatched with the event payload as checkpoint data. Your job code can read the checkpoint data on re-dispatch.

Pattern 6: Batch Resolution

Resolve multiple triggers at once using prefix matching:
This resolves all waiting triggers with keys starting with batch-42: (e.g., batch-42:item-1, batch-42:item-2, etc.).

Monitoring Triggers

CLI

Real-Time SSE Stream

Monitor a trigger in real-time:
The stream closes automatically when the trigger reaches a terminal state.

Error Handling

Timeout Handling

When a trigger times out, the workflow follows its on_failure policy:
  • fail_workflow (default): The entire workflow fails
  • skip_dependents: Downstream steps are skipped, other branches continue
  • continue: The timeout is ignored, dependents proceed

Cancellation

Cancel a trigger to immediately fail the associated step:

Webhook Delivery Failures

If a notify_url is configured and delivery fails:
  1. The delivery is persisted to the database
  2. Retried with exponential backoff (5s, 25s, 125s, 625s)
  3. After 5 failed attempts, the delivery is dead-lettered
  4. 4xx responses are dead-lettered immediately

Best Practices

  1. Use descriptive, namespaced event keys: {type}:{entity-id} pattern prevents collisions (e.g., kyc:user-123, deploy:release-v2.1)
  2. Set appropriate timeouts: Use generous timeouts for human workflows (days/weeks) — the wait is free. Avoid infinite waits in production
  3. Handle timeout failures: Configure on_failure: skip_dependents or continue for non-critical wait steps
  4. Use event chaining for cross-workflow coordination: event_emit_key is more reliable than external HTTP calls between workflows
  5. Monitor waiting triggers: Set up alerts for triggers approaching their timeout
  6. Use prefix patterns for batch operations: Design event keys with a common prefix when items are part of the same batch

Pattern 7: TypeScript SDK Client

Use the TypeScript SDK package @strait/ts for type-safe event trigger operations:

Pattern 8: Data Retention & Purge

For compliance or cost management, periodically purge old terminal triggers:
The reaper also automatically cleans up based on EVENT_TRIGGER_RETENTION (default: 30 days). Adjust for your compliance requirements:

Pattern 9: Browser SSE Dashboard

Build a real-time dashboard that monitors trigger status using Server-Sent Events: