Skip to main content

🇬 Google ADK integration

Learn how to integrate Apify Actors as tools for AI with Google ADK.


What is Google ADK

Google Agent Development Kit (ADK) is a flexible and modular framework for developing and deploying AI agents.

Explore Google ADK

For more in-depth details, check out Google ADK documentation.

How to use Apify with Google ADK

Apify is a marketplace of ready-to-use web scraping and automation tools, AI agents, and MCP servers that you can equip your own AI with. This guide demonstrates how to use Apify tools with a simple AI agent built with Google ADK.

Prerequisites

  • Apify API token: To use Apify Actors in Google ADK, you need an Apify API token. To obtain your token check Apify documentation.

  • Python packages: Install the following Python packages:

    pip install google-adk

Building a simple pub search AI agent using Apify Google Maps scraper

First, create an agent project:

adk create pub_search_agent

Create and configure the agent to use the Apify MCP server tools:

Required setup

Make sure to set the APIFY_TOKEN environment variable in the .env file with your Apify API token before running the code.

from google.adk.agents import Agent
from google.adk.tools.mcp_tool import McpToolset
from google.adk.tools.mcp_tool.mcp_session_manager import StreamableHTTPServerParams
import os

root_agent = Agent(
model="gemini-2.5-flash",
name="pub_search_agent",
instruction="You are a pub search agent that helps users find a great pub to visit based on their preferences. Use Apify tools to accomplish this.",
tools=[
McpToolset(
connection_params=StreamableHTTPServerParams(
# Configure Apify MCP Server URL with desired tools
url="https://mcp.apify.com?tools=compass/crawler-google-places",
headers={
"Authorization": f"Bearer {os.getenv('APIFY_TOKEN')}",
},
),
)
],
)

Run the agent via the web interface:

adk web

Or run the agent via command-line interface:

adk run pub_search_agent

Prompt the agent to find a pub in San Francisco:

Find a pub near the Ferry Building in San Francisco.

Resources