feat: pay-per-event pricing - #148
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
|
Worth discussion:
|
|
Charging too early inside the handler may go to retries. Charging at the end means it races the response in Standby so we can loose event. |
|
Yeah, I would prefer charging for search only when we actually got successful SERP response |
Moves RAG Web Browser to pay-per-event pricing with three events: actor-start (Normal mode only, once per run), search (once per query, both modes) and fetch (once per extracted page, both modes).
Charging moves into src/charging.ts, driven by per-mini-actor chargeEvents. In Standby the charge is attributed to the caller through x-actor-request-id and is always awaited before the response is sent, since the request ID is only valid while its request is in flight.
URL to Markdown's charging is deliberately left as it behaves today: same events, same moment of charging, same skip when a Standby request carries no request ID. The one place the two Actors differ is that no-request-ID branch: for single-tenant Standby the run belongs to the caller, so charging its owner is still correct, while for multi-tenant it would bill us. standbyTenancy in src/mini-actors.ts keeps them apart.
Also hides the serpProxyGroup input from the UI. its enum had to go, because a string field carrying an enum may only use editor: "select" and rewrites the README pricing section, which still claimed the Actor was free of charge.
Verified with local runs under ACTOR_TEST_PAY_PER_EVENT: a normal run charges actor-start + fetch, a search run adds search, and a run on the current compute-unit pricing charges nothing at all.
Needs Console setup. The platform's automatic apify-actor-start event must be set to $0, otherwise it duplicates Actor Start.
Closes #146