Description
Currently, handoffs
are a one-way ticket. Once an Agent handed off control to another Agent, it will never regain control. The only way to return control to the previous agent, is to have some circular hand off mechanism (which would require a circular reference between the two agents, which is far from ideal). There are scenarios, where you don't even need to call an LLM to determine that you want the main agent to regain control, assume this architecture:

A simple user question may require more than one agent to run, Ideally, you'll want Agent A. to do the work, go back to the main agent, and then call Agent B. The current solution to this, is to use Agent A and Agent B as tools, but that's not ideal for a couple of reasons (Streaming is not easily supported, context is limited, cannot limit the max turns).
We can generate a similar architecture with Handoffs, by implementing an optional back_handoff
parameter, that will result in an automatic Handoff back to the main agent, whenever one of the sub-agents complete their task.