Remove EntityConverter in favor of Artifacts
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3541578. --> Reported by: [michaellander](https://www.drupal.org/user/636494) Related to !844 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>The <code>\Drupal\ai\Plugin\AiDataTypeConverter\EntityConverter</code> plugin was created as a means for tools to interact use entities by passing a token <code>[entity:id]</code> or <code>[entity:id:langcode]</code> as an argument. However, with the implementation of Artifacts <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/ai_agents/-/work_items/3528726" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/ai_agents/-/work_items/3528726</a></span> , 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. </p> <p>Imagine the flow:<br> Load Entity -&gt; Set Field Value -&gt; Set Field Value -&gt; Set Field Value -&gt; Update URL Alias -&gt; Preview Entity -&gt; Save Entity</p> <p>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. </p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Remove <code>\Drupal\ai\Plugin\AiDataTypeConverter\EntityConverter</code></p> <p>I'm setting this as major, because the implications of it staying are pretty detrimental. </p> > Related issue: [Issue #3528726](https://www.drupal.org/node/3528726)
issue