Skip to content

docs: Update best practices for PPE Actors and mention negative profit - #2770

Merged
szaganek merged 7 commits into
masterfrom
ppe-best-practices
Jul 22, 2026
Merged

docs: Update best practices for PPE Actors and mention negative profit#2770
szaganek merged 7 commits into
masterfrom
ppe-best-practices

Conversation

@szaganek

@szaganek szaganek commented Jul 15, 2026

Copy link
Copy Markdown
Contributor
  • Adds a section on events
  • Adds a section on graceful abort
  • Adds a section on avoiding negative profit
  • Extends the section on respecting user limits
  • Removes fluff and repeated info

Preview: https://pr-2770.preview.docs.apify.com/actors/publishing/monetize/pay-per-event

Closes #2634.

@szaganek
szaganek requested review from a team, TC-MO, lisvrijsen and stetizu1 July 15, 2026 10:09
@szaganek szaganek self-assigned this Jul 15, 2026
@szaganek szaganek added documentation Improvements or additions to documentation. t-docs Issues owned by technical writing team. labels Jul 15, 2026
@apify-service-account

apify-service-account commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🗑️ Preview for this PR was deleted.

@lisvrijsen lisvrijsen 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.

Looks and reads really good. Huge improvement!

What do you think about explicitly stating that the developer should test their Actor with an invalid input? Just charging for an invalid input doesn't necessarily cover the entire platform cost. If the Actor takes 10 min to handle the invalid input, and it charges for 1 event only, then the cost is still a lot higher.

@stetizu1 stetizu1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry I did not say which comments are actually important and which are nits (the most important are the ones that I see something factual is confusing)

  • and in some you do have the information that I was missing, it is just more down the document. In these cases, maybe add a link. Thanks.

Comment thread sources/platform/actors/publishing/monetize/pay_per_event.mdx Outdated
Comment thread sources/platform/actors/publishing/monetize/pay_per_event.mdx Outdated
Comment thread sources/platform/actors/publishing/monetize/pay_per_event.mdx Outdated
Comment thread sources/platform/actors/publishing/monetize/pay_per_event.mdx Outdated
Comment thread sources/platform/actors/publishing/monetize/pay_per_event.mdx Outdated
Comment thread sources/platform/actors/publishing/monetize/pay_per_event.mdx
Comment thread sources/platform/actors/publishing/monetize/pay_per_event.mdx Outdated
Comment thread sources/platform/actors/publishing/monetize/pay_per_event.mdx
Limit the number of events. Fewer events make it easier for users to understand your pricing and predict the costs.

For Actors that produce data, events should map to something concrete in the user's dataset or storage.
Avoid cases where producing a single result triggers too many events. It makes your Actor more expensive.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmm, this goes against our google maps scraper 😅 Do we want to present this? It seems like common knowledge.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Don't underestimate people 🥲

Comment thread sources/platform/actors/publishing/monetize/pay_per_event.mdx Outdated
@szaganek
szaganek requested a review from stetizu1 July 20, 2026 07:22

@stetizu1 stetizu1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍


Synthetic events are predefined by Apify and charged automatically:

- [`apify-actor-start`](#synthetic-start-event) reduces the costs of starting the Actor.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What I meant originally was that I would also expect info in this one sentence what it actually charges for (gb of memory) - to be consistent with result - but if you think this makes more sense, keep it.

Your profit is calculated from the mentioned formula:
### Get event names

To retrieve the list of all chargeable event names for your Actor, use the [Get Actor](/api/v2/act-get) API endpoint.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I didn't even know that 😅


:::caution Non-graceful aborts are default behavior

A non-graceful abort stops the run immediately, without emitting `aborting`, so your handler never runs. Don't rely on it and charge for work as soon as it's done. For details, see [Respect user spending limits](#respect-user-spending-limits).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does user-spending-limits have anything in common with non-graceful aborts? They are done manualy

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's linked since that section focuses on charging work as soon as it's done 🤔 Well, it's definitely not the last rewrite for this article.

@TC-MO TC-MO left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Few thoughts and visual nits, otherwise LGTM

Comment thread sources/platform/actors/publishing/monetize/pay_per_event.mdx Outdated
Comment thread sources/platform/actors/publishing/monetize/pay_per_event.mdx Outdated
Comment thread sources/platform/actors/publishing/monetize/pay_per_event.mdx Outdated
Comment on lines +463 to +466
- `post` event: Each charge adds one social media post to the dataset.
- `profile` event: Each charge adds one user profile to the dataset.
- `processed-image` event: Each charge adds one processed image to the dataset.
- `ai-analysis` event: Each charge processes one document through an AI workflow.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

perhaps a table instead of bullet list?

@szaganek
szaganek merged commit 1c56889 into master Jul 22, 2026
16 checks passed
@szaganek
szaganek deleted the ppe-best-practices branch July 22, 2026 06:24
szaganek added a commit to apify/apify-sdk-js that referenced this pull request Jul 28, 2026
- Removes outdated info on Actors running indefinitely.
- Restructures the whole guide.
- Adds missing sections so both SDKs can mirror each other better
([Python PR](apify/apify-sdk-python#1064))

Related to the recent updates to platform docs
[#2770](apify/apify-docs#2770).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation. t-docs Issues owned by technical writing team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clarify how to deal with negative profit

6 participants