Skip to content

Add wait commands for Actor builds and runs #1140

@patrikbraborec

Description

@patrikbraborec

Summary

Add wait commands for existing Actor builds and runs:

apify builds wait <buildId> --json
apify runs wait <runId> --json

Problem

For async flows, agents currently need to implement custom polling:

apify runs info <runId> --json
# parse status
# sleep
# repeat until terminal state
# fetch logs if failed

This duplicates Apify job semantics across agents and increases the chance of incorrect handling.

Desired behavior

apify builds wait <buildId> and apify runs wait <runId> should:

  • wait until terminal status,
  • return 0 for SUCCEEDED,
  • return non-zero for FAILED, TIMED_OUT, and ABORTED,
  • include final status,
  • include Console URLs,
  • support --json,
  • optionally include the last N log lines for failures.

Example JSON: run failure

{
  "ok": false,
  "operation": "runs.wait",
  "run": {
    "id": "abcdef123456789",
    "status": "FAILED",
    "exitCode": 1,
    "url": "https://console.apify.com/actors/M4wKY3jNvHeoT87xA/runs/abcdef123456789"
  },
  "error": {
    "phase": "run",
    "message": "Actor run failed",
    "logTail": []
  },
  "exitCode": 1
}

Example JSON: build failure

{
  "ok": false,
  "operation": "builds.wait",
  "build": {
    "id": "abcdef123456789",
    "status": "FAILED",
    "number": "0.0.1",
    "url": "https://console.apify.com/actors/M4wKY3jNvHeoT87xA#/builds/0.0.1"
  },
  "error": {
    "phase": "build",
    "message": "Actor build failed",
    "logTail": []
  },
  "exitCode": 1
}

Acceptance criteria

  • apify builds wait <buildId> waits for terminal build status.
  • apify runs wait <runId> waits for terminal run status.
  • Both commands support --json.
  • Both commands return non-zero for unsuccessful terminal statuses.
  • Both commands are safe to use in CI and agentic workflows.

Metadata

Metadata

Assignees

Labels

t-dxIssues owned by the DX team.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions