Arcade with Google ADK
The google-adk-arcade
package provides a seamless integration between
Arcade and the Google ADK. This integration allows you to enhance your AI agents with powerful Arcade tools including Google Mail, LinkedIn, GitHub, and many more.
Installation
Install the necessary packages to get started:
pip install google-adk-arcade
Make sure you have your Arcade API key ready. Get an API key if you don’t already have one.
Key features
- Easy integration with the Google ADK framework
- Access to all Arcade toolkits including Google, GitHub, LinkedIn, X, and more
- Create custom tools with the Arcade Tool SDK
- Manage user authentication for tools that require it
- Asynchronous support compatible with Google’s ADK framework
Basic usage
Here’s a simple example of using Arcade tools with OpenAI Agents:
import asyncio
from arcadepy import AsyncArcade
from google.adk import Agent, Runner
from google.adk.artifacts import InMemoryArtifactService
from google.adk.sessions import InMemorySessionService
from google.genai import types
from google_adk_arcade.tools import get_arcade_tools
async def main():
app_name = 'my_app'
user_id = 'user@example.com'
session_service = InMemorySessionService()
artifact_service = InMemoryArtifactService()
client = AsyncArcade()
google_tools = await get_arcade_tools(client, tools=["Google.ListEmails"])
# authorize the tools
for tool in google_tools:
result = await client.tools.authorize(
tool_name=tool.name,
user_id=user_id
)
if result.status != "completed":
print(f"Click this link to authorize {tool.name}:\n{result.url}")
await client.auth.wait_for_completion(result)
# create the agent
google_agent = Agent(
model="gemini-2.0-flash",
name="google_tool_agent",
instruction="I can use Google tools to manage an inbox!",
description="An agent equipped with tools to read Gmail emails."
tools=google_tools,
)
#create the session and pass the user ID to the state
session = await session_service.create_session(
app_name=app_name, user_id=user_id, state={
"user_id": user_id,
}
)
runner = Runner(
app_name=app_name,
agent=google_agent,
artifact_service=artifact_service,
session_service=session_service,
)
user_input = "summarize my latest 3 emails"
content = types.Content(
role='user', parts=[types.Part.from_text(text=user_input)]
)
for event in runner.run(
user_id=user_id,
session_id=session.id,
new_message=content,
):
if event.content.parts and event.content.parts[0].text:
print(f'** {event.author}: {event.content.parts[0].text}')
if __name__ == '__main__':
asyncio.run(main())
Handling authorization
When a user needs to authorize access to a tool (like Google or GitHub), the agent will reply with a URL for the user to visit, which will be displayed to the user.
After visiting the URL and authorizing access, the user can run the agent again
with the same user_id
, and it will work without requiring re-authorization.
Alternatively, you can authorize the tool before running the agent:
# authorize the tools
for tool in google_tools:
result = await client.tools.authorize(
tool_name=tool.name,
user_id=user_id
)
if result.status != "completed":
print(f"Click this link to authorize {tool.name}:\n{result.url}")
await client.auth.wait_for_completion(result)
Available toolkits
Arcade provides a variety of toolkits you can use with your agents:
- Google Suite: Gmail, Calendar, Drive, Docs
- Social Media: LinkedIn, X
- Development: GitHub
- Web: Web search, content extraction
- And more: Weather, financial data, etc.
For a full list of available toolkits, visit the Arcade Integrations documentation.
Next steps
Ready to start building with Arcade and OpenAI Agents? Check out these guides:
- Using Arcade tools - Learn the basics of using Arcade tools with Google ADK
- Creating custom tools - Build your own tools with the Arcade Tool SDK
Enjoy exploring Arcade and building powerful AI-enabled applications!