Skip to main content

Actor input

The Actor gets its input from the input record in its default key-value store.

To access it, instead of reading the record manually, you can use the Actor.get_input convenience method. It will get the input record key from the Actor configuration, read the record from the default key-value store,and decrypt any secret input fields.

For example, if an Actor received a JSON input with two fields, { "firstNumber": 1, "secondNumber": 2 }, this is how you might process it:

from apify import Actor


async def main() -> None:
async with Actor:
actor_input = await Actor.get_input() or {}
first_number = actor_input.get('firstNumber', 0)
second_number = actor_input.get('secondNumber', 0)
Actor.log.info('Sum: %s', first_number + second_number)