Create an AiAgent to take advantage of Action plugins

Created on 28 January 2025, 2 months ago

Problem/Motivation

Currently, AiAgents are explicitly creating actions around narrow use casesContentType, FieldType, TaxonomyAgent to the Drupal assistant. If we can take steps to derive assistant actions through existing API, we can rapidly unlock greater AI coverage without depending on additional downstream work for AI support.

As an example, right now if I were to create a new EntityType in a contrib module, I would have to also define an AiAgent plugin to support assistant actions around that new type. This is less than ideal, especially when the ai_agents module lives outside of core and we are then requiring contrib to support many potential standards.

Proposed resolution

One way to do this would be to derive behavior from existing Action plugins, which already have many of the actions we'd potentially want to do with AI(entity crud, field manipulation, etc), but lack a natural language interface. I think in time this could lead to larger changes upstream in Drupal core(perhaps a standard natural language interface), but for next steps we prove that unlocking Drupal's actions as a natural way to unify the actions layer.

I've attached a list of actions from Drupal CMS with all ECA modules enabled so you can see the overlap in AI behaviors and existing actions.

Remaining tasks

Determine feasibility. Determine means of context negotiation as current actions do not have awareness of contexts required to execute them. Determine how best to explain actions in plain english to AI, as current actions do not have a natural language definition.

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇺🇸United States michaellander

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

Comments & Activities

  • Issue created by @michaellander
  • 🇮🇹Italy kopeboy Milan

    Yes, this would be great! The real automation and assistant capability come from being able to chain actions, and we already have a framework in Drupal, not only to define and run them, but also to visualize & customize their flow without code with ECA module.

    I would say a natural language way of describing actions is with a [subject], [verb], [object], where normally the subject is the current user, the verb extracted from what the user asked the chat bot and used to find the closest synonymous from whitelisted action_id(s) and ECA models, and the object the closest [entity_type_id] or the [entity] provided by a token.

    We could even define config entities that reference existing actions to provide metadata, ie. text suggestions on how to use the action, description of what it does, the synonyms above (for ECA models we could directly use their documentation field), and the entity types it can work on (for ECA models, ie. more abstract or complex actions, these could be custom inputs and outputs), to produce a rich list of actions that the LLM can pick from, trimmed down to only the ones that work on similar prompted [object]s.

  • 🇮🇹Italy kopeboy Milan

    I noticed this module could be relevant: ai_integration_eca

  • 🇬🇧United Kingdom yautja_cetanu

    Excited that you're getting into it! I just had a call with the eca team and will be uploading it to YouTube and also we've shown our ai agents working with the action plugins at drupal camp England this weekend. It's all in a branch of the AI module 1.1.0

  • 🇺🇸United States w01f

    Umm, please share that video and update the link here! That sounds absolutely fantastic.

  • 🇩🇪Germany marcus_johansson

    w01f - video is here: https://www.youtube.com/watch?v=rUi-Z2QckOM&ab_channel=FreelyGive

    This is no testable by using 1.1.x-dev releases from AI, AI Agents and OpenAI provider. More providers coming soon.

Production build 0.71.5 2024