website/src/content/docs/actors/input.mdx
Actors can receive input parameters when created, allowing for flexible initialization and configuration. Input is passed during actor creation and is available in lifecycle hooks.
Input is provided when creating actor instances using the input property:
Input is available as the second argument to the createState and onCreate lifecycle hooks:
You can validate input parameters in the createState or onCreate hooks:
Input parameters are different from connection parameters:
Define input types to ensure type safety:
<CodeSnippet file="examples/docs/actors-input/type-safety.ts" />Input is only available in createState and onCreate lifecycle hooks. If you need to access input data later (in actions, timers, or other hooks), store it in the actor's state during creation. This is the recommended pattern because input shapes can evolve over time, and persisting input in state ensures you always have access to the values the actor was created with:
CreateOptions - Options for creating actorsCreateRequest - Request type for creationActorDefinition - Actor definition returned by actor()