Remove EntityConverter in favor of Artifacts

Created on 15 August 2025, about 2 months ago

Problem/Motivation

The \Drupal\ai\Plugin\AiDataTypeConverter\EntityConverter plugin was created as a means for tools to interact use entities by passing a token [entity:id] or [entity:id:langcode] as an argument. However, with the implementation of Artifacts[#3528726], it would be more favorable to use a tool to load an entity, place that entity in session storage with a token representing it, then allowing tools to modify that entity before proceeding to save.

Imagine the flow:
Load Entity -> Set Field Value -> Set Field Value -> Set Field Value -> Update URL Alias -> Preview Entity -> Save Entity

If you give AI a means to pass a token that bypasses the 'Load Entity' step, then each tool could reload the entity from the DB and nothing persists between tool calls. It would be better to rely on the 'Load Entity' step to add the artifact to session, and then all subsequent calls would depend on the artifact it created. So while well intended, I think keeping this converter in will actually cause more harm than good.

Proposed resolution

Remove \Drupal\ai\Plugin\AiDataTypeConverter\EntityConverter

I'm setting this as major, because the implications of it staying are pretty detrimental.

📌 Task
Status

Active

Version

1.2

Component

AI Core module

Created by

🇺🇸United States michaellander

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

Comments & Activities

Production build 0.71.5 2024