Change the default name of subagents to ai_agents::ai_agent::{name}

Created on 27 May 2025, 9 days ago

Problem/Motivation

Currently the only way you can check the difference between a tool and an agent as a tool is to look for the custom_type definition in the Function Call plugin manager or to check if it extends a specific interface. Both thing can be performant and time consuming.

Since the config agents will be the default way of doing agents in AI 2.0.0, we should already setup tool names that will be easily repriducable then. This means to store them similar to the id of the config agent.

Unfortunately plugin systems doesn't allow dots, so we would go with colon. Just to make sure that it will not collide, we should use double colon.

So the Agent Marcus Agent, that has the config name ai_agents.ai_agent.marcus_agent becomes ai_agents::ai_agent::marcus_agent.

Proposed resolution

Set so the tools that exposes agents with id's will be named ai_agents::ai_agent::{config_name}.
Create an update script that updates the current agents that are using a subagent.

📌 Task
Status

Active

Version

1.1

Component

Code

Created by

🇩🇪Germany marcus_johansson

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

Merge Requests

Comments & Activities

  • Issue created by @marcus_johansson
  • First commit to issue fork.
  • 🇮🇳India anjaliprasannan

    I wanted to confirm before applying the fix.
    Changes that I plan to do are:

    • Update the ai_agents.module file to change the format of agent tool IDs from ai_agent:{config_name} to ai_agents::ai_agent::{config_name}.
    • Create an update hook ai_agents_update_9001() in ai_agents.install that: Loads all AI agent entities
    • For each entity, update the tool IDs in the tools array to use the new double colon format

    If this fix is correct I can continue creating the MR.

  • Pipeline finished with Failed
    8 days ago
    Total: 162s
    #509017
  • Pipeline finished with Failed
    8 days ago
    Total: 162s
    #509043
  • Pipeline finished with Success
    8 days ago
    Total: 167s
    #509044
  • 🇧🇬Bulgaria valthebald Sofia

    @anjaliprasannan I've added some code style comments

  • Pipeline finished with Success
    4 days ago
    Total: 200s
    #511998
  • 🇩🇪Germany marcus_johansson

    Added on comment that needs fixing.

  • Pipeline finished with Failed
    3 days ago
    Total: 152s
    #512841
  • Pipeline finished with Failed
    3 days ago
    Total: 148s
    #512853
  • Pipeline finished with Success
    3 days ago
    Total: 151s
    #512856
  • Pipeline finished with Failed
    3 days ago
    Total: 163s
    #512960
  • Pipeline finished with Success
    3 days ago
    Total: 143s
    #512964
  • 🇮🇳India annmarysruthy

    Tested the changes. After applying the MR and running drush updb, agent tool IDs are updated to the new double-colon format (ai_agents::ai_agent::{config_name}). Verified using:

    ddev drush ev "\$defs = \Drupal::service('plugin.manager.ai.function_calls')->getDefinitions(); foreach (\$defs as \$id => \$def) { echo \$id . ': ' . (\$def['group'] ?? 'none') . ' / ' . (\$def['custom_type'] ?? 'none') . PHP_EOL; }"

    Output before applying MR and running drush updb:

    action_plugin:node_make_unsticky_action: drupal_actions / none
    action_plugin:node_promote_action: drupal_actions / none
    action_plugin:node_make_sticky_action: drupal_actions / none
    action_plugin:node_unpromote_action: drupal_actions / none
    action_plugin:user_unblock_user_action: drupal_actions / none
    action_plugin:user_add_role_action: drupal_actions / none
    action_plugin:user_block_user_action: drupal_actions / none
    action_plugin:user_remove_role_action: drupal_actions / none
    action_plugin:entity:save_action:block_content: drupal_actions / none
    action_plugin:entity:save_action:comment: drupal_actions / none
    action_plugin:entity:save_action:file: drupal_actions / none
    action_plugin:entity:save_action:menu_link_content: drupal_actions / none
    action_plugin:entity:save_action:node: drupal_actions / none
    action_plugin:entity:save_action:taxonomy_term: drupal_actions / none
    action_plugin:entity:save_action:user: drupal_actions / none
    action_plugin:action_message_action: drupal_actions / none
    action_plugin:action_goto_action: drupal_actions / none
    action_plugin:entity:publish_action:block_content: drupal_actions / none
    action_plugin:entity:publish_action:comment: drupal_actions / none
    action_plugin:entity:publish_action:menu_link_content: drupal_actions / none
    action_plugin:entity:publish_action:node: drupal_actions / none
    action_plugin:entity:publish_action:path_alias: drupal_actions / none
    action_plugin:entity:publish_action:taxonomy_term: drupal_actions / none
    action_plugin:entity:unpublish_action:block_content: drupal_actions / none
    action_plugin:entity:unpublish_action:comment: drupal_actions / none
    action_plugin:entity:unpublish_action:menu_link_content: drupal_actions / none
    action_plugin:entity:unpublish_action:node: drupal_actions / none
    action_plugin:entity:unpublish_action:path_alias: drupal_actions / none
    action_plugin:entity:unpublish_action:taxonomy_term: drupal_actions / none
    action_plugin:action_send_email_action: drupal_actions / none
    ai_agent:get_entity_type_field_storage: information_tools / none
    ai_agent:list_config_entities: information_tools / none
    ai_agent:get_field_display_form: information_tools / none
    ai_agent:list_field_display_types: information_tools / none
    ai_agent:edit_content_type: modification_tools / none
    ai_agent:list_taxonomy_term: information_tools / none
    ai_agent:content_entity_seeder: modification_tools / none
    ai_agent:get_current_content_entity_values: information_tools / none
    ai_agent:get_config_schema: information_tools / none
    ai_agent:manipulate_field_config: modification_tools / none
    ai_agent:get_entity_field_information: information_tools / none
    ai_agent:get_field_values_and_context: information_tools / none
    ai_agent:list_bundles: information_tools / none
    ai_agent:get_field_storage_form: information_tools / none
    ai_agent:content_entity_field_value: entity_tools / none
    ai_agent:content_entity_field_values_list: entity_tools / none
    ai_agent:create_agent_config_tools_enabled:  / none
    ai_agent:vision: information_tools / none
    ai_agent:modify_taxonomy_term: modification_tools / none
    ai_agent:create_field_storage_config: modification_tools / none
    ai_agent:get_field_config_form: information_tools / none
    ai_agent:web_scraper: information_tools / none
    ai_agent:list_field_types: information_tools / none
    ai_agent:list_entity_types: information_tools / none
    ai_agent:modify_bundle_type: modification_tools / none
    ai_agent:get_field_storage: information_tools / none
    ai_agent:list_content_entities: information_tools / none
    ai_agent:get_field_config: information_tools / none
    ai_agent:get_content_type_info: information_tools / none
    ai_agent:manipulate_field_display_form: modification_tools / none
    ai_agent:create_content_type: modification_tools / none
    ai_agent:modify_vocabulary: modification_tools / none
    ai_search:rag_search: information_tools / none
    ai_agent:taxonomy_agent: agent_tools / none
    ai_agent:node_content_type_agent: agent_tools / none
    ai_agent:field_type_agent: agent_tools / none

    Output after applying MR and running drush updb:

    action_plugin:node_make_unsticky_action: drupal_actions / none
    action_plugin:node_promote_action: drupal_actions / none
    action_plugin:node_make_sticky_action: drupal_actions / none
    action_plugin:node_unpromote_action: drupal_actions / none
    action_plugin:user_unblock_user_action: drupal_actions / none
    action_plugin:user_add_role_action: drupal_actions / none
    action_plugin:user_block_user_action: drupal_actions / none
    action_plugin:user_remove_role_action: drupal_actions / none
    action_plugin:entity:save_action:block_content: drupal_actions / none
    action_plugin:entity:save_action:comment: drupal_actions / none
    action_plugin:entity:save_action:file: drupal_actions / none
    action_plugin:entity:save_action:menu_link_content: drupal_actions / none
    action_plugin:entity:save_action:node: drupal_actions / none
    action_plugin:entity:save_action:taxonomy_term: drupal_actions / none
    action_plugin:entity:save_action:user: drupal_actions / none
    action_plugin:action_message_action: drupal_actions / none
    action_plugin:action_goto_action: drupal_actions / none
    action_plugin:entity:publish_action:block_content: drupal_actions / none
    action_plugin:entity:publish_action:comment: drupal_actions / none
    action_plugin:entity:publish_action:menu_link_content: drupal_actions / none
    action_plugin:entity:publish_action:node: drupal_actions / none
    action_plugin:entity:publish_action:path_alias: drupal_actions / none
    action_plugin:entity:publish_action:taxonomy_term: drupal_actions / none
    action_plugin:entity:unpublish_action:block_content: drupal_actions / none
    action_plugin:entity:unpublish_action:comment: drupal_actions / none
    action_plugin:entity:unpublish_action:menu_link_content: drupal_actions / none
    action_plugin:entity:unpublish_action:node: drupal_actions / none
    action_plugin:entity:unpublish_action:path_alias: drupal_actions / none
    action_plugin:entity:unpublish_action:taxonomy_term: drupal_actions / none
    action_plugin:action_send_email_action: drupal_actions / none
    ai_agent:get_entity_type_field_storage: information_tools / none
    ai_agent:list_config_entities: information_tools / none
    ai_agent:get_field_display_form: information_tools / none
    ai_agent:list_field_display_types: information_tools / none
    ai_agent:edit_content_type: modification_tools / none
    ai_agent:list_taxonomy_term: information_tools / none
    ai_agent:content_entity_seeder: modification_tools / none
    ai_agent:get_current_content_entity_values: information_tools / none
    ai_agent:get_config_schema: information_tools / none
    ai_agent:manipulate_field_config: modification_tools / none
    ai_agent:get_entity_field_information: information_tools / none
    ai_agent:get_field_values_and_context: information_tools / none
    ai_agent:list_bundles: information_tools / none
    ai_agent:get_field_storage_form: information_tools / none
    ai_agent:content_entity_field_value: entity_tools / none
    ai_agent:content_entity_field_values_list: entity_tools / none
    ai_agent:create_agent_config_tools_enabled:  / none
    ai_agent:vision: information_tools / none
    ai_agent:modify_taxonomy_term: modification_tools / none
    ai_agent:create_field_storage_config: modification_tools / none
    ai_agent:get_field_config_form: information_tools / none
    ai_agent:web_scraper: information_tools / none
    ai_agent:list_field_types: information_tools / none
    ai_agent:list_entity_types: information_tools / none
    ai_agent:modify_bundle_type: modification_tools / none
    ai_agent:get_field_storage: information_tools / none
    ai_agent:list_content_entities: information_tools / none
    ai_agent:get_field_config: information_tools / none
    ai_agent:get_content_type_info: information_tools / none
    ai_agent:manipulate_field_display_form: modification_tools / none
    ai_agent:create_content_type: modification_tools / none
    ai_agent:modify_vocabulary: modification_tools / none
    ai_agents::ai_agent::taxonomy_agent: agent_tools / none
    ai_agents::ai_agent::node_content_type_agent: agent_tools / none
    ai_agents::ai_agent::field_type_agent: agent_tools / none
    ai_agents::ai_agent::content_type_agent_triage: agent_tools / none
    ai_agents::ai_agent::field_agent_triage: agent_tools / none
    ai_agents::ai_agent::taxonomy_agent_config: agent_tools / none
    
  • 🇩🇪Germany marcus_johansson

    Thanks all, getting merged

Production build 0.71.5 2024