Skip to content

fix: add missing max_items to Actor.start, Actor.call and Actor.call_task - #1166

Merged
vdusek merged 2 commits into
masterfrom
feat/max-items
Oct 7, 2026
Merged

vdusek merged 2 commits into
masterfrom
feat/max-items

Conversation

@vdusek

@vdusek vdusek commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Actor.start(), Actor.call() and Actor.call_task() now accept max_items and pass it to the API client. With it, a pay-per-result child run can be capped without going through Actor.apify_client, as the JS SDK already allows.

Closes: #1163

✍️ Drafted by Claude Code

@vdusek vdusek added the t-tooling Issues with this label are in the ownership of the tooling team. label Oct 7, 2026
@vdusek vdusek self-assigned this Oct 7, 2026
@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.92%. Comparing base (32a0a30) to head (e3e01d0).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #1166       +/-   ##
===========================================
+ Coverage   53.03%   92.92%   +39.88%     
===========================================
  Files          53       53               
  Lines        3560     3560               
===========================================
+ Hits         1888     3308     +1420     
+ Misses       1672      252     -1420     
Flag Coverage Δ
e2e 32.61% <ø> (ø)
integration 53.06% <ø> (+0.02%) ⬆️
unit 89.52% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek
vdusek requested review from Mantisus and barjin October 7, 2026 09:21
@vdusek
vdusek marked this pull request as ready for review October 7, 2026 09:21
@apify-service-account apify-service-account added the tested Temporary label used only programatically for some analytics. label Oct 7, 2026

@Mantisus Mantisus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Comment thread src/apify/_actor.py Outdated

@apify-approval-mirror apify-approval-mirror Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mirroring approval from @Mantisus.

@apify-approval-mirror apify-approval-mirror Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mirroring approval from @Mantisus.

@vdusek vdusek changed the title feat: add max_items to Actor.start, Actor.call and Actor.call_task fix: add max_items to Actor.start, Actor.call and Actor.call_task Oct 7, 2026
@vdusek vdusek changed the title fix: add max_items to Actor.start, Actor.call and Actor.call_task fix: add missing max_items to Actor.start, Actor.call and Actor.call_task Oct 7, 2026
@vdusek
vdusek merged commit f68385a into master Oct 7, 2026
31 of 32 checks passed
@vdusek
vdusek deleted the feat/max-items branch October 7, 2026 12:37
Comment thread src/apify/_actor.py
Comment on lines +959 to +960
max_items: Maximum number of dataset items you are charged for, for pay-per-result Actors. It caps the
charge, not the output, so the run can return fewer or more items than this.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Afaik this is a legacy-only option for the PPE Actors (that have been migrated from PPR, which is not a thing anymore).

iirc it only does something in case your Actor has the apify-default-dataset-item event. For other PPE / free Actors, this is no-op. This can imo be surprising, given the very human-friendly name (max_items), which might suggest otherwise.

run = Actor.start('a-ppe-actor', max_items=50) # returns 50 items, as it was PPR before
run = Actor.start('b-ppe-actor', max_items=50) # returns 1000 items, as it implements other events

Can we be perhaps more vocal about this in the docstring (and propose max_total_charge_usd as the better / more modern option)?

Alternatively, we could drop it from the Python SDK altogether, if we haven't released yet 😅

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add max_items to Actor.start(), Actor.call() and Actor.call_task()

4 participants