Population of task metadata during agent action
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3502720. -->
Reported by: [yanniboi](https://www.drupal.org/user/1837556)
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>I'm just looking at <code>\Drupal\ai_agents\Plugin\AiAssistantAction\AgentAction::triggerAction</code> which sets the $task on the Agent. The Task entity has a bunch of metadata like title/author/etc but at the moment it looks like it is just filling in the description from the action query.</p>
<pre><span style="color: #000000"><span style="color: #0000BB"><?php<br> </span><span style="color: #FF8000">// Get all tokens and replace them in the query.<br> </span><span style="color: #0000BB">$task </span><span style="color: #007700">= new </span><span style="color: #0000BB">Task</span><span style="color: #007700">(</span><span style="color: #0000BB">$parameters</span><span style="color: #007700">[</span><span style="color: #DD0000">'query'</span><span style="color: #007700">]);<br> </span><span style="color: #0000BB">$task</span><span style="color: #007700">-></span><span style="color: #0000BB">setComments</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">-></span><span style="color: #0000BB">messages </span><span style="color: #007700">?? []);<br> </span><span style="color: #0000BB">$this</span><span style="color: #007700">-></span><span style="color: #0000BB">currentAgent</span><span style="color: #007700">-></span><span style="color: #0000BB">setTask</span><span style="color: #007700">(</span><span style="color: #0000BB">$task</span><span style="color: #007700">);<br></span><span style="color: #0000BB">?></span></span></pre><p>Leaving the prompt missing information</p>
<pre>user<br><br>Task Title: <br><br>Task Author: <br><br>Task Description:<br><br>Can you update the price of the product called Headphones to be $15?<br><br>--------------------------</pre><p>The prompt still works so its not a bug, but might just flagging in case this is expected to be populated.</p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<p>- create assistant chat bot using an existing agent<br>
- send chat message</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>- Not sure</p>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<h3 id="summary-ui-changes">User interface changes</h3>
<h3 id="summary-api-changes">API changes</h3>
<h3 id="summary-data-model-changes">Data model changes</h3>
> Related issue: [Issue #3489626](https://www.drupal.org/node/3489626)
issue