# Tasks

A task is like a ”secondary action” assigned to an endpoint. The primary action is the \<success> and \<error> action described in [Types of Endpoints](/open-endpoints/configuration/types-of-endpoints.md). The "secondary" action may contain zero or many tasks, that will be executed once the primary action has been completed successfully.

{% hint style="info" %}
**Task vs Primary Action**

The task does some action, but the response body of the task is not part of the response to the client's request. The response to the request might be a simple "status 200", while the request had triggered the execution of a task which did have a response body.
{% endhint %}

With a task you can

* send a request to any API => [HttpRequest Task](/open-endpoints/configuration/tasks/httprequest-task.md)
* send emails with attachments => [Email Task](/open-endpoints/configuration/tasks/email-task.md)

Each \<task> is a set of commands embedded into an endpoint-definition in the endpoints.xml:

```xml
<endpoint name="foo">
    <success>...</success>
    <error>...</error>
    <!-- zero or many tasks -->
    <task class="...">
       ...
    </task>
    <task class="...">
       ...
    </task>
</endpoint>
```

### Parallel or Subsequent Execution of Tasks

Offer-Ready uses multiple cores, if available. If not specified otherwise, tasks are executed in parallel and will be finished in an arbitrary order. In order to determine a distinctive order of tasks, read [Parallel or Subsequent Execution of Tasks](/open-endpoints/configuration/tasks/parallel-or-subsequent-execution-of-tasks.md).

### Intermediate Values

If a task requires the output from a second task as an output, you may use [Intermediate Values](/open-endpoints/configuration/tasks/intermediate-values.md).


---

# 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://onestopconcept.gitbook.io/open-endpoints/configuration/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.
