Prerequisites
Install dependencies
Setup Google Project and OAuth
Reference: https://developers.google.com/calendar/api/quickstart/python-
Enable Google Calendar API
- Go to Google Cloud Console.
- Select Project and Enable.
- Go To API & Service -> OAuth Consent Screen
-
Select User Type
- If you are a Google Workspace user, select Internal.
- Otherwise, select External.
- Fill in the app details (App name, logo, support email, etc).
-
Select Scope
- Click on Add or Remove Scope.
- Search for Google Calendar API (Make sure you’ve enabled Google Calendar API otherwise scopes won’t be visible).
- Select scopes accordingly
- For read-only access: Select
/auth/calendar.readonly - For full access: Select
/auth/calendar
- For read-only access: Select
- Save and continue.
-
Adding Test User
- Click Add Users and enter the email addresses of the users you want to allow during testing.
- NOTE : Only these users can access the app’s OAuth functionality when the app is in “Testing” mode. Any other users will receive access denied errors.
- To make the app available to all users, you’ll need to move the app’s status to “In Production”. Before doing so, ensure the app is fully verified by Google if it uses sensitive or restricted scopes.
- Click on Go back to Dashboard.
-
Generate OAuth 2.0 Client ID
- Go to Credentials.
- Click on Create Credentials -> OAuth Client ID
- Select Application Type as Desktop app.
- Download JSON.
-
Using Google Calendar Tool
- Pass the path of downloaded credentials as credentials_path to Google Calendar tool.
- Optional: Set the
token_pathparameter to specify where the tool should create thetoken.jsonfile. - The
token.jsonfile is used to store the user’s access and refresh tokens and is automatically created during the authorization flow if it doesn’t already exist. - If
token_pathis not explicitly provided, the file will be created in the default location which is your current working directory. - If you choose to specify
token_path, please ensure that the directory you provide has write access, as the application needs to create or update this file during the authentication process.
Service Account Authentication (Alternative)
For server/bot deployments without browser access:- Create a service account at IAM & Admin > Service Accounts in Google Cloud Console
- Download the JSON key file
- For accessing another user’s calendar, configure domain-wide delegation in Google Workspace Admin Console
- Set environment variables:
Example
The following agent will use GoogleCalendarTools to find today’s events.cookbook/91_tools/google/calendar_daily_briefing.py
Quick Start Example
Toolkit Params
Toolkit Functions
Reading Events
Scheduling & Availability
Creating & Managing Events
You can use
include_tools or exclude_tools to modify the list of tools the agent has access to. Learn more about selecting tools.
Cookbook Examples
The agno cookbook includes several Google Calendar examples demonstrating different use cases:Tips for Using Google Calendar Tools
- Date/Time Formats: All dates use ISO format (YYYY-MM-DDTHH:MM:SS). Always specify timezone when creating events.
-
Working with Attendees: Use
check_availabilitybefore scheduling meetings with multiple people to find suitable times. -
Natural Language Events: Use
quick_add_eventfor simple event creation from natural language descriptions. -
Event Search: Use
search_eventsfor full-text search across event titles, descriptions, locations, and attendees. -
Authentication:
- Use OAuth for user-facing applications (requires browser)
- Use service accounts for server/bot deployments (no browser needed)
-
Calendar IDs: Use “primary” for the user’s main calendar, or get specific calendar IDs using
list_calendars.