• bitcoinBitcoin(BTC)$86,457.000.92%
  • ethereumEthereum(ETH)$2,758.480.66%
  • tetherTether(USDT)$1.000.01%
  • binancecoinBNB(BNB)$791.140.17%
  • rippleXRP(XRP)$1.595.01%
  • usd-coinUSDC(USDC)$1.000.00%
  • solanaSolana(SOL)$118.241.02%
  • tronTRON(TRX)$0.344254-0.90%
  • zcashZcash(ZEC)$1,615.9911.49%
  • Figure HelocFigure Heloc(FIGR_HELOC)$1.031.76%
  • HyperliquidHyperliquid(HYPE)$97.104.56%
  • dogecoinDogecoin(DOGE)$0.1020263.16%
  • moneroMonero(XMR)$566.17-2.52%
  • whitebitWhiteBIT Coin(WBT)$86.850.79%
  • chainlinkChainlink(LINK)$13.030.75%
  • USDSUSDS(USDS)$1.00-0.02%
  • cardanoCardano(ADA)$0.2554424.11%
  • RainRain(RAIN)$0.013114-5.26%
  • leo-tokenLEO Token(LEO)$8.980.27%
  • stellarStellar(XLM)$0.2182312.54%
  • bitcoin-cashBitcoin Cash(BCH)$340.7628.51%
  • uniswapUniswap(UNI)$10.6416.88%
  • nearNEAR Protocol(NEAR)$4.31-3.19%
  • avalanche-2Avalanche(AVAX)$11.261.06%
  • Ethena USDeEthena USDe(USDE)$1.00-0.01%
  • litecoinLitecoin(LTC)$62.723.73%
  • daiDai(DAI)$1.000.00%
  • CantonCanton(CC)$0.113953-2.79%
  • hedera-hashgraphHedera(HBAR)$0.1004359.46%
  • USD1USD1(USD1)$1.00-0.01%
  • suiSui(SUI)$1.02-2.08%
  • the-open-networkGram (prev. Toncoin)(GRAM)$1.460.98%
  • shiba-inuShiba Inu(SHIB)$0.0000063.13%
  • BittensorBittensor(TAO)$313.61-0.74%
  • crypto-com-chainCronos(CRO)$0.0679780.54%
  • Global DollarGlobal Dollar(USDG)$1.000.00%
  • MemeCoreMemeCore(M)$1.30-10.22%
  • paypal-usdPayPal USD(PYUSD)$1.00-0.01%
  • tether-goldTether Gold(XAUT)$4,335.54-0.22%
  • okbOKB(OKB)$123.931.29%
  • Circle USYCCircle USYC(USYC)$1.140.01%
  • Ripple USDRipple USD(RLUSD)$1.000.00%
  • BitwayBitway(BTW)$0.9010.69%
  • BlackRock USD Institutional Digital Liquidity FundBlackRock USD Institutional Digital Liquidity Fund(BUIDL)$1.000.00%
  • aaveAave(AAVE)$147.593.27%
  • Ondo US Dollar YieldOndo US Dollar Yield(USDY)$1.15-0.09%
  • mantleMantle(MNT)$0.696.20%
  • EthenaEthena(ENA)$0.2177503.90%
  • OndoOndo(ONDO)$0.4398240.29%
  • pepePepe(PEPE)$0.000005-2.56%
TradePoint.io
  • Main
  • AI & Technology
  • Stock Charts
  • Market & News
  • Business
  • Finance Tips
  • Trade Tube
  • Blog
  • Shop
No Result
View All Result
TradePoint.io
No Result
View All Result

A Coding Guide to Build a Scalable Multi-Agent System with Google ADK

July 30, 2025
in AI & Technology
Reading Time: 9 mins read
A A
A Coding Guide to Build a Scalable Multi-Agent System with Google ADK
ShareShareShareShareShare

In this tutorial, we explore the advanced capabilities of Google’s Agent Development Kit (ADK) by building a multi-agent system equipped with specialized roles and tools. We guide you through creating agents tailored for tasks such as web research, mathematical computation, data analysis, and content creation. By integrating Google Search, asynchronous execution, and modular architecture, we demonstrate how to orchestrate a powerful, production-ready agent workflow using the Gemini model. Our goal is to help you understand how ADK can be leveraged to build scalable, intelligent systems suitable for enterprise applications. Check out the Full Codes here

Copy CodeCopiedUse a different Browser
!pip install google-adk


import os
import asyncio
import json
from typing import List, Dict, Any
from dataclasses import dataclass
from google.adk.agents import Agent, LlmAgent
from google.adk.tools import google_search


def get_api_key():
   """Get API key from user input or environment variable"""
   api_key = os.getenv("GOOGLE_API_KEY")
   if not api_key:
       from getpass import getpass
       api_key = getpass("Enter your Google API Key: ")
       if not api_key:
           raise ValueError("API key is required to run this tutorial")
       os.environ["GOOGLE_API_KEY"] = api_key
   return api_key

We begin by installing the google-adk package and importing the necessary libraries to build our agent system. To authenticate our access, we retrieve the Google API key either from the environment or securely prompt for it using the getpass module. This ensures our agents can interact with Google’s tools and services seamlessly. A Coding Guide to Build a Scalable Multi-Agent System with Google ADK Check out the Full Codes here

YOU MAY ALSO LIKE

The Pros And Cons Of Using A Password Manager Over An Authenticator App

Why Are Some Songs Grayed Out On Apple Music (And How To Fix It)

Copy CodeCopiedUse a different Browser
@dataclass
class TaskResult:
   """Data structure for task results"""
   agent_name: str
   task: str
   result: str
   metadata: Dict[str, Any] = None


class AdvancedADKTutorial:
   """Main tutorial class demonstrating ADK capabilities"""
  
   def __init__(self):
       self.model = "gemini-1.5-flash"
       self.agents = {}
       self.results = []
      
   def create_specialized_agents(self):
       """Create a multi-agent system with specialized roles"""
      
       self.agents['researcher'] = Agent(
           name="researcher",
           model=self.model,
           instruction="""You are a research specialist. Use Google Search to find
           accurate, up-to-date information. Provide concise, factual summaries with sources.
           Always cite your sources and focus on the most recent and reliable information.""",
           description="Specialist in web research and information gathering",
           tools=[google_search]
       )
      
       self.agents['calculator'] = Agent(
           name="calculator",
           model=self.model,
           instruction="""You are a mathematics expert. Solve calculations step-by-step.
           Show your work clearly and double-check results. Handle arithmetic, algebra,
           geometry, statistics, and financial calculations. Always explain your reasoning.""",
           description="Expert in mathematical calculations and problem solving"
       )
      
       self.agents['analyst'] = Agent(
           name="analyst",
           model=self.model,
           instruction="""You are a data analysis expert. When given numerical data:
           1. Calculate basic statistics (mean, median, min, max, range, std dev)
           2. Identify patterns, trends, and outliers
           3. Provide business insights and interpretations
           4. Show all calculations step-by-step
           5. Suggest actionable recommendations based on the data""",
           description="Specialist in data analysis and statistical insights"
       )
      
       self.agents['writer'] = Agent(
           name="writer",
           model=self.model,
           instruction="""You are a professional writing assistant. Help with:
           - Creating clear, engaging, and well-structured content
           - Business reports and executive summaries
           - Technical documentation and explanations
           - Content editing and improvement
           Always use professional tone and proper formatting.""",
           description="Expert in content creation and document writing"
       )
      
       print("✓ Created specialized agent system:")
       print(f"  • Researcher: Web search and information gathering")
       print(f"  • Calculator: Mathematical computations and analysis")
       print(f"  • Analyst: Data analysis and statistical insights")
       print(f"  • Writer: Professional content creation")
  
   async def run_agent_with_input(self, agent, user_input):
       """Helper method to run agent with proper error handling"""
       try:
           if hasattr(agent, 'generate_content'):
               result = await agent.generate_content(user_input)
               return result.text if hasattr(result, 'text') else str(result)
           elif hasattr(agent, '__call__'):
               result = await agent(user_input)
               return result.text if hasattr(result, 'text') else str(result)
           else:
               result = str(agent) + f" processed: {user_input[:50]}..."
               return result
       except Exception as e:
           return f"Agent execution error: {str(e)}"
  
   async def demonstrate_single_agent_research(self):
       """Demonstrate single agent research capabilities"""
       print("\n=== Single Agent Research Demo ===")
      
       query = "What are the latest developments in quantum computing breakthroughs in 2024?"
       print(f"Research Query: {query}")
      
       try:
           response_text = await self.run_agent_with_input(
               agent=self.agents['researcher'],
               user_input=query
           )
           summary = response_text[:300] + "..." if len(response_text) > 300 else response_text
          
           task_result = TaskResult(
               agent_name="researcher",
               task="Quantum Computing Research",
               result=summary
           )
           self.results.append(task_result)
          
           print(f"✓ Research Complete: {summary}")
           return response_text
          
       except Exception as e:
           error_msg = f"Research failed: {str(e)}"
           print(f"❌ {error_msg}")
           return error_msg
  
   async def demonstrate_calculator_agent(self):
       """Demonstrate mathematical calculation capabilities"""
       print("\n=== Calculator Agent Demo ===")
      
       calc_problem = """Calculate the compound annual growth rate (CAGR) for an investment
       that grows from $50,000 to $125,000 over 8 years. Use the formula:
       CAGR = (Ending Value / Beginning Value)^(1/number of years) - 1
       Express the result as a percentage."""
      
       print("Math Problem: CAGR Calculation")
      
       try:
           response_text = await self.run_agent_with_input(
               agent=self.agents['calculator'],
               user_input=calc_problem
           )
           summary = response_text[:250] + "..." if len(response_text) > 250 else response_text
          
           task_result = TaskResult(
               agent_name="calculator",
               task="CAGR Calculation",
               result=summary
           )
           self.results.append(task_result)
          
           print(f"✓ Calculation Complete: {summary}")
           return response_text
          
       except Exception as e:
           error_msg = f"Calculation failed: {str(e)}"
           print(f"❌ {error_msg}")
           return error_msg
  
   async def demonstrate_data_analysis(self):
       """Demonstrate data analysis capabilities"""
       print("\n=== Data Analysis Agent Demo ===")
      
       data_task = """Analyze this quarterly sales data for a tech startup (in thousands USD):
       Q1 2023: $125K, Q2 2023: $143K, Q3 2023: $167K, Q4 2023: $152K
       Q1 2024: $187K, Q2 2024: $214K, Q3 2024: $239K, Q4 2024: $263K
      
       Calculate growth trends, identify patterns, and provide business insights."""
      
       print("Data Analysis: Quarterly Sales Trends")
      
       try:
           response_text = await self.run_agent_with_input(
               agent=self.agents['analyst'],
               user_input=data_task
           )
           summary = response_text[:250] + "..." if len(response_text) > 250 else response_text
          
           task_result = TaskResult(
               agent_name="analyst",
               task="Sales Data Analysis",
               result=summary
           )
           self.results.append(task_result)
          
           print(f"✓ Analysis Complete: {summary}")
           return response_text
          
       except Exception as e:
           error_msg = f"Analysis failed: {str(e)}"
           print(f"❌ {error_msg}")
           return error_msg
  
   async def demonstrate_content_creation(self):
       """Demonstrate content creation capabilities"""
       print("\n=== Content Creation Agent Demo ===")
      
       writing_task = """Create a brief executive summary (2-3 paragraphs) for a board presentation
       that combines the key findings from:
       1. Recent quantum computing developments
       2. Strong financial growth trends showing 58% year-over-year growth
       3. Recommendations for strategic planning
      
       Use professional business language suitable for C-level executives."""
      
       print("Content Creation: Executive Summary")
      
       try:
           response_text = await self.run_agent_with_input(
               agent=self.agents['writer'],
               user_input=writing_task
           )
           summary = response_text[:250] + "..." if len(response_text) > 250 else response_text
          
           task_result = TaskResult(
               agent_name="writer",
               task="Executive Summary",
               result=summary
           )
           self.results.append(task_result)
          
           print(f"✓ Content Created: {summary}")
           return response_text
          
       except Exception as e:
           error_msg = f"Content creation failed: {str(e)}"
           print(f"❌ {error_msg}")
           return error_msg
  
   def display_comprehensive_summary(self):
       """Display comprehensive tutorial summary and results"""
       print("\n" + "="*70)
       print("🚀 ADVANCED ADK TUTORIAL - COMPREHENSIVE SUMMARY")
       print("="*70)
      
       print(f"\n📊 EXECUTION STATISTICS:")
       print(f"   • Total agents created: {len(self.agents)}")
       print(f"   • Total tasks completed: {len(self.results)}")
       print(f"   • Model used: {self.model} (Free Tier)")
       print(f"   • Runner type: Direct Agent Execution")
      
       print(f"\n🤖 AGENT CAPABILITIES DEMONSTRATED:")
       print("   • Advanced web research with Google Search integration")
       print("   • Complex mathematical computations and financial analysis")
       print("   • Statistical data analysis with business insights")
       print("   • Professional content creation and documentation")
       print("   • Asynchronous agent execution and error handling")
      
       print(f"\n🛠 KEY ADK FEATURES COVERED:")
       print("   • Agent() class with specialized instructions")
       print("   • Built-in tool integration (google_search)")
       print("   • InMemoryRunner for agent execution")
       print("   • Async/await patterns for concurrent operations")
       print("   • Professional error handling and logging")
       print("   • Modular, scalable agent architecture")
      
       print(f"\n📋 TASK RESULTS SUMMARY:")
       for i, result in enumerate(self.results, 1):
           print(f"   {i}. {result.agent_name.title()}: {result.task}")
           print(f"      Result: {result.result[:100]}...")
      
       print(f"\n🎯 PRODUCTION READINESS:")
       print("   • Code follows ADK best practices")
       print("   • Ready for deployment on Cloud Run")
       print("   • Compatible with Vertex AI Agent Engine")
       print("   • Scalable multi-agent architecture")
       print("   • Enterprise-grade error handling")
      
       print(f"\n🔗 NEXT STEPS:")
       print("   • Explore sub-agent delegation with LlmAgent")
       print("   • Add custom tools and integrations")
       print("   • Deploy to Google Cloud for production use")
       print("   • Implement persistent memory and sessions")
      
       print("="*70)
       print("✅ Tutorial completed successfully! Happy Agent Building! 🎉")
       print("="*70)

We define a TaskResult data structure to store outputs from each agent. Then, we build a multi-agent system using Google ADK, assigning specialized roles like researcher, calculator, analyst, and writer. Through asynchronous methods, we demonstrate each agent’s capabilities and compile a final summary of their performance and insights. A Coding Guide to Build a Scalable Multi-Agent System with Google ADK Check out the Full Codes here

Copy CodeCopiedUse a different Browser
async def main():
   """Main tutorial execution function"""
   print("🚀 Google ADK Python - Advanced Tutorial")
   print("=" * 50)
  
   try:
       api_key = get_api_key()
       print("✅ API key configured successfully")
   except Exception as e:
       print(f"❌ Error: {e}")
       return
  
   tutorial = AdvancedADKTutorial()
  
   tutorial.create_specialized_agents()
  
   print(f"\n🎯 Running comprehensive agent demonstrations...")
  
   await tutorial.demonstrate_single_agent_research()
   await tutorial.demonstrate_calculator_agent()
   await tutorial.demonstrate_data_analysis()
   await tutorial.demonstrate_content_creation()
  
   tutorial.display_comprehensive_summary()


def run_tutorial():
   """Run the tutorial in Jupyter/Colab environment"""
   import asyncio
  
   try:
       from IPython import get_ipython
       if get_ipython() is not None:
           return asyncio.create_task(main())
   except ImportError:
       pass
  
   return asyncio.run(main())


if __name__ == "__main__":
   try:
       loop = asyncio.get_running_loop()
       print("Detected Notebook environment. Please run: await main()")
   except RuntimeError:
       asyncio.run(main())


await main()

We finalize the tutorial by defining the main() function, which initializes the system, runs all agent demonstrations, and displays a summary. We ensure compatibility with both script and notebook environments, allowing us to run everything seamlessly with await main() in Colab.

In conclusion, we have successfully created and deployed a fully functional multi-agent system using Google ADK. We’ve seen our agents handle a diverse range of tasks, from conducting real-time research and solving complex financial equations to analyzing data trends and generating executive summaries. We also highlight how the ADK framework supports error handling, extensibility, and seamless integration with tools. Through this hands-on experience, we gain confidence in using ADK to develop robust agent-based solutions for real-world problems, and we’re excited to explore even more advanced orchestration and deployment strategies moving forward.


Check out the Full Codes here. All credit for this research goes to the researchers of this project. Also, feel free to follow us on Twitter and don’t forget to join our 100k+ ML SubReddit and Subscribe to our Newsletter.

A Coding Guide to Build a Scalable Multi-Agent System with Google ADK You may also like NVIDIA’s Open Sourced Cosmos DiffusionRenderer [Check it now]

The post A Coding Guide to Build a Scalable Multi-Agent System with Google ADK appeared first on MarkTechPost.

Credit: Source link

ShareTweetSendSharePin

Related Posts

The Pros And Cons Of Using A Password Manager Over An Authenticator App
AI & Technology

The Pros And Cons Of Using A Password Manager Over An Authenticator App

September 23, 2026
Why Are Some Songs Grayed Out On Apple Music (And How To Fix It)
AI & Technology

Why Are Some Songs Grayed Out On Apple Music (And How To Fix It)

September 22, 2026
Motorola’s New Signature 27 Is Among The First Smartphone To Use The Snapdragon 8 Elite Extreme Gen 6 Processor
AI & Technology

Motorola’s New Signature 27 Is Among The First Smartphone To Use The Snapdragon 8 Elite Extreme Gen 6 Processor

September 22, 2026
Anthropic Releases Claude Opus 5.5: Fable 5.1-Level Performance at 40% Lower Running Cost Than Opus 5
AI & Technology

Anthropic Releases Claude Opus 5.5: Fable 5.1-Level Performance at 40% Lower Running Cost Than Opus 5

September 22, 2026
Next Post
Switch Online's SNES Update Has Apparently Upgraded The CRT Filter – Nintendo Life

Switch Online's SNES Update Has Apparently Upgraded The CRT Filter - Nintendo Life

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

No Result
View All Result
UK to refuel Saudi jets to help counter Houthi attacks – Al Jazeera

UK to refuel Saudi jets to help counter Houthi attacks – Al Jazeera

September 22, 2026
Markey thanks Progressive voters after primary win

Markey thanks Progressive voters after primary win

September 19, 2026
What Is AI Agent Memory? Short-Term, Long-Term, Episodic, and Semantic Memory Explained – Unite.AI

What Is AI Agent Memory? Short-Term, Long-Term, Episodic, and Semantic Memory Explained – Unite.AI

September 19, 2026

About

Learn more

Our Services

Legal

Privacy Policy

Terms of Use

Bloggers

Learn more

Article Links

Contact

Advertise

Ask us anything

©2020- TradePoint.io - All rights reserved!

Tradepoint.io, being just a publishing and technology platform, is not a registered broker-dealer or investment adviser. So we do not provide investment advice. Rather, brokerage services are provided to clients of Tradepoint.io by independent SEC-registered broker-dealers and members of FINRA/SIPC. Every form of investing carries some risk and past performance is not a guarantee of future results. “Tradepoint.io“, “Instant Investing” and “My Trading Tools” are registered trademarks of Apperbuild, LLC.

This website is operated by Apperbuild, LLC. We have no link to any brokerage firm and we do not provide investment advice. Every information and resource we provide is solely for the education of our readers. © 2020 Apperbuild, LLC. All rights reserved.

No Result
View All Result
  • Main
  • AI & Technology
  • Stock Charts
  • Market & News
  • Business
  • Finance Tips
  • Trade Tube
  • Blog
  • Shop

© 2023 - TradePoint.io - All Rights Reserved!