# Need Help with Branching Flow and Looping Actions for LLM Integration

**URL:** <https://forum.rasa.com/t/need-help-with-branching-flow-and-looping-actions-for-llm-integration/65184>\
**Category:** Rasa Open Source\
**Created:** [January 13, 2025, 1:20am UTC](https://forum.rasa.com/t/need-help-with-branching-flow-and-looping-actions-for-llm-integration/65184 "2025-01-13T01:20:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreyrcdias](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@andreyrcdias](https://forum.rasa.com/u/andreyrcdias)\
**Post date:** [January 13, 2025, 1:20am UTC](https://forum.rasa.com/t/need-help-with-branching-flow-and-looping-actions-for-llm-integration/65184/1 "2025-01-13T01:20:43Z")

</div>

Hello everyone.

I am currently developing a chatbot that successfully handles chitchat and FAQs. I am looking to enhance its functionality by implementing a flow that interacts with an external large language model (LLM) through actions.

Specifically, I want to achieve the following:

- When a user requests to “Speak with the AI,” I would like to save this interaction and ensure that all subsequent interactions are redirected to the external LLM action.

Here’s some snippets

```yaml
# domain.yaml
  utter_menu:
  - text: "Which flow do you wanna to follow?"
    buttons:
    - title: "FAQ"
      payload: "/faq"
    - title: "Talk with AI"
      payload: "/talk_with_ai"

  utter_faq:
  - text: "Now you will see the FAQ"

  utter_talk_with_ai:
  - text: "Now you call talk with the AI"

```

```yaml
# stories.yaml
- story: faq
  steps:
  - intent: menu
  - action: utter_menu
  - intent: faq
  - action: utter_faq

- story: talk with ai
  steps:
  - intent: menu
  - action: utter_menu
  - intent: talk_with_ai
  - action: utter_talk_with_ai
  - action: action_talk_with_ai

```

I don’t know if it would be ideal here to use a fallback to direct messages to an LLM action ([RasaGPT](https://github.com/paulpierre/RasaGPT/blob/2f1051031a3883397879ae113ac9dd35b4c8d0cf/app/rasa/actions/actions.py#L26) project uses this approach). I was thinking about controlling more through entity or slots, and always checking the flow that should follow.

Im using Rasa `3.6.20` and Python `3.10.10`

If there is any similar topic, let me know.

---

<div class="post-metadata">

**Author:** ![andreyrcdias](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@andreyrcdias](https://forum.rasa.com/u/andreyrcdias)\
**Post date:** [April 12, 2025, 8:58pm UTC](https://forum.rasa.com/t/need-help-with-branching-flow-and-looping-actions-for-llm-integration/65184/2 "2025-04-12T20:58:10Z")

</div>

I managed to solve my problem and the details are here in this **[post](https://forum.rasa.com/t/need-guidance-on-action-loops/66687)**.
