Google Calendar Integration
Google Calendar Integration
The Google Calendar integration allows your agent to check availability, create, update, and delete events on a user's calendar. This is essential for appointment booking and scheduling agents.
Setup
To use this integration, you need to set up a Google Cloud Project and enable the Calendar API.
1. Enable Google Calendar API
- Go to the Google Cloud Console.
- Create a new project or select an existing one.
- Enable the Google Calendar API.
2. Create Service Account
- Go to IAM & Admin > Service Accounts.
- Click Create Service Account.
- Grant it permissions (owner or editor is easiest for dev, but restrict in prod).
- Create a key (JSON format) and download it.
3. Share Calendar
- Open your Google Calendar.
- Go to Settings and sharing for the specific calendar you want to manage.
- Under Share with specific people, add the service account email (found in the JSON key) and give it Make changes to events permission.
Configuration
You need to provide the GOOGLE_CALENDAR_ID and the credentials.
Environment Variables
GOOGLE_CALENDAR_ID=your.email@gmail.com
GOOGLE_CALENDAR_CREDENTIALS_PATH=/path/to/service-account.json
Usage
Enable the integration when initializing your agent:
agent = Agent(
# ...
google_calendar=True
)
Automatic Tool Injection
Setting google_calendar=True automatically adds the following tools to your agent:
list_events: Lists events within a time range.create_event: Creates a new event.update_event: Modifies an existing event.delete_event: Cancels an event.
The system prompt is also automatically updated to inform the LLM about these tools and the current date/time context.
Example
See the Dental Clinic Receptionist example for a complete implementation.