# 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>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wundaflow.com/core-concepts/tasks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
