Make added tokens contexts trickle down
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3524905. -->
Reported by: [marcus_johansson](https://www.drupal.org/user/385947)
Related to !129
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>Currently you can set custom tokens when you invoke an agent as seen here: <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/ai_agents/issues/3523058" title="Status: Closed (fixed)">#3523058: Allow retrieving context from the agent entity wrapper</a></span>.</p>
<p>The problem is that if you setup an agent that has subagents, these custom contexts are not trickling down to and of the subagents, that might need that information as well.</p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<p>Create an agent that uses a custom token<br>
Create and subagent that uses a custom token<br>
Call an agent that uses the subagent.<br>
Check logs - the agents tokens got replaced, but not the sub agent.</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Make sure that tokens trickle down.</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>
issue