# Long Running Tasks

Often, when invoking an action, the AI assistant expects a response within a very short time (typically the timeout is around 10 seconds, although many AI providers allow this to be configured). However, some robotics tasks—such as those involving robot motion—require significantly more time to complete.

To support long-running tasks, you can use the [return message](/ai-coworker/return-message.md) function at the beginning of your action to immediately send an acknowledgment (for example, **“Task started”**), and then continue with the actual action implementation in your code. This approach allows the AI assistant to receive an immediate response while the robot continues executing the task asynchronously.

Optionally, you can also implement a separate action that allows the user to query the task status and receive updates on its progress.

{% hint style="info" %}
If you want to provide the task status action:

* You can store the task status / progress into an installation variable.
* Set the action scope as **Background** to use the action while the primary one is running.
  {% endhint %}

{% columns %}
{% column %}

<figure><img src="/files/RlKvotTpzQz0aRZzeO4T" alt=""><figcaption><p>Action to start the long running task</p></figcaption></figure>
{% endcolumn %}

{% column %}

<figure><img src="/files/zwn1DxnsseOff3byqirZ" alt=""><figcaption><p>Action to get the task status</p></figcaption></figure>
{% endcolumn %}
{% endcolumns %}


---

# 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.robpod.cloud/ai-coworker/long-running-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.
