# Avoid dead loops

Sometimes you might see the message **MAX\_ACTIONS exceeded** in your AI workflow:

<figure><img src="/files/pIiMP7ktJrAdBq2Y9km7" alt=""><figcaption></figcaption></figure>

This error occurs when an infinite loop (without user interaction) is accidentally created between [Blocks](/ai-chatbots-and-automation/visual-builder-101/how-to-create-a-block.md):

<figure><img src="/files/QbqvJrnFjuzH7k9buKbN" alt=""><figcaption></figcaption></figure>

The system limits the number of Actions that can run without user interaction. Each time the user interacts, the MAX\_ACTIONS counter is reset.

In some cases, a loop in the background is useful — for example, when polling a remote API until the required data is available. If you expect the loop to run many times, you can prevent the **MAX\_ACTIONS exceeded** error by adding a **Wait Action** with at least 1 second of delay inside the loop:

<figure><img src="/files/kJVUzuv9k520FSevl346" alt=""><figcaption></figcaption></figure>

Keep in mind that any Flow without user interaction — including loops — can run for a maximum of 4 hours. After this time, the Flow will stop automatically at whatever step it has reached.

If you have questions about Tiledesk features feel free to send an email to [support@tiledesk.com  ](mailto:support@tiledesk.com)or leave us a [feedback](https://feedback.tiledesk.com/feedback)


---

# 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://guide.tiledesk.com/ai-chatbots-and-automation/visual-builder-101/avoid-dead-loops.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.
