Gmail and Calendar from an AI Agent: Setting Up gogcli to Operate Google Services
The more you use AI agents, the more you want them to reach Google services — Gmail, Google Calendar, Google Drive. I set up a tool called gogcli so that Codex, Claude Code, and Antigravity could operate them.
What gogcli is
gogcli is an open-source tool for operating Google services — Gmail, Calendar, Drive, Contacts and others — from the command line. It comes from steipete, who built the much-discussed OpenClaw, and running on the CLI is exactly what makes it usable as an AI agent’s hands.
Once it is in place, instructions such as “put tomorrow’s appointment in my calendar” or “find that file on Drive” can be carried out through the AI agent you already use.
The trick to setup: have an AI walk you through it
The shortest route is to give your AI agent the URL of gogcli’s GitHub page and ask how to configure it. Broadly, it is five steps.
- Install gogcli (via Homebrew)
- Create a Google Cloud project and enable the APIs for the services you want
- Configure the OAuth app and obtain a client ID
- Register the credentials file (JSON) with gogcli
- Sign in and authorize with your Google account
The Google Cloud steps are disorienting the first time, but reporting what is on screen each time you get stuck is enough for the AI to guide you through. A warning that the app has not been verified by Google appears partway through authorization; that is expected, since this is a test app for your own use only.
A caution: handle the credentials carefully
The credentials file (JSON) and the account authorization you handle during setup are keys to your Google account. Keep to the basics: do not hand the file to anyone, and do not put it anywhere public. The more powerful the permissions you give an AI, the more this matters.
In summary: the all-in-one tool was the right call
I had installed a calendar-only CLI tool (gcalcli) shortly before, and gogcli was a straight superset of it. If you are starting now, go to gogcli directly.
Once an AI agent can reach Google services, integration with everyday work — writing to spreadsheets, drafting emails — opens up considerably. Combining it with Google Analytics work, covered later, is powerful as well.
This article is adapted for AI Jiten from testing notes originally published on the author’s blog, Delaymania.