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

  1. Go to the Google Cloud Console.
  2. Create a new project or select an existing one.
  3. Enable the Google Calendar API.

2. Create Service Account

  1. Go to IAM & Admin > Service Accounts.
  2. Click Create Service Account.
  3. Grant it permissions (owner or editor is easiest for dev, but restrict in prod).
  4. Create a key (JSON format) and download it.

3. Share Calendar

  1. Open your Google Calendar.
  2. Go to Settings and sharing for the specific calendar you want to manage.
  3. 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.