Google Calendar

Query events, check availability, and create meetings.

Query events, check availability, and create meetings. By default, exposes query_calendar for reading. Enable write=True to also expose update_calendar for creating and modifying events.

Create a virtual environment, then install the Google Workspace clients and the model SDK:

uv pip install -U agno openai google-api-python-client google-auth-httplib2 google-auth-oauthlib
export OPENAI_API_KEY="your-openai-api-key"

For the personal OAuth example, enable the relevant Google API in your Cloud project, configure its consent screen, and create a Desktop OAuth client. Set GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET and GOOGLE_PROJECT_ID using that client. Authorize access in the browser on first use. The authentication section below also covers service accounts.

For a headless service, provision credentials first and set GOOGLE_OAUTH_NONINTERACTIVE=1. Gmail and Calendar also accept auth=AuthConfig(interactive=False) from agno.tools.google.auth; the current Drive provider does not accept auth=. If credentials cannot be loaded or refreshed, authentication reports an error instead of opening a browser. Provider configuration selects the credentials; forwarding a run’s user ID does not switch Google accounts.

Save as calendar_context.py and run python calendar_context.py after configuring authentication:

calendar_context.py
import asyncio

from agno.agent import Agent
from agno.context.calendar import GoogleCalendarContextProvider
from agno.models.openai import OpenAIResponses

async def main():
    calendar = GoogleCalendarContextProvider(model=OpenAIResponses(id="gpt-5.4-mini"))
    agent = Agent(
        model=OpenAIResponses(id="gpt-5.4"),
        tools=calendar.get_tools(),
        instructions=calendar.instructions(),
    )
    await agent.aprint_response("What meetings do I have tomorrow?")

if __name__ == "__main__":
    asyncio.run(main())

Authentication

Same as Gmail - OAuth or service account.

export GOOGLE_CLIENT_ID=...
export GOOGLE_CLIENT_SECRET=...
export GOOGLE_PROJECT_ID=...

Token cached to calendar_token.json.

Configuration

ParameterTypeDefaultDescription
idstr"calendar"Tools become query_<id> and update_<id>.
calendar_idstr"primary"Calendar to query and modify. Set to a shared or team calendar ID instead of the caller's own calendar.
modelModelNoneModel for sub-agents.
readboolTrueExpose query_calendar.
writeboolFalseExpose update_calendar. Disabled by default for safety.
modeContextModedefaultSee Mode.

The read/write flags below describe the default tool surface. See read/write control for mode and authorization boundaries.

Tools Exposed

ToolDescription
query_calendarList events, search events, check availability, find free slots. Exposed when read=True (default).
update_calendarCreate events, update events, delete events. Requires write=True.

Example queries

QueryWhat happens
"What's on my calendar this week?"Lists events with time range
"When am I free on Friday afternoon?"Checks availability
"Find all meetings about the product launch"Searches event titles/descriptions
"Schedule a 30-min sync with Alice tomorrow at 2pm"Creates event (requires write=True)

Resources