In the current implementation, when multiple tools return agents, the code enters a loop where intermediate agent executions are lost. Specifically, if more than one tool provides an agent, the context from one agent is overwritten, leading to incorrect or incomplete execution.
For instance, consider the following code from core.py
: