Multi-agent research system with iterative refinement pattern, built using Google ADK Visual Agent Builder's AI-first approach
A complete demonstration of Google ADK's Visual Agent Builder, showcasing how to build complex multi-agent systems through natural language conversation with an AI Assistant. This research agent uses Google Search with a LoopAgent pattern for iterative query refinement.
π Blog Post: Building AI Agents Visually with Google ADK Visual Agent Builder
This repository demonstrates the AI-first development workflow using Google ADK Visual Agent Builder:
- Describe your intent to the AI Assistant in natural language
- Generate complete agent architectures automatically
- Review the generated hierarchy on the visual canvas
- Test immediately with real queries
- Deploy production-ready YAML configurations
No manual YAML editing. No configuration errors. Just describe what you want, and the AI Assistant creates the architecture.
The research agent uses a hierarchical multi-agent pattern:
root_research_agent (ROOT)
βββ research_loop_agent (LoopAgent, max_iterations=3)
βββ query_refinement_agent (LlmAgent, gemini-2.5-pro)
β βββ tool: google_search
βββ search_execution_agent (LlmAgent, gemini-2.5-flash)
βββ tool: google_search
Key Features:
- β Iterative Refinement: Loop agent progressively improves search queries
- β Model Specialization: gemini-2.5-pro for reasoning, gemini-2.5-flash for speed
- β
Smart Termination:
exit_looptool allows early exit when satisfied - β Real Google Search: Live integration with Google Search API
This demo contains the complete YAML configurations generated by the Visual Agent Builder:
agents/
βββ root_agent.yaml # Root coordinator (LlmAgent, gemini-2.5-flash)
βββ research_loop_agent.yaml # Loop orchestrator (LoopAgent, max_iterations: 3)
βββ query_refinement_agent.yaml # Query enhancement (LlmAgent, gemini-2.5-pro)
βββ search_execution_agent.yaml # Search & synthesis (LlmAgent, gemini-2.5-flash)
All files are production-ready and can be deployed directly.
- Python 3.10 or higher
- Google Cloud Project with Gemini API access
- Google ADK v1.18.0+
- Install Google ADK:
pip install google-adk- Set up Google Cloud credentials:
export GOOGLE_CLOUD_PROJECT="your-project-id"
gcloud auth application-default login- Clone this repository:
git clone https://github.com/thomas-chong/google-adk-visual-agent-builder-demo.git
cd google-adk-visual-agent-builder-demoExperience the Visual Agent Builder interface:
# Launch ADK web interface
adk web
# Open in browser
# http://localhost:8000/dev-ui/Steps:
- Click "+" to create new agent or import
agents/root_agent.yaml - Explore the visual canvas showing the agent hierarchy
- Test in the chat interface with research queries
- View execution trace in the Events tab
from google.adk.agents import LlmAgent
# Load the research agent
agent = LlmAgent.from_yaml_file("agents/root_agent.yaml")
# Run a research query
response = agent.run(
"Research the latest developments in quantum computing error correction in 2024."
)
print(response)Try these research topics:
Quantum Computing:
Research the latest developments in quantum computing error correction in 2024.
AI/ML:
Analyze recent breakthroughs in large language model training efficiency.
Edge Computing:
Investigate current trends in edge computing for IoT devices.
Renewable Energy:
Research advancements in solar panel efficiency over the past year.
The agent will:
- Iteration 1: Generate initial search queries, gather foundational information
- Iteration 2: Identify gaps, refine queries, gather deeper details
- Iteration 3: Synthesize comprehensive findings, determine if complete
- Output: Well-structured research summary with key breakthroughs, comparisons, and future directions
Typical execution time: 60-90 seconds (3 iterations with Google Search calls)
Edit agents/research_loop_agent.yaml:
max_iterations: 5 # Increase from 3 to 5Edit any agent YAML:
model: gemini-2.0-flash-exp # Try newer modelsModify the instruction field in agent YAML files:
For more technical depth:
instruction: |
Focus on technical details, implementation specifics, and academic research.
Prioritize peer-reviewed papers and technical documentation.For business focus:
instruction: |
Emphasize market trends, business implications, and ROI analysis.
Include competitor analysis and market sizing.Extend capabilities in agent YAML:
tools:
- name: google_search
- name: url_context # Fetch content from URLs
- name: FilesRetrieval # Analyze local filesThis agent was created by describing requirements to the Visual Agent Builder's AI Assistant:
Prompt:
Create a research agent that uses Google Search with an iterative refinement
pattern. The agent should accept research topics, use a Loop agent pattern to
iteratively improve search queries, and have specialized sub-agents for query
refinement (gemini-2.5-pro) and search execution (gemini-2.5-flash).
AI Assistant Response:
- Proposed complete 4-agent architecture
- Selected appropriate models (pro for reasoning, flash for speed)
- Assigned tools (google_search, exit_loop)
- Generated detailed instructions for each agent
- Created all YAML files automatically
No manual configuration needed!
graph TD
A[User Query] --> B[Root Agent]
B --> C[Loop Agent Starts]
C --> D[Query Refinement Agent]
D --> E[Search Execution Agent]
E --> F{Satisfied?}
F -->|No| G[Refine Queries]
G --> D
F -->|Yes| H[Exit Loop]
H --> I[Return Results]
- Blog Post: Building AI Agents Visually with Google ADK
- Architecture Patterns: Study the YAML files to understand multi-agent composition
- AI Assistant Usage: See how natural language generates complete architectures
Cause: Missing or incorrect file paths in YAML
Solution:
# Ensure all YAML files are in the same directory
ls -la *.yaml
# Files should show:
# root_agent.yaml
# research_loop_agent.yaml
# query_refinement_agent.yaml
# search_execution_agent.yamlCause: Google Cloud credentials not configured
Solution:
# Login with gcloud
gcloud auth application-default login
# Set project
gcloud config set project YOUR_PROJECT_ID
# Verify credentials
gcloud auth listExpected behavior: Loop agents with external tools (Google Search) take 60-90 seconds for 3 iterations.
To speed up:
- Reduce
max_iterationsinresearch_loop_agent.yaml - Use faster model:
gemini-2.0-flash-exp - Optimize search queries in agent instructions
Check:
- Google Search API is enabled in your GCP project
- Search queries are specific enough (review query_refinement_agent output)
- Loop hasn't exited too early (check iteration count in Events tab)
Execution Metrics (from demo):
- Total time: ~75 seconds
- Loop iterations: 3 (max)
- Google Search calls: 6-8 searches across iterations
- Output quality: Comprehensive 3,000+ word research summaries
Cost Considerations:
- Gemini API calls: ~$0.01-0.03 per research query
- Google Search API: Depends on your GCP quota
- Loop iterations significantly impact cost (fewer iterations = lower cost)
Enable conversation memory:
# In root_agent.yaml
tools:
- name: google_search
- name: load_memory
- name: preload_memoryMedical Research Agent:
- Change search queries to focus on PubMed, medical journals
- Add medical terminology to instructions
- Increase max_iterations for thorough analysis
Market Research Agent:
- Add financial data sources
- Focus on trends, market sizing, competitor analysis
- Include synthesis agent for SWOT analysis
Code Research Agent:
- Add GitHub search tools
- Focus on repositories, documentation, code examples
- Include code quality assessment criteria
Found a bug or have a suggestion?
- Open an Issue
- Submit a Pull Request with improvements
- Share your customized agent configurations!
MIT License - See LICENSE file for details.
Feel free to use this as a starting point for your own research agents!
Thomas Chong
AI Engineer passionate about building practical agent systems and exploring the future of AI-assisted development.
- π LinkedIn: linkedin.com/in/chongcht
- π¦ X/Twitter: @cch_thomas
- π Blog: Medium
Have questions or want to discuss agent architectures? Reach out on LinkedIn or X!
- Google ADK Team for creating the Visual Agent Builder
- Gemini Team for the powerful AI models
- Google Cloud for the infrastructure and APIs
google-adk ai-agents multi-agent-systems gemini python agent-development visual-programming llm research-agent loop-agent iterative-refinement google-search
β If you find this demo helpful, please star the repository!
π’ Share your agent architectures - I'd love to see what you build with the Visual Agent Builder. Tag me on X/Twitter @cch_thomas!
Built with Google ADK v1.18.0 Visual Agent Builder Last updated: 2025-11-10