Function calls have silent dependencies

Created on 26 March 2025, about 1 month ago

Problem/Motivation

Currently, AI Agents includes a few function calls that have dependencies on other modules that are not core dependencies of AI Agents (or it's dependants). This means there are function calls that make use of services, classes, or entity types that are not available.

Steps to reproduce

Install AI Agents on a site that doesn't have node enabled. Try the Get Content Type Info tool in the API explorer, you get a fatal error:

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "node_type" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 142 of /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityTypeManager.php).

Proposed resolution

We should introduce a mechanism for declaring module dependencies in the plugin definition and the plugin manager should check that module dependencies are met, discarding plugins where that is not the case.

User interface changes

N/A

API changes

New optional param in the plugin definition attribute.

📌 Task
Status

Active

Version

1.1

Component

Code

Created by

🇬🇧United Kingdom andrewbelcher

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

Comments & Activities

Production build 0.71.5 2024