Getting started with Google ADK
July 29, 2025
I was trying to get started with the Google ADK but I felt like the documentation lacked a straight forward example to just copy and run.
This is what I tried to do here.
Create a new project and install google-adk using uv
uv init adkcd adkuv add google-adkuv sync
And you’re good to go in terms of boilerplate.
Then add the code
First, import the imports:
import asyncioimport os
from google.adk.agents import Agentfrom google.adk.runners import Runnerfrom google.adk.sessions import InMemorySessionServicefrom google.genai import types
Good. Then you will need the Agent:
os.environ["GOOGLE_GENAI_USE_VERTEXAI"] = "FALSE"os.environ["GOOGLE_API_KEY"] = "PASTE_YOUR_ACTUAL_API_KEY_HERE"
agent = Agent( name="agent name", model="gemini-2.0-flash", description="agent description", instruction="system prompt", output_key="response",)
Then you will need the session:
app_name = "gcgbarbosa's blog"session_service = InMemorySessionService()
user_id = "user_id"session_id = "session_id"
session_service.create_session( app_name=app_name, user_id=user_id, session_id=session_id,)
The last thing you need is the runner:
runner = Runner( agent=agent, app_name=app_name, session_service=session_service,)
Now you can receive a message from the user or another agent and run it trough the agent that you just created:
async def run_agent(message: str): content = types.Content(role="user", parts=[types.Part(text=message)])
# Execute the agent and get the final response final_response = "" async for event in runner.run_async( user_id=user_id, session_id=session_id, new_message=content, ): if event.is_final_response() and event.content and event.content.parts: final_response = event.content.parts[0].text break
return final_response
response = asyncio.run(run_agent("Hello, how are you?"))
This is the simplest agent that you can create. It does not even use tools (is it really an agent if it does not use tools? probably not).
The documentation shows how to use tools anyways: ADK Quickstart.
Good luck!
Tags: