In today’s rapidly evolving AI landscape, building intelligent applications often requires more than just a single large language model (LLM). It demands sophisticated orchestration, specialized agents, and robust cloud infrastructure. This post delves into the architecture and implementation of Nexus, an intelligent multi-agent system designed to dynamically understand, process, and act upon complex user requests, all powered by Google’s Gemini models and deployed entirely on Google Cloud Platform (GCP).
The project, “Nexus,” is designed to be your ultimate intelligent assistant for social planning and event management. Nexus aims to:
- Plan Events: From casual meetups to tech events, Nexus understands your event needs and helps coordinate all the details.
- Create Events: Once planned, Nexus can formalize and create the event within the platform, handling invitations and setup.
- Manage Social Circles: It leverages social context to check past attendees, personalize communications, and understand group dynamics.
- Personalize Experiences: By understanding user preferences and social graphs, Nexus offers tailored recommendations and experiences.
The goal was to create a system capable of handling diverse tasks, from event planning to social profiling, in a highly autonomous yet controlled manner. This led us to a multi-agent approach where:
- Specialized Agents excel at specific tasks (e.g., social context, platform interaction).
- An Orchestrator Agent manages complex workflows, delegating tasks and integrating results.
- Large Language Models (Gemini) serve as the “brains” for reasoning and decision-making within each agent.
This distributed intelligence makes the system more modular, scalable, and maintainable.
The architecture divides into four key domains: Clients/Actors, Agents, AI/Data Sources, and GCP Infrastructure. This separation ensures clear responsibilities and leverages GCP’s managed services.
The agents derive their intelligence from Google’s Gemini models, specifically gemini-2.0-flash, hosted on Vertex AI.
- Advanced Reasoning: Crucial for understanding complex prompts.
- Tool Use (Function Calling): Gemini's ability to determine when and how to call external functions (tools) is fundamental for interacting with data and other agents.
- Efficiency: The "flash" variants provide an optimal balance of performance and cost.
The Google Agent Development Kit (ADK) is the primary framework for constructing the agents, defining their core behavior, instruction sets, and state management.
A cornerstone of the system is the A2A Communication Protocol, implemented via the a2a-python library, providing a standardized way for agents to discover, communicate, and collaborate.
- Delegation & Orchestration: The Orchestrator Agent delegates sub-tasks to specialized agents (e.g., fetching user relationships).
- Implementation Detail: Communication uses a JSON-RPC standard over HTTP.
class SocialAgent:
"""An agent that handles social profile analysis."""
# ... (agent definition)
skill = AgentSkill(
id="social_profile_analysis",
name="Analyze social profile",
description="""
Using a provided list of names, this agent synthesizes the social profile information by analyzing posts, friends, and events.
It delivers a comprehensive single-paragraph summary for individuals, and for groups, identifies commonalities...
""",
tags=["nexus"],
examples=["Can you tell me about Dev and Riya?"],
)
# ...The overall workflow and coordination are managed by an Orchestrator Agent deployed on the Vertex AI Agent Engine, a managed service optimized for hosting orchestrating agents.
The individual ADK agents are deployed as independent microservices on Cloud Run:
- Planner Agent ADK
- Social Agent ADK
- MCP Client Agent ADK
Custom Python functions (tools) are defined within the Planner Agent. Gemini's Function Calling capability, facilitated by the ADK, dynamically invokes these tools based on the user's prompt.
def create_event(event_name: str, description: str, event_date: str, locations: list, attendee_names: list[str], base_url: str = BASE_URL):
"""
Sends a POST request to the /events endpoint to create a new event registration.
Args:
event_name (str): The name of the event.
# ... (other arguments)
Returns:
dict: The JSON response from the API if the request is successful.
"""
url = f"{base_url}/events"
# ... (API call logic)Spanner is leveraged to manage complex social relationships (users, friendships, event attendance) due to its global consistency and scalability.
- Graph DDL & Queries: We utilize Spanner’s GRAPH DDL and query features for modeling intricate relationships and performing efficient graph traversal.
The Model Context Protocol (MCP) enables agents to interact with Nexus’s existing application APIs in a standardized way.
- The MCP Server (a Cloud Function) exposes the platform’s internal APIs as “tools” that the MCP Client Agent can call.
# MCP Server snippet
app = Server("adk-tool-mcp-server")
@app.list_tools()
async def list_tools() -> list[mcp_types.Tool]:
"""MCP handler to list available tools."""
# Convert the ADK tool's definition to MCP format
# ...
return [mcp_tool_schema_event,mcp_tool_schema_post]- Set up Spanner Database
- Set up CI/CD Artifacts
- Deploy Application Core
- Deploy MCP Server
- Develop and Deploy the Planner Agent (ADK + Cloud Run)
- Develop and Deploy the Social Agent (ADK + Spanner + Cloud Run)
- Develop and Deploy the MCP Client Agent (ADK + MCP Server endpoint + Cloud Run)
- Develop the Orchestrator Agent (ADK)
- Deploy the Orchestrator Agent (Vertex AI Agent Engine)
- Connect Nexus App to Orchestrator
- Final System Validation
Future development will focus on:
- User Authentication (AuthN)
- Agent Authorization (AuthZ)
- Dedicated Personalization Agent
- Persistent Agent Memory
| Platform | Link |
|---|---|
https://www.linkedin.com/in/krishna-n-mehta/ |
|
| Medium | https://medium.com/@27krishna2002 |
| Github | https://github.com/cybraia |