Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Building & Deploying Agents with ADK (By: Tahre...

Building & Deploying Agents with ADK (By: Tahreem Rasul) - DevFest Lahore 2025

Talk by Tahreem Rasul (https://www.linkedin.com/in/tahreemrasul/) at DevFest Lahore 2025 by GDG Lahore.

GDG Lahore PRO

December 20, 2025

Transcript

26 slides
  1. Easy to Use Level 3: Google ADK Balance of deterministic

    control & convenience Level 1: Low level Orchestration framework e.g. LangChain Level 0: Build Your Own Use function calling to build your own agent Level 4: Agentspace Builder & Conversational Agents Level 2: Graph E.g. LangGraph Low Flexibility Agent Frameworks Hard to Use High Flexibility
  2. Framework for developing and deploying AI agents. Key Goals •

    Make agent development feel like software development. • Simplify creation, deployment, and orchestration. Core Principles • Model-agnostic (Optimized for Gemini, but supports others via LiteLLM). • Deployment-agnostic (Local, Cloud Run, Agent Engine). • Compatibility with other frameworks (e.g., LangChain, CrewAI). Introducing ADK
  3. The fundamental worker unit designed for specific tasks. ADK's BaseAgent:

    The foundation for all other agents. • LlmAgent (or Agent alias): The "thinking" part, powered by an LLM for reasoning, decision-making, and tool use. • Workflow Agents: Deterministic controllers for orchestrating sub-agents. ◦ SequentialAgent ◦ ParallelAgent ◦ LoopAgent • Custom Agents: For unique, non-LLM based logic. Core Concept: The Agent
  4. from google.adk.agents import LLMAgent # Or just Agent # from

    google.adk.models.lite_llm import LiteLlM # if using non-Gemini weather_agent = LLMAgent( name="weather_reporter", model="gemini-2.0-flash", # model=LiteLlM(model="openai/gpt-4o") # Alternative description="Provides current weather info for a given city", instruction="You are a weather bot. Use the get_weather_tool " "to find the weather. Clearly state the city and " "the weather report.", tools=[get_weather_tool] )
  5. Agents act through tools. Tools let agents interact with external

    APIs, search information, run code, or call other services. ADK Supports Various Tool Types • FunctionTool: Wrap your custom Python functions. • AgentTool: Use another ADK agent as a callable tool. • Built-in Tools: google_search, built_in_code_execution (for Gemini 2.x models), VertexAiSearchTool. • Third-Party: LangchainTool, CrewaiTool. Tools & Agent Collaboration
  6. from google.adk.tools import FunctionTool def get_stock_price(symbol:str)->dict: """Retrieves the current stock

    price for a given symbol Args: symbol (str): The stock symbol (e.g. "SPY") Returns: dict: {'status': 'success', 'price': 583.09} or {'status': 'error', 'message': 'Not found'} """ if symbol == "QQQ": return {'status': 'success', 'price': 510.09} return {'status': 'error', 'message': 'Not found'} stock_price_tool = FunctionTool(func=get_stock_price) # Agent using this tool # financial_agent = Agent(..., tools= [stock_price_tool])
  7. • Allows an LlmAgent to treat another BaseAgent instance as

    a callable function or Tool. • The "called" agent executes its full logic. • Its final response is returned as the "tool result" to the calling agent. • Enables hierarchical task decomposition and expert consultation. • Different from sub-agent delegation where control is fully transferred. With AgentTool, the caller gets the result back and decides the next step. AgentTool: Agents Calling Agents
  8. from google.adk.tools import AgentTool from google.adk.agents import Agent # Specialist

    Agent summarizer_agent = Agent( name="TextSummarizer", model="gemini-2.0-flash", instruction="Summarize the given text concisely") # Calling Agent researcher_agent = Agent( name="ResearchLead", model="gemini-2.0-flash", instruction="You have a summarizer tool. Use it to summarize " "research papers", tools=[AgentTool(agent=summarizer_agent)] # Wrap summarizer agent )
  9. root_agent = Agent( name="Orchestrator", model="gemini-2.0-flash", instruction=("You are an orchestrator. If

    the user asks for weather," "delegate to 'WeatherExpert'. If the user says goodbye, " "delegate to 'FareWeller'.") # Descriptions for sub-agents are key for LLM to decide delegation sub_agents=[ Agent=(name="WeatherExpert", model="gemini-2.0-flash", tools=[get_weather], description="Handles weather requests"), Agent=(name="FareWeller", model="gemini-2.0-flash", tools=[say_goodbye], description="Responds to farewells")] )
  10. Google Search from google.adk.tools import google_search • Allows the agent

    to perform web searches. • Integrates grounding from Google Search directly into the agent's response capabilities. • Requires a Gemini 2.x model. Code Execution from google.adk.code_executors import BuiltInCodeExecutor from google.adk.code_executors import VertexAICodeExecutor • Enables the agent to execute the Python code generated by the LLM • Agent=(..., code_executor=(BuitlInCodeExecutor())) Built-in Tools: Google Search & Code Execution
  11. Compose multiple, distinct BaseAgent instances into a Multi-Agent System (MAS).

    Hierarchy: Agents can have sub_agents. Delegation/Routing • LLM-Driven / Auto Flow: Root agent's LLM uses sub-agent descriptions • Explicit Invocation: Use AgentTool (covered earlier). • Workflow Agents: SequentialAgent, ParallelAgent, LoopAgent for structured orchestration. Multi-Agent Systems
  12. my_agent_project/ |- my_weather_agent/ |- __init__.py |- agent.py # Defines Root

    Agent |- .env # API Keys |- sub_agents/ • Navigate to my_agent_project • Run: adk web • Opens a browser UI for ◦ Chatting with agents. ◦ Inspecting events and state. ◦ Viewing agent definitions. ◦ Accessing traces. Getting Started: Code Structure & adk web
  13. Moves your agent from local development to a scalable, reliable,

    environment. Python Deployment Options • Vertex AI Agent Engine: (Recommended for Python) Fully managed, auto-scaling service for ADK Agents. ◦ The Agent Starter Pack is a collection of production-ready generative AI agent templates. ◦ from vertexai import agent_engines • Cloud Run: Deploy as a container-based application. ◦ Use adk deploy cloud_run … (CLI Helper) ◦ Or, manually with a Dockerfile and gcloud run deploy. Java deployment typically uses Cloud Run with a Dockerfile. Deployment: Taking Your Agent Live
  14. Streaming (Live Agents): For real-time, bidirectional voice/video interactions. • Uses

    Runner.run_live() and LiveRequestQueue. • Check adk-docs/streaming for quickstarts Safety & Security: Best practices for guardrails, auth, sandboxed code execution. (See adk-docs/safety). Model Context Protocol (MCP): Open Standard for LLM-tool communication. ADK can consume MCP tools. (See adk-docs/mcp). Community Resources • GitHub Discussions for questions and sharing. • Sample agent repositories. • Contribution guide for docs and code. (adk-docs/contributing-guide) More ADK & Community Resources
  15. Editable Location D o not edit H ow to change

    the design Audience Q&A Presenting with animations, GIFs or speaker notes? Enable our Chrome extension

More Decks by GDG Lahore

Other Decks in Programming