Skip to content

Google ADK

AP3 includes a Google ADK (Agent Development Kit) integration and an A2A executor bridge:

  • Agent factory: ap3.integrations.google_adk.GoogleADKIntegration
  • A2A bridge: ap3.integrations.google_adk.GoogleADKExecutor

Install

Install the Google ADK runtime and Gemini client libraries (plus the A2A Python SDK you use to host your agent).

pip install google-adk google-genai

If you use Gemini, make sure your environment is configured by foloowing below steps

Google AI Studio API Key

For agents using Google's Gemini models:

1. Obtain an API Key:

Visit Google AI Studio and create a new API key.

2. Configure the Key:

Create a .env file in your project root:

# Copy the example template
cp .env.example .env

# Edit and add your key
nano .env  # or use your preferred editor

.env file contents:

GOOGLE_API_KEY="your-api-key-here"

3. Load in Your Application:

from dotenv import load_dotenv
import os

load_dotenv()  # Load .env file
api_key = os.getenv('GOOGLE_API_KEY')

Security

Never commit your .env file to Git! It's already in .gitignore to prevent accidental commits.

Create an ADK agent

from ap3.integrations.google_adk import GoogleADKIntegration

async def my_tool(param: str) -> str:
    return f"Processed: {param}"

integration = GoogleADKIntegration(
    name="my_adk_agent",
    description="An ADK agent that can call tools",
    instruction="Use tools when they help. Be concise.",
    tools=[my_tool],
)

agent = integration.create_agent(model_name="gemini-2.5-flash")

Expose the ADK agent over A2A (optional)

GoogleADKExecutor bridges Google ADK's Runner to A2A:

from google.adk import Runner
from ap3.integrations.google_adk import GoogleADKExecutor

# agent_card = ... (your A2A AgentCard)

runner = Runner(app_name="my_app", agent=agent)
executor = GoogleADKExecutor(runner=runner, card=agent_card)