Skip to main content
Task run events track the lifecycle of every task run within a flow. They are emitted on every state transition, mirroring the structure of flow run state events.

prefect.task-run.{state}

Emitted each time a task run transitions to a new state. The {state} suffix is the state name (for example, prefect.task-run.Running or prefect.task-run.Completed).
Task state transitions are managed locally by the task engine, not proposed to the server like flow run states. The task engine emits these events and delivers them via the events system.

State variants

State nameState typeDescription
ScheduledSCHEDULEDTask is scheduled for execution
LateSCHEDULEDScheduled task was not started on time
AwaitingConcurrencySlotSCHEDULEDWaiting for a concurrency slot
AwaitingRetrySCHEDULEDWaiting before a retry attempt
PendingPENDINGTask is ready to execute
RunningRUNNINGTask is actively executing
RetryingRUNNINGTask is retrying after a failure
CompletedCOMPLETEDTask finished successfully
FailedFAILEDTask finished with an error
CrashedCRASHEDTask terminated unexpectedly
CancelledCANCELLEDTask was cancelled
CancellingCANCELLINGCancellation was requested but not yet confirmed
PausedPAUSEDTask is paused
SuspendedPAUSEDTask is suspended

Resource

LabelDescription
prefect.resource.idprefect.task-run.{uuid}
prefect.resource.nameTask run name
prefect.run-countNumber of times this task run has been attempted
prefect.state-messageMessage associated with the state transition (truncated to 100,000 characters)
prefect.state-nameState name (for example, Running)
prefect.state-timestampISO 8601 timestamp of the state transition
prefect.state-typeState type enum value (for example, RUNNING, COMPLETED)
prefect.orchestrationAlways client (task state transitions are managed locally)
Resource ID patternRoleWhen present
prefect.tag.{tag}tagOne entry per tag on the task run
Unlike flow run events, task run state events do not include the parent flow run, flow, or deployment as related resources. Task run context (including the parent flow run ID) is available in the event payload under task_run.

Payload

FieldTypeDescription
intended.fromstring or nullState type of the initial state (null for the first transition)
intended.tostringState type of the validated (new) state
initial_stateobject or nullPrevious state: type, name, message, state_details
validated_stateobjectNew state: type, name, message, state_details, and data (result metadata when result persistence is enabled)
task_runobjectTask run metadata including name, task_key, dynamic_key, flow_run_id, tags, and task_inputs