[Discuss] Create a way to extend an agent

Created on 25 August 2025, 20 days ago

Problem/Motivation

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).

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.

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:

1. You install the recipe that configures the sub-agent.
2. On your orchestration agent you have to check that sub-agent.
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.

We need a way to build those steps into recipes or come up with some custom solution for it.

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.

Proposed resolution

  • 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.
  • Add a text parameter to add to the parent agents prompt. It's not required.
  • Add a parameter to prefix, suffix or replace a portion of the prompt. Default to suffix.
  • Add a parameter for replacement string, if replace is picked.
  • 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.

So something like this:

config:
  actions:
    ai_agents.ai_agent.drupal_cms_assistant:
      attachToParentAgent:
        parent_agent: drupal_cms_assistant #Might be redundant?
        tools:
          - some_subagent_id
        system_prompt_modification: "what to think about.\n\nThis subagent should be called when ..."
        system_prompt_order: replace
        system_prompt_replace: "what to think about."
🌱 Plan
Status

Active

Version

1.2

Component

Code

Created by

🇩🇪Germany marcus_johansson

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @marcus_johansson
  • 🇩🇪Germany marcus_johansson

    So a big flaw I see with this solution is if a module updates an agent controlled by a module, like the XB AI orchestration agent via an update hook anything that got changed would get reset.

    I think this is in general a problem though, unless we want to have hidden hooks from agents, etc.

  • 🇨🇦Canada jibran Toronto, Canada

    Let me describe the problem in simplified form, without all the recipe shenanigans. Feel free to correct me, I didn't understand the underlying problem.

    I have an agent (let's call it a parent agent), and I want to override various settings provided by the parent agent, such as prompts, tools, and other settings.

    1. If it is an AiAgent plugin, then the new agent can extend the parent agent and override the appropriate functionality. I don't think this will work with recipes, but it might work for install profiles.
    2. If it is an AiAgent config entity, then we should add a new AiAgentOverride config entity. This entity has a field/property called parent_agent and several conditional fields/properties that can be used to extend or override prompts, tools, and other settings. The recipe can be shipped with AiAgentOverride export and with a dependency on the parent agent config.

    In theory, the new config entity AiAgentOverride creates a new instance of the parent agent with the overrides.

    Does it make sense, or did I totally miss the mark? 😀️

  • 🇩🇪Germany marcus_johansson

    That problem sounds about right - ship a subagent, but make it possible to attach to a known parent agent.

    We only need to solve it for #2.

    The best would be if its possible to do, without having to write a single line of code, just configuration.

Production build 0.71.5 2024