# Tasks

Tasks are the basic unit of work in a Workflow.

Similarly to Workflows, when a Task is referenced, it could be referring to either a Task Definition or a Task Run.

### Task Definition

A Task Definition outlines what the specific step of the given Workflow Definition is responsible for executing. This could be, for example, interacting with a smart contract (calling a specific method), calling an API endpoint, invoking an AWS Lambda function or sending a notification email. A Task Definition is named using kebab-case (e.g., `my-task`).

The default Task of any Workflow Definition is sending a webhook to your application's configured `webhook_url` using the `send-webhook` Task Definition.

### Task Run

A Task Run is a specific instance (execution) of a Task Definition and will be attached to a Workflow Run. A Task Run is assigned a unique prefixed ID, e.g., `task_4eC39HqLyjWDarjtT1zdp7dc`.

Task Runs are passed the Workflow Run context, which they can modify before returning the context to the Workflow ready for the downstream Task (if one exists).

#### Task State

A Task Run can be in any of the following states:

<table><thead><tr><th width="185">State</th><th>Description</th></tr></thead><tbody><tr><td><code>none</code></td><td>The task is not yet ready to run (upstream tasks are still pending or failed).</td></tr><tr><td><code>pending</code></td><td>The task is pending execution.</td></tr><tr><td><code>queued</code></td><td>The task has been queued and is awaiting a Worker slot.</td></tr><tr><td><code>running</code></td><td>The task is running on a Worker.</td></tr><tr><td><code>success</code></td><td>The task completed successfully.</td></tr><tr><td><code>shutdown</code></td><td>The task received an external signal to shutdown during execution.</td></tr><tr><td><code>restarting</code></td><td>The task received an external signal to restart during execution.</td></tr><tr><td><code>failed</code></td><td>The task failed.</td></tr><tr><td><code>pending_retry</code></td><td>The task failed but has retry attempts remaining.</td></tr></tbody></table>
