> For the complete documentation index, see [llms.txt](https://guide.tiledesk.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guide.tiledesk.com/ai-chatbots-and-automation/visual-builder-101/avoid-dead-loops.md).

# Avoid dead loops

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

<figure><img src="https://1328774413-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVguk6y5OMn3pAaHZSiwU%2Fuploads%2FR87mbp4m8NlGbpyaX3SP%2FGuide%20Articles%20(8).png?alt=media&amp;token=882b6ab7-4daf-4992-832e-92abbfb60669" 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="https://1328774413-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVguk6y5OMn3pAaHZSiwU%2Fuploads%2Ff8RA0lrbqxOdvqvtt2Ye%2F2z9sl5-image.png?alt=media&amp;token=7fd93dc5-08d6-40d7-a924-b0e66121d45d" 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="https://1328774413-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVguk6y5OMn3pAaHZSiwU%2Fuploads%2Fb7JM55r9OwAsAVhT8ssP%2F2zvva4-image.png?alt=media&amp;token=7a9f89a9-40fd-483c-93d5-0556d15c6f60" 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://guide.tiledesk.com/ai-chatbots-and-automation/visual-builder-101/avoid-dead-loops.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
