Skip to content
Proud to collaborate with Microsoft for Startups

neon.operations.wait ​

Poll a Neon operation until finished (or fail/timeout)

Block until a single Neon operation reaches finished (or fail on error/failed/timeout).

This is the only multi-state base atomic in the Neon library. It owns the schedule_transition polling loop that the fire-and-forget create/mutation atomics (A-04 neon.branches.create, A-08 …) deliberately do NOT embed: those return immediately with a neon_operation_id, and the orchestration layer (C-01, C-03, and any future async Neon op) composes this primitive to wait.

The workflow enters WAITING_FOR_OPERATION immediately after PENDING and re-schedules itself every poll_interval seconds via schedule_transition(action="poll", delay=poll_interval) — NOT auto_advance (an auto_advance self-loop fails workflow-validator-async). Each poll reads the operation and decides:

  1. status == "finished" → schedule finish (delay 0).
  2. status in ("failed", "error") → schedule timeout (delay 0), stamp failure_reason.
  3. elapsed >= timeout_seconds → schedule timeout (delay 0).
  4. otherwise → reschedule poll (delay poll_interval), bump poll_count.

UUID-only surface rule: connection_uuid is our identifying handle; Neon's own ids stay on the neon_<x>_id surface (neon_project_id, neon_operation_id).

Inputs:

  • connection_uuid: UUID of the cloud connection (required)
  • neon_project_id: Neon project id (required)
  • neon_operation_id: Neon operation id to wait on (required)
  • timeout_seconds: Maximum wait time in seconds; default 120, cap 600
  • poll_interval: Seconds between polls; default 5, cap 30

Outputs (terminal state_data):

  • neon_project_id: echoed project id
  • neon_operation_id: echoed operation id
  • operation_status: "finished" on success
  • poll_count: number of polls executed

Read-only; no DB writes. Plugin required: context.get_plugin("neon") must expose .api_token.

External call (repeated): GET https://console.neon.tech/api/v2/projects/{neon_project_id}/operations/{neon_operation_id}

Overview ​

PropertyValue
Workflow typeLinear
LibraryApp-neon
Version1.0

Input Schema ​

FieldTypeRequiredDefaultDescription
connection_uuiduuidYes—Cloud connection UUID (resolves the neon api_token)
neon_project_idstringYes—Neon project id
neon_operation_idstringYes—Neon operation id to wait on
timeout_secondsintegerNo—Max wait time in seconds (default 120, cap 600)
poll_intervalintegerNo—Seconds between polls (default 5, cap 30)

Output Schema ​

FieldTypeRequiredDefaultDescription
neon_project_idstringNo——
neon_operation_idstringNo——
operation_statusstringNo——
poll_countintegerNo——
connection_uuiduuidNo——
timeout_secondsintegerNo——
poll_intervalintegerNo——
started_at_epochintegerNo——
failure_reasonstringNo——
failure_typestringNo——
failed_actionstringNo——
failed_at_statestringNo——
failed_stepstringNo——
failed_layerstringNo——
errorstringNo——
error_typestringNo——

States ​

StateInitialTerminalSuccessAuto-advanceDescription
pendingYesNo—start—
waiting_for_operationNoNo———
completedNoYesYes——
failedNoYesNo——

State Diagram ​

Transitions ​

FromActionToDescription
pendingstartwaiting_for_operation—
waiting_for_operationpollwaiting_for_operation—
waiting_for_operationfinishcompleted—
waiting_for_operationtimeoutfailed—
* (any state)failfailed—

API Usage ​

bash
POST /api/workflows/start
Content-Type: application/json

{
  "workflow_type": "neon.operations.wait",
  "initial_data": {
    "connection_uuid": "value",
    "neon_project_id": "value",
    "neon_operation_id": "value"
  }
}