feat: add parent-to-subagent communication in agentMessage tool #316
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add parent-to-subagent communication in agentMessage tool
Description
This PR adds bidirectional communication between parent agents and sub-agents through the
agentMessage
tool. Previously, parent agents could only check the output of sub-agents but couldn't communicate with them. This enhancement enables parent agents to send guidance messages to sub-agents, which are then inserted into the sub-agent's message queue.Changes
parentMessages
array to theAgentState
interface to store messages from parent agentsagentMessage
tool to append messages to this array when theguidance
parameter is providedtoolAgent
core to check for parent messages on each iteration and insert them into the message queueTesting
Related Issues
Closes #315
How to Test
Use the
agentMessage
tool with theguidance
parameter to send a message to a sub-agent. The sub-agent will receive the message in its next iteration and process it as if it came from the user.Example:
The sub-agent will receive: "[Message from parent agent]: Please focus on optimizing the performance of the function"