Hey everyone,
So I’m using openai-agents (python sdk) for my agent orchestration.
My current setup is:
Master Agent (top level agent responsible only for conversational logic and routing to sub agents)
Creative Agent (responsible for generating images)
Marketing Agent (sub-agent-2, responsible for general marketing specific conversations and ROUTING further to SEO Agent or Analytics Agent for domain specific queries):
SEO Agent (sub-agent-2.1)
Analytics Agent (sub-agent-2.2)
All the sub agents are passed as HANDOFFS to their parent agent. The issue with this setup currently is that, when a query with SEO intent comes to the Master Agent, it is able to handoff to Marketing Agent, but the Master Agent is not able to handoff to the SEO agent IN THE SAME TURN, so the Master Agent ends up answering that query.
How do I achieve certainty that for such queries that will be best handled by specialised sub-agents, the user queries are actually ROUTED to them and not their general answering parent?
Sure. Consider a full turn as a lifecycle of incoming user query & LLM final response - and necessary handoffs/tool call in between.
Here’s what’s happening: User query: “Optimise the product title & description for SEO” LLM: Master Agent → Marketing Agent (handoff) → Final response Issue: No handoff takes place from Marketing to SEO Agent, hence the Marketing Agent ends up answering the query (which does not have the specialised capabilities to do so)
Expected flow: User query: “Optimise the product title & description for SEO” LLM: Master Agent → Marketing Agent (handoff) → SEO Agent (handoff) - > Final response
Here, the query is delegated to the MOST appropriate agent/sub-agent
From what I understood, you need to call them as tools and not as handoffs.
Handoffs are meant to pass full control of the workflow to another agent, while tools will act like functions, returning the result as context while not directly answering the user. The calling agent will take in that context and write an answer itself.