RAG action gets unchecked on save, if use agent as assistant not selected.

Created on 28 May 2025, 7 days ago

Problem/Motivation

When trying to add ai assistant with rag action enabled and use agent as assistant not selected. I tried to edit the newly created ai assistant, the rag action gets unchecked.

Steps to reproduce

  • Add a ai assistant at admin/config/ai/ai-assistant
  • Do not select the use agent as assistant
  • Enable the RAG action and save the changes.
  • Edit the newly created assistant to find the Rag action unchecked.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

šŸ› Bug report
Status

Active

Version

1.1

Component

Code

Created by

šŸ‡®šŸ‡³India anjaliprasannan

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

Comments & Activities

  • Issue created by @anjaliprasannan
  • @anjaliprasannan opened merge request.
  • šŸ‡®šŸ‡³India annmarysruthy

    Reviewed the MR and tested the changes. Even after applying the changes, the Enable RAG checkbox will be disabled on each edit , if no agent is selected.

    Kindly check again

  • šŸ‡®šŸ‡³India anjaliprasannan

    Before moving forward with the fix, I want to confirm if the RAG Search dependency on agent selection in AiAssistantForm expected behavior?

    In this code

    if ($form_state->get('agents_enabled') || $form_state->getValue('ai_agent')) {
      // ... other agent logic ...
      if ($form_state->getValue('enable_rag')) {
        $tools['ai_search:rag_search'] = TRUE;
        $tool_usage_limits['ai_search:rag_search'] = [
          // RAG settings
        ];
      }
    }

    RAG functionality is only applied when: The ai_agents module is enabled and an ai_agent is selected in the "Use agent as assistant" field. As a result, if no agent is selected or the ai_agents module is disabled, enabling the "Enable RAG" checkbox and configuring RAG settings has no effect, as the ai_search:rag_search tool is not added to tools or tool_usage_limits. Is this dependency on agent selection the expected behavior for RAG functionality? Or should RAG be available independently when the ai_search module is enabled and the "Enable RAG" checkbox is checked?

    If so, I’m considering moving the RAG logic outside the agent condition, placing it within the existing if ($this->moduleHandler->moduleExists('ai_search')) block in submitForm. This would allow RAG to function independently of agent selection.

Production build 0.71.5 2024