Problem/Motivation
ai_agents_views ships the Views Agent as a tool-calling agent, but there is no ready-to-use way for a site builder to actually talk to it. Using it means already knowing it exists and calling it programmatically through the AI Agents system - there is no chat interface, and no orchestrator that also reaches the Content Type, Field, and Taxonomy agents alongside it so a site builder can describe a task in plain English without knowing which specialized agent handles which part of it.
Filling that gap needs things ai_agents_views itself has no reason to depend on: the Gin admin theme and gin_toolbar (to place a chat widget somewhere a site builder will actually see it) and ai_chatbot (to provide the chat widget itself). Those belong in an optional add-on, not in the base module.
Proposed resolution
Add a new submodule, views_agent_dev_assistant, that depends on ai_agents_views, ai_assistant_api, ai_chatbot, gin_toolbar, and block - real module dependencies- so enabling this one module cascade-installs everything else it needs, the same way enabling any module with dependencies works.
It ships three pieces of configuration:
ai_agents.ai_agent.drupal_assistant- an orchestrator agent wired to the Content Type, Field, Taxonomy, and Views sub-agents.ai_assistant_api.ai_assistant.drupal_assistant- the chat-facing assistant that wraps the agent above.block.block.drupal_assistant_chatbot- a chatbot block placed in the Gin toolbar, running the assistant.
The agent and assistant ship in config/install, since their dependencies are real module dependencies and therefore guaranteed to be active first. The block ships in config/optional instead, because it targets the Gin theme, and a module's dependencies can only list other modules, not themes - there is no way to declare "requires Gin" the way dependencies: gin_toolbar is declared. config/optional silently skips config whose dependencies are not met rather than creating a block that targets a theme that is not installed.
Gin itself is handled two ways, both modelled on how gin_toolbar already handles this same problem for itself:
hook_requirements()reports an install-blocking error if Gin is not installed, the same waygin_toolbar_requirements()does. This module does not force-install Gin - it only checks for it, so it never does something the site builder did not explicitly ask for.- A
#[Hook('themes_installed')]implementation callsConfigInstaller::installOptionalConfig(NULL, ['theme' => 'gin'])when Gin is installed. This means that if this module is installed before Gin is (hook_requirements()is advisory, not enforced byModuleInstaller::install()itself, so that is possible), the chatbot block thatconfig/optionalskipped gets created retroactively as soon as Gin actually shows up, instead of requiring a manual fix.
All three shipped config objects declare an enforced dependency on this module, so uninstalling it removes them again through Drupal's own config-dependency system - no custom uninstall code needed.
Remaining tasks
- File this issue on drupal.org.
- Open an MR with the submodule above.
Test coverage
tests/src/Kernel/ViewsAgentDevAssistantInstallTest.php in the new submodule, 5 tests:
testInstallCascadesDependenciesAndCreatesConfig- installing this module alone installs every module dependency and creates the agent, assistant, and block correctly when Gin is already present.testInstallWithoutGinSkipsTheBlock- installing without Gin present still creates the agent and assistant, and skips the block rather than creating one that targets a missing theme.testInstallingGinAfterwardsCreatesTheBlock- installing Gin after this module creates the previously skipped block retroactively.testRequirementsHook- exerciseshook_requirements()directly across the non-install phase, missing Gin, and Gin present.testUninstallRemovesShippedConfig- uninstalling removes all three shipped config objects.
API changes
None to existing ai_agents_views code - this is a new, self-contained submodule. modules/contrib/ai_agents_views/phpstan.neon gained two ignoreErrors entries scoped to the new submodule's tests/ and src/Hook/ directories, documenting the same class of Drupal-reflection false positive (a test's $modules property and an OO hook's constructor and hook method) already ignored elsewhere in the project for the same reason.
Issue fork ai_agents_views-3621892
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
jibranComment #5
jibranCommitted and pushed.