Problem
Users who iterate on Actor development — especially in automated / scripted / evaluation workflows — accumulate large numbers of one-off test Actors in their account. There is currently no first-class CLI affordance for cleaning them up in bulk:
apify actors rm <name> requires the exact name and only removes one Actor at a time.
apify actors ls prints a table but there is no way to pipe or filter its output into rm from within the CLI.
- The web console requires clicking through each Actor individually.
In a recent scripted workflow that pushed a fresh Actor per test run, 20+ orphan Actors accumulated in a single account within a few days. Users have to either write a shell loop around apify client / the REST API, or clean up manually in the console.
Proposal
1. apify actors prune — bulk-delete filtered Actors
apify actors prune [--older-than <duration>] [--name-pattern <regex>] [--dry-run] [--yes]
--older-than 7d — only Actors whose modifiedAt (or createdAt) is older than the given duration. Accept 1h, 24h, 7d, 30d.
--name-pattern '^test-' — only Actors whose name matches the regex.
--dry-run — print the list of Actors that would be deleted, do not delete.
--yes — skip interactive confirmation (safe default is to confirm).
Implementation sketch: use the existing apify-client actors().list() + actor(id).delete() — no server-side changes required.
2. (optional, larger) apify push --temporary + server-side TTL
A follow-up that would require apify-core support: allow apify push --temporary to mark an Actor as ephemeral (e.g. auto-deleted after N days of no runs). apify actors prune --temporary-only could then target only those. This is out of scope for the CLI-only PR above and would need a separate design discussion with apify-core.
Alternatives considered
- Shell one-liner —
apify actors ls --json | jq ... | xargs apify actors rm — works today but is fragile (name parsing, quoting, error handling), and requires jq + shell-fu that not all users have.
- Web console bulk-select — not a CLI concern, but would help the same problem class.
Test plan
apify actors prune --dry-run --older-than 30d prints candidates, deletes nothing.
apify actors prune --name-pattern '^ci-test-' --yes deletes only matching Actors.
- Prompts for confirmation when
--yes is not passed and stdin is a TTY.
- Non-zero exit code if any deletion fails; continue past failures and report at the end.
Willing to contribute
Happy to open a PR for part (1) — the prune subcommand using existing APIs — if the design above sounds reasonable. Please confirm the flag names / defaults / namespace (actors prune vs. a subcommand under actors rm).
Surfaced during an evaluation of Apify surfaces for agent-driven Actor development.
Problem
Users who iterate on Actor development — especially in automated / scripted / evaluation workflows — accumulate large numbers of one-off test Actors in their account. There is currently no first-class CLI affordance for cleaning them up in bulk:
apify actors rm <name>requires the exact name and only removes one Actor at a time.apify actors lsprints a table but there is no way to pipe or filter its output intormfrom within the CLI.In a recent scripted workflow that pushed a fresh Actor per test run, 20+ orphan Actors accumulated in a single account within a few days. Users have to either write a shell loop around
apify client/ the REST API, or clean up manually in the console.Proposal
1.
apify actors prune— bulk-delete filtered Actors--older-than 7d— only Actors whosemodifiedAt(orcreatedAt) is older than the given duration. Accept1h,24h,7d,30d.--name-pattern '^test-'— only Actors whose name matches the regex.--dry-run— print the list of Actors that would be deleted, do not delete.--yes— skip interactive confirmation (safe default is to confirm).Implementation sketch: use the existing
apify-clientactors().list()+actor(id).delete()— no server-side changes required.2. (optional, larger)
apify push --temporary+ server-side TTLA follow-up that would require apify-core support: allow
apify push --temporaryto mark an Actor as ephemeral (e.g. auto-deleted after N days of no runs).apify actors prune --temporary-onlycould then target only those. This is out of scope for the CLI-only PR above and would need a separate design discussion with apify-core.Alternatives considered
apify actors ls --json | jq ... | xargs apify actors rm— works today but is fragile (name parsing, quoting, error handling), and requiresjq+ shell-fu that not all users have.Test plan
apify actors prune --dry-run --older-than 30dprints candidates, deletes nothing.apify actors prune --name-pattern '^ci-test-' --yesdeletes only matching Actors.--yesis not passed and stdin is a TTY.Willing to contribute
Happy to open a PR for part (1) — the
prunesubcommand using existing APIs — if the design above sounds reasonable. Please confirm the flag names / defaults / namespace (actors prunevs. a subcommand underactors rm).Surfaced during an evaluation of Apify surfaces for agent-driven Actor development.