Hierarchical
Agents are organized in a tree-like structure, with higher-level agents (supervisors) coordinating specialist agents.
Overview
Hierarchies shine when you need structured decision flows, explicit quality checks, and clear ownership of each step. Supervisors break work into pieces, delegate to the right specialists, and assemble the final answer.
Demo Scenario: Multi-Level Research System
This runnable example builds a hierarchical research workflow using sub-agent delegation:
Coordinator agent – manages the research and compilation workflow
Research agent – performs web searches using the google_serper tool
Compiler agent – formats raw findings into a polished summary
The coordinator delegates tasks to research and compiler agents, reviews their outputs, and can make decisions based on their responses. This cyclic decision-making capability is why we use sub-agent delegation instead of gllm-pipeline.
Diagram
Implementation Steps
Create specialist agents
Create coordinator agent with sub-agents
Run the coordinator
Full implementation: See
hierarchical/main.pyfor complete code with detailed instructions.Why sub-agents? This pattern uses sub-agent delegation (not gllm-pipeline) because the coordinator needs to make decisions based on sub-agent responses and potentially loop back if needed.
How to Run
From the gl-aip/examples/multi-agent-system-patterns directory in the GL SDK Cookbook:
Ensure your .env contains:
Note: You'll need a Serper API key for the google_serper tool to work.
Output
Notes
This example uses sub-agent delegation (not gllm-pipeline) because the coordinator needs to make autonomous decisions based on sub-agent responses.
Add reviewers or domain specialists by including them in the coordinator's
agentslist.The coordinator agent can implement feedback loops, quality checks, and conditional delegation based on sub-agent outputs.
For linear workflows without decision-making or loops, prefer patterns that use gllm-pipeline (Sequential, Parallel, Router, Aggregator) which leverage the AgentComponent wrapper.
For iterative optimization with feedback loops, see the Loop pattern.
Related Documentation
Agents guide — Configure nested agents, memory, and runtime overrides.
Tools guide — Manage catalog tools such as
web_search.Automation & scripting — Run hierarchical workflows in CI pipelines.
Security & privacy — Apply tool-output sharing and PII policies across supervisor chains.
Last updated
Was this helpful?