Add possibility to check if a tool was run
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3548107. --> Reported by: [marcus_johansson](https://www.drupal.org/user/385947) Related to !198 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>While <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-1"><a href="https://www.drupal.org/project/ai_agents/issues/3548000" title="Status: Active">#3548000: Add possibility to run a tool at a specific order</a></span> would take care of forcing providers to use a tool, sometimes we might not know when we want a tool to run, but we do know that the agent should run it before its finished.</p> <p>An example would be for instance a validation agent, even if the instructions are completely off what it should be doing, should still use the validation tool to decline the instructions.</p> <p>We can do this outside of provider methods, by having a deterministic check at the end of the agent run and if the tool was not used, we do not end the agent, but add another user message with a predfined configurable message.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <ul> <li>Add a configuration per tool that you can force it to have run.</li> <li>Add a configuration of the instruction to send if it didn't run, but the agent still assumes it is finished.</li> <li>On the runner have a check that all configured "force to run" tools have run, if not we append a user message and start another loop.</li> </ul>
issue