Add Javascript orchestration for each loop in the AI Chatbot/Assistants API
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3527874. -->
Reported by: [marcus_johansson](https://www.drupal.org/user/385947)
Related to !645
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>See motivation here <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/ai/issues/3527867" title="Status: Closed (fixed)">#3527867: Research best way to return constant feedback and do long running tasks in a chatbot</a></span>. This is the issue that solves the inital step of having a javascript orchestrator.</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<ul>
<li>Add in the assistant api, so it keeps the state of the agent after one loop.</li>
<li>Return in the assistant api, the tools that will be used and/or the textual message.</li>
<li>Showcase next step(s) or text in the chatbot.</li>
<li>If tools where being used, trigger the next request.</li>
<li>Otherwise work as normally.</li>
<li>We do not need to store the steps in the chat history on reload.</li>
</ul>
issue