LoomCycle: Run Completed icon

LoomCycle: Run Completed

Fires when a loomcycle agent run reaches a terminal state (completed/failed/cancelled)

LoomCycle: Run Completed

AI-generated

Summary

Trigger that starts a workflow whenever a LoomCycle agent run for a given user reaches a terminal status (completed, failed, or cancelled), using either a live SSE stream or periodic polling.

Inputs

  • userId — user_id to watch. If empty, falls back to the Default User ID on the LoomCycle API credential. The trigger throws an error if neither is set.
  • statuses — Terminal statuses that fire the trigger: cancelled, completed, failed. Defaults to completed. An empty selection means no status filter in SSE mode and all three statuses in poll mode.
  • mode — Transport: 'sse' (default, persistent push stream, needs reverse-proxy SSE support) or 'poll' (periodic list calls with dedup).
  • intervalSec — Poll mode only. Seconds between polls, 5–3600, default 30.
  • additionalFields.agent — Only fire for runs of this agent name. SSE mode only; it is not applied in poll mode.
  • additionalFields.parentAgentId — Only fire for sub-runs whose parent_agent_id matches. Applied client-side in both modes.
  • additionalFields.emitClose — SSE mode only. When true, also emits synthetic {__meta:'stream_close', reason} items when the stream closes or reconnects. Default false.
  • additionalFields.reconnectBackoffMs — SSE mode only. Base reconnect backoff in ms, 100–60000, default 1000. It is multiplied by the attempt count, capped at 4×.

Output shape

One workflow item per finished run. In SSE mode the item is the run-state event payload from loomcycle's /v1/users/{id}/agents/stream. In poll mode it is the agent row from /v1/users/{id}/agents (including agent_id and parent_agent_id). Poll mode batches all new rows found in one poll into a single emission.

Poll mode dedups by agent_id, keeping the last 1000 seen IDs in workflow static data. SSE mode has no dedup. SSE reconnects automatically with backoff, and after 5 consecutive failures it emits an error and stops. Manual test execution waits up to 30s for one SSE event, or does a single poll. The poll interval is the only delay in poll mode, so latency can be up to that long.

Examples

Example 1: Notify Slack when any run for a user fails or is cancelled

userId = 'user-123', statuses = [failed, cancelled], mode = SSE

Example 2: Run follow-up processing when sub-agents of a specific parent finish, behind a proxy without SSE

mode = Poll, intervalSec = 30, statuses = [completed], additionalFields.parentAgentId = ''

Example 3: Trigger only on one agent's completions, with reconnect visibility

mode = SSE, statuses = [completed], additionalFields.agent = 'summarizer', emitClose = true

Links

Discussion