Skip to content

Strands Google: Universal Google API Access 🌐

PyPI

Access 200+ Google APIs from your Strands agent with simple, powerful tools.

Gmail, Drive, Calendar, YouTube, Sheets, Docs, and more—all through natural language.

Features

  • ✅ Universal Google API Access - Gmail, Drive, Calendar, YouTube, Sheets, Docs, and 200+ more
  • 🔐 Flexible Authentication - OAuth 2.0, Service Accounts, and API Keys
  • 📧 Gmail Helpers - Easy email sending and replying with automatic encoding
  • 🎯 Dynamic Scopes - Configure OAuth scopes on-the-fly

Installation

pip install strands-google

Authentication Setup

# Run auth flow
python -m strands_google.google_auth

# Set the token
export GOOGLE_OAUTH_CREDENTIALS=~/gmail_token.json

Service Account

export GOOGLE_APPLICATION_CREDENTIALS=~/service-account-key.json

API Key

export GOOGLE_API_KEY=your_api_key_here

Quick Start

from strands import Agent
from strands_google import use_google, gmail_send, gmail_reply

agent = Agent(tools=[use_google, gmail_send, gmail_reply])

# Send an email
agent("Send an email to [email protected] saying hello")

# Search Gmail
agent("Find all unread emails from last week")

# List Google Drive files
agent("Show me my recent Drive files")

Available Tools

use_google - Universal API Access

# Gmail: List messages
agent.tool.use_google(
    service="gmail",
    version="v1",
    resource="users.messages",
    method="list",
    parameters={"userId": "me", "maxResults": 10}
)

# Drive: List files
agent.tool.use_google(
    service="drive",
    version="v3",
    resource="files",
    method="list",
    parameters={"pageSize": 10}
)

# Calendar: List events
agent.tool.use_google(
    service="calendar",
    version="v3",
    resource="events",
    method="list",
    parameters={"calendarId": "primary"}
)

# YouTube: Search videos
agent.tool.use_google(
    service="youtube",
    version="v3",
    resource="search",
    method="list",
    parameters={"part": "snippet", "q": "python", "maxResults": 5},
    credential_type="api_key"
)

gmail_send - Easy Emails

# Simple email
agent.tool.gmail_send(
    to="[email protected]",
    subject="Hello!",
    body="This is a test email."
)

# With CC/BCC
agent.tool.gmail_send(
    to="[email protected]",
    subject="Team Update",
    body="Meeting at 3pm",
    cc=["[email protected]"],
    bcc=["[email protected]"]
)

# HTML email
agent.tool.gmail_send(
    to="[email protected]",
    subject="Newsletter",
    body="<h1>Hello!</h1><p>HTML content.</p>",
    html=True
)

gmail_reply - Reply to Emails

agent.tool.gmail_reply(
    message_id="abc123",
    body="Thanks for your email!"
)

Supported Services

Service Examples
Gmail Send, receive, search, labels
Drive Files, folders, sharing
Calendar Events, reminders
YouTube Search, playlists, channels
Sheets Read, write, format
Docs Create, edit documents
Tasks Task lists, items
+ 200 more Any Google API

All of Google, in natural language. 🌐