Skip to content

Improve apify call and task run final status and JSON output for agents #1139

@patrikbraborec

Description

@patrikbraborec

Summary

Improve final status summaries and JSON output for apify call and apify task run.

Problem

apify call and apify task run start cloud runs and stream logs. A run can start successfully but later finish as FAILED, TIMED_OUT, or ABORTED.

Agents need an explicit final run result, not just evidence that the run started.

Desired human-readable output

For failed runs:

Apify call result: FAILED

Run: FAILED
Actor ID: ...
Run ID: ...
Build number: 0.0.1
Exit code: 1
Dataset ID: ...
Key-value store ID: ...

Run URL: ...
Dataset URL: ...

Reason:
Actor process exited with code 1
<last relevant log lines>

For successful runs:

Apify call result: SUCCEEDED

Run: SUCCEEDED
Actor ID: ...
Run ID: ...
Build number: ...
Dataset ID: ...
Key-value store ID: ...

Run URL: ...
Dataset URL: ...

apify task run should follow the same final-status contract.

Desired JSON output

{
  "ok": false,
  "operation": "call",
  "actor": {
    "id": "...",
    "url": "https://console.apify.com/actors/..."
  },
  "run": {
    "id": "...",
    "status": "FAILED",
    "exitCode": 1,
    "url": "https://console.apify.com/actors/.../runs/..."
  },
  "storage": {
    "defaultDatasetId": "...",
    "defaultKeyValueStoreId": "...",
    "datasetUrl": "https://console.apify.com/storage/datasets/..."
  },
  "error": {
    "phase": "run",
    "message": "Actor run failed",
    "logTail": []
  },
  "exitCode": 1
}

Acceptance criteria

  • apify call prints an explicit final result summary.
  • apify task run prints an explicit final result summary.
  • --json output includes ok, operation, run.status, and exitCode.
  • Failed, timed-out, and aborted runs return non-zero exit codes.
  • Agents can reliably distinguish “run started” from “run succeeded”.

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