Create a way to extend an agent
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3542955. --> Reported by: [marcus_johansson](https://www.drupal.org/user/385947) Related to !195 >>> <p>--- AI TRACKER METADATA ---<br> <strong>Update Summary: </strong>Discuss how to extend agents.<br> <strong>Check-in Date: </strong>MM/DD/YYYY (US format) [When we should see progress/get an update]<br> <strong>Due Date:</strong> MM/DD/YYYY (US format) [When the issue should be fully completed]<br> <strong>Blocked by:</strong> [#XXXXXX] (New issues on new lines)<br> <strong>Additional Collaborators:</strong> @nikro, @abhisekmazumdar<br> AI Tracker found here: <a href="https://www.drupalstarforge.ai/" title="AI Tracker">https://www.drupalstarforge.ai/</a><br> --- END METADATA ---</p> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>In Drupal CMS we currently have three sub-agents specializing on their own field and an orchestration agent for this. One of the cool things with recipes is that in theory it should be possible to extend the main chatbot with any type of agent functionality you want (within context/token limits).</p> <p>This means that someone could create a very specific subagent, like a Matomo setup bot or something very specific that maybe less then 1% of the Drupal CMS crowd will be interested in, and it still will serve a purpose, since you have written a working prompt and working tools for it.</p> <p>But the problem is that if someone wants to install that, its not so easy right now. The steps at the moment that would have to happen is:</p> <p>1. You install the recipe that configures the sub-agent.<br> 2. On your orchestration agent you have to check that sub-agent.<br> 3. Agent descriptions should work, but in edge cases to make sure that the orchestration agent knows when and what requests should forwarded to the Matomo agent, you might need to add some instructions on the orchestration agent. </p> <p>We need a way to build those steps into recipes or come up with some custom solution for it.</p> <p>This issue is for a discussion and this is just to get the ball running, before we start working on it. Any ideas would help here.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <ul> <li>Add a recipe action, where a recipe can input what agent it should attach to and a list of what tools should be added to it. This is required.</li> <li>Add a text parameter to add to the parent agents prompt. It's not required.</li> <li>Add a parameter to prefix, suffix or replace a portion of the prompt. Default to suffix.</li> <li>Add a parameter for replacement string, if replace is picked.</li> <li>Add a parameter if it should fail, if the parent agent does not exist. This means that the action looks for the agent id and depending on this parameter it fails or just silently does nothing.</li> </ul> <p>So something like this:</p> <pre>config:<br>&nbsp; actions:<br>&nbsp;&nbsp;&nbsp; ai_agents.ai_agent.drupal_cms_assistant:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; attachToParentAgent:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; parent_agent: drupal_cms_assistant #Might be redundant?<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tools:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - some_subagent_id<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; system_prompt_modification: "what to think about.\n\nThis subagent should be called when ..."<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; system_prompt_order: replace<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; system_prompt_replace: "what to think about."</pre>
issue