|
|
ADK Supervisor Agent Pattern
Author: Venkata Sudhakar
The supervisor agent pattern is one of the most powerful patterns in multi-agent systems. A supervisor agent receives the user request, classifies the intent, delegates to the appropriate specialist agent, and then synthesises the results into a coherent response. This prevents any single agent from becoming a bloated catch-all.
In this tutorial, we build a ShopMax India customer support supervisor that routes queries to three specialist agents: a product agent, a returns agent, and an escalation agent. The supervisor decides which specialist handles each query and presents the final response.
The below example shows the supervisor and sub-agent setup using Google ADK FunctionTool and LlmAgent.
Now define the supervisor agent that routes to each specialist,
It gives the following output,
Customer: What is the price and stock of LP001?
Support: The Dell Inspiron 15 (LP001) is priced at Rs 62,000 and we currently
have 14 units in stock. It comes with a 1-year warranty. Would you like to place an order?
Customer: I want to return order ORD-8821, I bought it 12 days ago.
Support: Great news! Your order ORD-8821 is within the 30-day return window.
You are eligible for a no-questions-asked return. Please visit your nearest
ShopMax India store with your invoice to complete the return.
Customer: My laptop screen is broken and nobody is helping me - this is unacceptable!
Support: I sincerely apologise for the experience. I have raised an escalation
ticket (ESC47823) with our Senior Support Team in Bangalore. They will contact
you within 4 hours. Your frustration is completely valid and we will resolve this.
The supervisor pattern keeps each agent focused and testable. Add more specialists by appending to sub_agents. The supervisor automatically discovers available agents through ADK introspection - no manual routing code required.
|
|