Apify Discord Mirror

Updated last week

Not able to use PPE in my actor

I have this in my .actor/pay_per_event.json and my calling this in my main.py. And i do get this warning in my terminal 2025-03-08T14:09:14.994Z [apify] WARN Ignored attempt to charge for an event - the Actor does not use the pay-per-event pricing
If i use await Actor.charge('actor-start-gb '), will be correctly using PPE. Please let me know. thank you in advance


{ "actor-start": { "eventTitle": "Price for Actor start", "eventDescription": "Flat fee for starting an Actor run.", "eventPriceUsd": 0.1 }, "task-completed": { "eventTitle": "Price for completing the task", "eventDescription": "Flat fee for completing the task.", "eventPriceUsd": 0.4 } }

main.py
async def main(): """Runs the AI Travel Planner workflow.""" async with Actor: await Actor.charge('actor-start') actor_input = await Actor.get_input() or {} Actor.log.info(f"Received input: {actor_input}") travel_query = TravelState(**actor_input) # Execute workflow final_state = travel_workflow.invoke(travel_query) Actor.log.info(f"Workflow completed. Final state: {final_state}") await Actor.charge('task-completed') # Save the final report await save_report(final_state)
S
A
B
7 comments
@Alexey Udovydchenko can you please help here?
I do not have python examples in hand, but it should be equal to:
Plain Text
    if (Actor.isAtHome() && Actor.getChargingManager().getPricingInfo().isPayPerEvent) {
        if (Actor.getChargingManager().getChargedEventCount('actor-start') === 0) {
            await Actor.charge({ eventName: 'actor-start' });
        }
    }
PPE works only in cloud, should be enabled for the actor settings, then you can charge
Hi @Alexey Udovydchenko
I have just created actor-start-gb and enabled them in the cloud. will it two weeks for them to take effective and i have used the below code to charge them

async def charge_for_actor_start() -> None: """Charges for the Actor start event. This function calculates the memory usage in gigabytes and charges for the Actor start event accordingly. """ count = (Actor.get_env()['memory_mbytes'] or 1024 + 1023) // 1024 await Actor.charge(event_name='actor-start-gb', count=count)


in main.py, i am using this

asyncio.create_task(charge_for_actor_start()
@Alexey Udovydchenko ,
I received this email

Hi Balaji, We want to inform you about the updated pricing model for the AI Travel Assistant (bala-ceg/ai-travel-assistant). Starting from March 27, 2025, you'll pay only for specific events of the Actor, instead of paying for compute, proxies and other dynamic usage costs. The new prices will be: actor-start-gb: $0.20 You can find more information on the new pricing model in the documentation. If you have any questions or need more information, don't hesitate to reach out. This notification relates to your personal account balaji_ceg@outlook.com (bala-ceg).
Add a reply
Sign up and join the conversation on Discord