Welcome back to our series on building the ultimate AI research assistant for our AI agent podcast! In our first post, we built a fantastic agent that could search the web to find the latest AI agent news for the agent factory podcast. But what if we want to add more specialized skills, like getting the real pulse from developer communities on Reddit? To do that, we need to upgrade our agent's design.
In this guide, we are going to level up our skills and refactor our simple agent into a powerful multi-agent system. We will build a "Manager" agent that directs a team of specialists, including one with a custom-built Reddit tool, to gather richer, more diverse insights.
By the end of this post, you'll have an even more powerful Trend Spotter agent that gets information from multiple sources. More importantly, you will learn the advanced skills needed to build complex agents with ADK. You will know how to:
- Build a scalable multi-agent system.
- Build a custom tool from any Python function (like our new Reddit tool).
- Create an orchestrator agent that delegates tasks to a team of specialists.
- Write advanced prompts to manage a multi-step, multi-tool workflow.
- Debug a multi-agent system using the ADK's powerful Trace view.
This architecture is the key to unlocking your agent's full potential. Let's get started!
Step 1: Get Reddit API Credentials & Install Library
To allow our agent to access Reddit programmatically, we need to get API credentials. This is free and only takes a minute.
- Navigate to Reddit Apps: Log in to your Reddit account and go to the app preferences page: https://www.reddit.com/prefs/apps.
- Create a New App: Scroll to the bottom and click the button that says "are you a developer? create an app…".
- Fill out the form:
- name: Trend Spotter Agent
- Select the script option for the application type.
- about url: You can leave this blank.
- redirect url: You must enter http://localhost:8080 for this field.
- Click create app. You will now be taken to a new page showing your credentials.
5. Set Environment Variables: For security, we'll store these credentials as environment variables.
- Your client ID is the string of characters right under "personal use script".
- Your client secret is the long string next to the secret label.
- Open your terminal and run the following export commands:
export REDDIT_CLIENT_ID=”YOUR_CLIENT_ID”
export REDDIT_CLIENT_SECRET=”YOUR_CLIENT_SECRET”
export REDDIT_USER_AGENT=”TrendSpotterAgent/0.1 by u/YourUsername”
6. Update Dependencies: Add the praw library to your requirements.txt file and install it.
# requirements.txt
google-adk
praw
- Install it from your terminal:
pip install -r requirements.txt
Configure Your Cloud Environment
If you haven't done so already, in our previous blog we showed how to define the settings to tell ADK how to securely connect to your Google Cloud account to use services like Vertex AI and Google Search.
export GOOGLE_GENAI_USE_VERTEXAI=true
export GOOGLE_CLOUD_PROJECT=<your-gcp-project-id>
export GOOGLE_CLOUD_LOCATION=<your-gcp-project-location>
Run this one-time command. It will open a browser for you to sign in, allowing ADK to make authorized requests on your behalf.
gcloud auth application-default login
Step 2: Create the Project Folder
To organize our new team of agents, we'll create a sub_agents directory inside our main trend_spotter package.
No worries if you haven't gone through the first blog post, we got you! here is how you create the folder structure for your main agent:
# Create the main project folder
mkdir trend-spotter && cd trend-spotter
# Create the Python package folder that will hold our code
mkdir trend_spotter
touch trend_spotter/__init__.py
touch trend_spotter/agent.py
touch trend_spotter/prompt.py
# Create the top-level configuration files
touch pyproject.toml requirements.txt
# Finally, create and activate a virtual environment
python3 -m venv venv && source venv/bin/activate
(On Windows, use python -m venv venv && .\venv\Scripts\activate)
After you have the main agent and your folder structure defined, from your trend-spotter root folder, run:
# Create the sub-agents directory and its Python initializer
mkdir trend_spotter/sub_agents
touch trend_spotter/sub_agents/__init__.py
Step 3: Create the Specialist Sub-Agents
Now we'll build our two specialist agents by directly creating instances of the Agent class.
1. The Google Search Specialist:
- Create a new file: trend_spotter/sub_agents/google_search_agent.py
- Add this code. Note how we directly create the google_search_agent variable.
# trend_spotter/sub_agents/Google Search_agent.py
from google.adk.agents import Agent
from google.adk.tools import google_search
MODEL = "gemini-2.5-pro-preview-05-06"
# A specific, structured prompt to control the output format of this sub-agent.
google_search_SUB_AGENT_PROMPT = """
**Role:**
- You are a specialist Research Assistant.
- Your only purpose is to execute a Google Search based on instructions from your manager and return the raw, structured results.
**Tools:**
- You have access to one tool: `Google Search`.
**Context:**
- You will be given a query by a manager agent.
- Your output will be read by another agent, so it must be clean, predictable, and structured.
- You must not summarize, analyze, or interpret the search results. Your job is only to find and format the information directly from the tool's output.
**Task:**
1. Take the search query provided to you.
2. Execute a search using the `Google Search` tool.
3. Format the raw output from the tool into a list, following the **exact** `Output Format` specified below.
**Output Format:**
For each search result, you MUST provide the Title, Link, and Snippet. Each complete result must be separated by '---'.
---
Title: [Title of the first search result]
Link: [Full URL of the first search result]
Snippet: [Snippet text of the first search result]
---
Title: [Title of the second search result]
Link: [Full URL of the second search result]
Snippet: [Snippet text of the second search result]
---
(and so on for all results)
"""
google_search_agent = Agent(
model=MODEL,
name="google_search_agent",
description="An expert at using google_search to find recent information and return a structured list of results including URLs.",
# We assign the new, structured instruction here.
instruction=google_search_SUB_AGENT_PROMPT,
tools=[google_search]
)
2. The Reddit Specialist:
First, create a new file for our custom tool's code: trend_spotter/tools.py. Add the following function to it.
import os
import praw
# The function now accepts a LIST of subreddit names
def search_hot_reddit_posts(subreddit_names: list[str], limit_per_subreddit: int = 5) -> str:
"""
Searches a list of subreddits for their current hot posts and returns their titles and URLs.
Args:
subreddit_names: A list of subreddit names to search (e.g., ["LocalLLaMA", "MachineLearning"]).
limit_per_subreddit: The number of top posts to retrieve from each subreddit.
Returns:
A dictionary containing the status and a list of formatted post strings.
"""
try:
print(f"\n🔎 Searching Reddit for hot posts in: {', '.join(subreddit_names)}...")
reddit = praw.Reddit(
client_id=os.environ["REDDIT_CLIENT_ID"],
client_secret=os.environ["REDDIT_CLIENT_SECRET"],
user_agent=os.environ["REDDIT_USER_AGENT"],
read_only=True,
)
all_posts = []
# Loop through each subreddit name provided in the list
for sub_name in subreddit_names:
print(f" - Fetching from r/{sub_name}...")
subreddit = reddit.subreddit(sub_name)
for post in subreddit.hot(limit=limit_per_subreddit):
# We can add a simple filter here if we want, e.g., for score
if post.score > 5:
all_posts.append(f"Title: {post.title}\nLink: {post.url}")
if not all_posts:
return "No hot posts found meeting the criteria in the specified subreddits."
print(f"✅ Reddit search complete. Found {len(all_posts)} qualifying posts.")
return "\n---\n".join(all_posts)
except Exception as e:
return f"Error searching Reddit: {e}"
Now, create the Reddit agent itself at trend_spotter/sub_agents/reddit_agent.py:
# trend_spotter/sub_agents/reddit_agent.py
from google.adk.agents import Agent
from trend_spotter.tools import search_hot_reddit_posts
MODEL = "gemini-2.5-pro-preview-05-06"
reddit_agent = Agent(
name="reddit_agent",
model=MODEL,
description="An expert at finding hot posts on specific Reddit subreddits using its tool.",
tools=[search_hot_reddit_posts]
)
Step 4: Build the Main Orchestrator Agent
Now we'll modify our main agent from Part 1 to become the "manager" of our new specialist team.
Open trend_spotter/prompt.py and replace its contents with this new orchestrator prompt:
# trend_spotter/prompt.py
ORCHESTRATOR_PROMPT = """
**Role:**
- You are the highly-capable manager of an AI research team.
- Your purpose is to produce a high-quality, detailed intelligence report for the "The Agent Factory" podcast.
- Your focus is exclusively on developments in AI agents that are impactful and relevant to software developers.
**Tools:**
- You have a team of two specialist agents available to you as tools:
1. `google_search_agent`: An expert at performing general web searches for news, releases, and technical articles.
2. `reddit_agent`: An expert at finding real, hands-on developer conversations on specific subreddits.
**Context:**
- You must synthesize information from BOTH the `google_search_agent` and the `reddit_agent` to form your conclusions.
- Your primary filter for all information is its direct and significant impact on developers. Discard anything that is purely business-focused or marketing fluff.
- Topics that appear in multiple sources (e.g., in both tech news and on Reddit) should be considered more important and prioritized in your report.
- The final report must be structured exactly as described in the Task section.
**Task:**
1. **Discover the Current Date:** Your very first action is to delegate to your `google_search_agent`. Instruct it to find the current date.
2. **Delegate Focused Research:**
- Based on the date, calculate the start and end dates for the last 7 days.
- Instruct the `google_search_agent` to find news about new open-source agent frameworks, updates to popular libraries (like LangChain, ADK, CrewAI or LlamaIndex), and technical tutorials about building agents within the calculated date range using `after:YYYY-MM-DD` and `before:YYYY-MM-DD` operators.
- Instruct the `reddit_agent` to find the hottest developer conversations about practical challenges, new techniques, and opinions on new tools from subreddits like "LocalLLaMA", "MachineLearning", "LangChain", "AI_Agents", "LLMDevs", and "singularity".
3. **Synthesize and Create the Final Report:**
- Review the information provided by **both** specialist agents.
- Combine, filter, and deduplicate the findings. Your primary filter is to **only select topics that have a direct and significant impact on developers.**
- **Pay special attention to topics that appear in multiple source in the general web search and on Reddit**, as these are likely the most important and should be prioritized.
- The report **must begin with a header** specifying the date range used.
- The body of the report must have exactly three sections as detailed below.
- For each item, you **must provide four pieces of information**: a 1-2 sentence explanation, an indented "Developer Impact" analysis, a "Prioritization Rationale", and a verifiable source URL.
**Final Report Format:**
**🔥 Top 5 Trends for Agent Developers**
1. **[Trend 1 Name]**: [A 1-2 sentence explanation of this trend.]
**(Source: [URL])**
* **Developer Impact**: [A 1-sentence explanation of why this matters to developers.]
* **Prioritization Rationale**: [A 1-sentence explanation of why this topic was selected, e.g., "High volume of discussion on Reddit and mentioned in multiple tech articles."]
2. ... (up to 5 total)
**🚀 Top 5 Releases for Agent Developers**
1. **[Release 1 Name]**: [A 1-2 sentence explanation of the tool, framework, or model.]
**(Source: [URL])**
* **Developer Impact**: [A 1-sentence explanation of why this matters to developers.]
* **Prioritization Rationale**: [A 1-sentence explanation of why this topic was selected.]
2. ... (up to 5 total)
**🤔 Top 5 Questions from Agent Developers**
1. **[Question 1 Topic]**: [A 1-2 sentence explanation of what developers are asking.]
**(Source: [URL])**
* **Developer Impact**: [A 1-sentence explanation of why this matters to developers.]
* **Prioritization Rationale**: [A 1-sentence explanation of why this topic was selected.]
2. ... (up to 5 total)
"""
Open trend_spotter/agent.py and replace its contents to turn it into the orchestrator. Notice how we now import the agent instances we created.
# trend_spotter/agent.py
from google.adk.agents import LlmAgent
from google.adk.tools.agent_tool import AgentTool
# Import the sub-agent INSTANCES
from .sub_agents.google_search_agent import google_search_agent
from .sub_agents.reddit_agent import reddit_agent
from . import prompt
MODEL = "gemini-2.5-pro-preview-05–06"
# This is our main "manager" agent, now an LlmAgent
root_agent = LlmAgent(
model=MODEL,
name="TrendSpotterOrchestrator",
description="The manager of a team of specialist AI agents.",
instruction=prompt.ORCHESTRATOR_PROMPT,
# The Orchestrator's "tools" are its sub-agents, wrapped in AgentTool
tools=[
AgentTool(agent=google_search_agent),
AgentTool(agent=reddit_agent)
],
)
Step 5: Running Your Multi-Agent System
The run process remains the same. The adk web tool will automatically load your root_agent, which is now the orchestrator.
Ensure your pyproject.toml file still correctly points to your main agent:
[project]
name = "trend_spotter"
version = "0.1.0"
# Setuptools will now auto-discover your trend_spotter package.
[tool.adk.agents]
trend_spotter = "trend_spotter.agent:root_agent"
Install your updated package with the new dependencies:
pip install -e .
Launch the web interface:
adk web
In the "Event" tab of the web UI, you will now see the main orchestrator agent making calls to its new google_search_agent and reddit_agent sub-agents. You've successfully built a more robust and scalable AI system using the correct ADK patterns!
You should get an output like this:
Report for the week of June 4, 2025 - June 11, 2025
🔥 Top 5 Trends for Agent Developers
Enterprise Adoption of Agent Frameworks: Frameworks like LangChain are showing significant growth in enterprise contexts, indicated by surpassing the OpenAI SDK in Python downloads and new integrations with systems like SAP and Salesforce. (Source: news.knowledia.com - "LangChain Surpasses OpenAI SDK in Monthly Python Downloads" - This specific URL was not in the provided search but is representative of the type of news article that would contain this information from the search summary "LangChain: Surpassed the OpenAI SDK in monthly Python downloads as of June 2025")
Developer Impact: Developers using or learning LangChain can expect more mature tooling and greater demand for their skills in enterprise settings.
Prioritization Rationale: This trend is based on download statistics and enterprise integration news, indicating a major shift in the landscape relevant to developers' career opportunities.
Enhanced Observability and Debugging in Agent Development: There's a clear move towards more sophisticated tools for monitoring, debugging, and managing the cost of AI agents, exemplified by Langfuse's integration with LlamaIndex and new features in LangSmith. (Source: https://news.llamaindex.ai/integrating-langfuse-for-observability-and-debugging-in-llamaindex-5f4f7f8c29ac [Example URL based on search "An article from June 6, 2025, discusses integrating Langfuse with LlamaIndex for observability and debugging."])
Developer Impact: Developers will have better tools to understand agent behavior, optimize performance, and control operational costs.
Prioritization Rationale: Addresses a critical developer need for building robust and maintainable agents, highlighted by multiple framework updates.
Advanced Structured Data Handling by Agents: Agents are becoming more adept at working with structured data, with developments like Microsoft AutoGen's Structured Retrieval Augmentation and LlamaIndex's Spreadsheet Agent. (Source: Daily AI Agent News - "Microsoft AutoGen v0.4: Structured Retrieval Augmentation & MCP" - this URL was not in the search results but the information "Microsoft AutoGen v0.4 implements Structured Retrieval Augmentation" was.)
Developer Impact: This allows developers to build agents for more complex, real-world use cases involving databases, spreadsheets, and other structured formats.
Prioritization Rationale: Represents a significant expansion in agent capabilities, enabling new applications and increasing their utility.
Growth of Local and Open-Source Agent Solutions: New open-source frameworks like "Goose" (from Block) and "OpenHands" emphasize local execution and customization, aligning with developer discussions on platforms like Reddit (r/LocalLLaMA) about gaining more control over their LLM setups. (Source: https://www.reddit.com/r/LocalLLaMA/comments/1l8pem0/i_finally_got_rid_of_ollama/ and news articles on Goose/OpenHands release)
Developer Impact: Provides developers with more options for privacy-centric, cost-effective, and highly customizable agent development.
Prioritization Rationale: Supported by both new tool releases in the general tech news and active discussions within the developer community (Reddit).
Rise of Multi-Agent Systems and Interoperability Standards: The development of orchestrators like Fujitsu's and advancements in frameworks such as CrewAI and AutoGen (with MCP support) highlight a focus on complex systems where multiple agents collaborate. LangGraph is also central to this trend. (Source: Tech news article on "Fujitsu's Agentic Workflow Orchestrator" and https://www.reddit.com/r/LangChain/comments/1l8zy42/built_a_texttosql_multiagent_system_with/ )
Developer Impact: Developers are increasingly tasked with designing, building, and managing interactions between multiple specialized agents, requiring new skill sets.
Prioritization Rationale: This is a key area of innovation, mentioned in multiple framework updates and discussed by developers building sophisticated applications.
🚀 Top 5 Releases for Agent Developers
LangGraph Platform General Availability: LangChain's LangGraph, a library for creating stateful, multi-actor LLM applications, is now generally available, offering features like 1-click deployment. (Source: LangChain official blog/documentation - the search mentioned "LangGraph Platform is now generally available" as a LangChain update.)
Developer Impact: Offers a production-ready path for developers to build complex, scalable agentic systems and multi-agent collaborations.
Prioritization Rationale: Significant release for a popular ecosystem, addressing the need for robust multi-agent system development.
AutoGen v0.4 (Microsoft): This version introduces Structured Retrieval Augmentation and full support for the Model Context Protocol (MCP), enhancing data handling and enabling interoperability with other agent platforms. (Source: GitHub releases page for Autogen or news articles covering the v0.4 release mentioned in the search: "Microsoft AutoGen v0.4 implements Structured Retrieval Augmentation and full support for the open-source MCP standard")
Developer Impact: Allows developers to build more powerful AutoGen agents capable of complex data interactions and cross-platform collaboration.
Prioritization Rationale: Major update to a key framework from Microsoft, improving core functionality and ecosystem compatibility.
CrewAI v0.126.0: Features real-time task redistribution, Python 3.13 support, persisted tools from a Tool repository, streamable-http transport in MCP, and major documentation restructuring. (Source: CrewAI GitHub releases or their official blog - "CrewAI: Released v0.126.0 on June 5, 2025" was in the search results.)
Developer Impact: Provides developers with improved performance, better tool management, enhanced interoperability, and easier onboarding through better documentation.
Prioritization Rationale: A substantial update to a growing agent framework, focusing on efficiency and developer experience.
LlamaIndex Spreadsheet Agent & Llama Cloud Updates: LlamaIndex launched a production-ready Spreadsheet Agent for natural language Q&A on spreadsheets and announced new MCP integration and Llama Cloud enhancements. (Source: LlamaIndex Newsletter/Blog - "LlamaIndex: ...announcing a new production-ready Spreadsheet Agent...new MCP (Model Context Protocol) integration..." was in the search results.)
Developer Impact: Delivers a practical tool for a common business analytics task and improves the deployability and connectivity of LlamaIndex agents.
Prioritization Rationale: Addresses specific, high-value developer use cases (spreadsheet interaction) and improves platform capabilities.
Goose (Open-Source AI Agent Framework by Block): An extensible AI agent framework from Block designed to run entirely locally, capable of writing/executing code and interacting with the file system. (Source: News articles covering the Goose release - "Goose: Released by Block (formerly Square), Goose is an open-source AI agent framework..." was in the search results.)
Developer Impact: Gives developers a new, powerful, and locally controllable tool for building agents, especially those focused on coding tasks.
Prioritization Rationale: A new entrant in the open-source framework space from a well-known company, catering to local-first development.
🤔 Top 5 Questions from Agent Developers
Getting Started with AI Agent Development: Newcomers are actively seeking guidance on initial steps, choosing foundational frameworks (LangChain, CrewAI, AutoGen frequently cited), and identifying suitable beginner projects. (Source: Reddit thread from June 5, 2025, providing advice for beginners, or a general link like https://www.reddit.com/r/AI_Agents/ if specific links are too numerous. The search mentioned: "A Reddit thread from June 5, 2025, provides advice for beginners...")
Developer Impact: Highlights a need for more structured learning paths and accessible resources for developers new to building AI agents.
Prioritization Rationale: A foundational question indicating growing interest and the need for community/educational support, seen in both search and Reddit results.
Optimizing and Controlling Local LLM Setups: Developers on subreddits like r/LocalLLaMA are discussing practical challenges and alternatives for local LLM environments (e.g., moving from Ollama to llama.cpp/OpenWebUI). (Source: https://www.reddit.com/r/LocalLLaMA/comments/1l92vr0/as_some_people_asked_me_to_share_some_details/)
Developer Impact: Reflects the hands-on effort by developers to fine-tune their local development stacks for better performance, control, or feature sets.
Prioritization Rationale: A practical, developer-driven discussion on Reddit about tooling and local environment optimization.
Implementing Text-to-SQL Multi-Agent Systems: There is active exploration and sharing of projects on building multi-agent systems for complex database interaction tasks like Text-to-SQL, particularly using LangGraph. (Source: https://www.reddit.com/r/LangChain/comments/1l8zy42/built_a_texttosql_multiagent_system_with/)
Developer Impact: Shows developers are pushing the capabilities of agents to tackle sophisticated, high-value enterprise tasks with multi-agent designs.
Prioritization Rationale: Represents advanced application development discussed within the LangChain developer community.
Seeking Open Source Alternatives for Observability Tools: Developers are interested in and building open-source options for agent observability, such as alternatives to LangSmith, including LangGraph visualization. (Source: https://www.reddit.com/r/LangChain/comments/1l93195/open_source_langsmith_alternative_with_langgraph/)
Developer Impact: Indicates a community drive for more accessible and customizable tools for monitoring and understanding agent behavior.
Prioritization Rationale: Highlights a specific tooling need and community-led solutions on Reddit, relevant for the LangChain ecosystem.
Ensuring Code Quality in AI Training Data: A discussion on r/LLMDevs raises the question of how to ensure AI agents learn from high-quality code, suggesting approaches like using "gold standard files" rather than random code. (Source: https://www.reddit.com/r/LLMDevs/comments/1l8yweo/devs_stop_letting_ai_learn_from_random_code_use/)
Developer Impact: This points to an evolving concern about data integrity and best practices when fine-tuning or training agents for coding tasks.
Prioritization Rationale: An important discussion on Reddit regarding the quality and reliability of AI-assisted software development.
Part 6: Next Steps and Conclusion
Congratulations! You have successfully upgraded your simple agent into a powerful, multi-agent system using the Agent Development Kit's orchestrator pattern. This is a huge step in your journey as an agent developer.
You've now learned some of the most important skills for building complex AI applications:
- How to create specialist sub-agents
- Build a custom tool from any Python function
- Design a manager agent that orchestrates an entire team to solve a problem.
This is how real-world, scalable agentic systems are built.
But this is just the beginning. You now have a truly powerful foundation that you can expand upon. Think about what other specialists you could add to your team — agents/tools to fetch additional sources of information? an agent that saves the report to a Google Doc? A tool that posts the summary to Slack or email? The possibilities are endless.
When you're ready to dive deeper and explore all the advanced features the framework has to offer, the best place to go is the official Google Cloud ADK documentation.
Happy building!

Top comments (0)