Overview
Genesis connects to Google Workspace through the Connections page (Config → Connections). Two authentication methods are supported:shared, finance, marketing) and select them by name from agent tools using the connection_name parameter.
Prerequisites
Before creating a connection, set up a Google Cloud project with the required APIs:Step 1: Create or select a GCP project
- Go to console.cloud.google.com
- Create a new project (e.g.
Genesis_Google_Integration) or select an existing one
Step 2: Enable Google APIs
In your GCP project, go to APIs & Services → Library and enable:- Google Drive API
- Google Sheets API
- Google Docs API
- Google Slides API
- Google Calendar API (if using calendar tools)
- Gmail API (if an agent reads and sends mail from its own mailbox)
- Google Chat API (if talking to Genesis agents from Google Chat)
Option A: User OAuth Setup (Recommended)
User OAuth lets each user authorize Genesis to access their own Google Drive. This is the preferred method for interactive workflows.Configure the OAuth consent screen
Create the OAuth client
Create a Google Workspace connection in Genesis
openid and email. Once Access is set it decides the scopes, whatever the connection’s Scopes field holds. A connection saved before the Access option existed keeps its configured scopes until you edit and save it.Also under More options, Gmail and Calendar add their own scopes to whatever Access asks for. Both default to No access:Add the redirect URI to the OAuth client
https://<your-genesis-host>/api/connections/google_workspace/<connection-name>/oauth/callback/ui. The URL contains the connection name, so each connection needs its own entry. Copy it into the OAuth client’s Authorized redirect URIs in Google Cloud and save. A missing or different URI fails with redirect_uri_mismatch.Connect OAuth
Test
google_drive(action="LIST"). With Gmail on, the test also reads the mailbox profile (users.getProfile); with Calendar on, it lists one calendar (calendarList.list). A failure there usually means the API is not enabled in the Google Cloud project, or the grant predates the option: enable the API and click Connect OAuth again. If the test reports that Google no longer accepts the connection’s sign-in, click Connect OAuth again; if that still fails, remove the app at myaccount.google.com/permissions and reconnect.Changing Access later
To give an existing read-only connection write access, edit it, set Access to Read and write, save, then click Connect OAuth again so Google asks for the edit permissions. Until you reconnect, the stored grant stays read-only: a write such as creating a Sheet returns a message saying the connection was authorized read-only and how to fix it, rather than Google’s rawACCESS_TOKEN_SCOPE_INSUFFICIENT error.
Sending mail from the agent’s mailbox
Thegmail tool reads, searches, labels, archives and drafts directly. SEND and REPLY go through Action Review as the gmail.send.v1 action:
- Mail whose recipients (To, Cc and Bcc) are all in the mailbox’s own domain is sent at once.
- Mail with any other recipient waits for a person to approve it; approving it sends it, once. Without the agent mailbox, the approver needs their own grant on the connection, signed in to the same mailbox; an approval through another mailbox or no grant sends nothing. With it on, anyone with access to the agent may approve, with no grant of their own. An agent never approves. A mailbox on a consumer domain such as gmail.com has no internal recipients.
default-gmail-send-review-v1 and default-gmail-send-internal-v1); a tenant policy that writes its own rules for gmail.send.v1 replaces them. Mail content the tool returns is marked as untrusted external content, and each message body is fenced, so the agent treats it as data rather than instructions. GET_ATTACHMENT saves an attachment into the conversation’s uploads.
The agent mailbox
Normally a grant answers for the person calling the tool, so one sign-in asgennie@your-domain serves nobody else. Agent mailbox is an opt-in setting, off by default, that makes the connection’s grant belong to the connection, for the agents assigned to it:
gennie_google:
Create the connection
gennie_google with User OAuth, Gmail set to read, label, draft and send, and Calendar as you need it.Sign in once, as the mailbox
gennie@your-domain. Your Genesis account is now the one that holds this sign-in, and the one people are told to ask when it needs reconnecting.Assign the connection to the agent
owner_bot_id or allowed_bot_ids also counts; * or an empty list assigns nobody.Turn on the agent mailbox
{"signed_in_user_id": "..."} names another person’s sign-in; the default is yours. GET reads the setting, including who set it and when, and DELETE turns it off.- “Internal” is measured from the mailbox. The domain comes from the address Gmail reports, so with
gennie@your-domainmail toyour-domainis sent at once and anything else waits for review. - Changing the signed-in account asks again. If the person holding the sign-in reconnects and picks a different Google account, the agent refuses to use it until an admin turns the agent mailbox on again, which pins the new address. Reconnecting as the same account just works. Someone else clicking Connect OAuth on the connection only creates their own grant, which Drive and Sheets use for them and the Gmail and Calendar tools ignore.
- Switching the connection away from User OAuth while the agent mailbox is on makes the Gmail and Calendar tools refuse until it is switched back or the setting is turned off. They never drop to per-person sign-ins.
- An agent’s own turn with no person behind it, such as a scheduled task, may use the mailbox too, and its audit row names only the agent.
- Every use is on the record. The audit log’s
connection.agent_mailbox_usedrows name the person acting (as the actor), the agent, the mailbox, the tool action and whether it was used or refused. In a turn, the person acting is whoever asked the agent. When a held send runs, it is whoever approved it.connection.agent_mailbox_setrows name who changed the setting. A sent mail’s Action Review row names who asked, who approved, and the mailbox it leaves from. - Mail stays untrusted. Nothing in a message can approve anything.
- The token stays in the encrypted secret store, under the person who signed in, and never appears in logs, audit rows or tool results.
Option B: Service Account Setup
Service accounts are ideal for unattended automation, shared folders, and scheduled jobs.Create a service account
GenesisBot_ServiceAccount). Assign the Editor role (or Viewer for read-only).Generate a JSON key
Share a Drive folder with the service account
Genesis_Shared_Folder). Share it with the service account email (e.g. [email protected]) with Editor access. Copy the folder ID from the URL.Create a Google Workspace connection in Genesis
Test
google_drive(action="TEST_CONNECTION") or google_drive(action="LIST") to verify. Use GET_SERVICE_ACCOUNT_EMAIL to confirm which account is active.Google Chat direct messages
Genesis can receive direct messages from Google Chat and route them to an individual Genesis agent. Google Chat uses the same Google Workspace connection type, but the connection must be a shared Service Account connection that the agent can access. User OAuth connections are not used for Google Chat ingress. Add these optional fields to the shared Google Workspace connection:Enable the Google Chat API
Create the shared connection
google_chat_endpoint_audience to the bot-specific HTTPS event URL and google_chat_allowed_domain_id to your Workspace domain ID.Configure the Google Chat app
google_chat_endpoint_audience.Message the agent in a direct message
/new in the direct message to start a new Genesis DM episode. Follow-up
messages stay correlated within the current episode; a new episode does not
reuse the previous episode’s work correlation.
Context Graph scanning
Google Workspace connections can be registered as Context Graph lineage sources from Digital Twin and Context Graph. Saving a connection does not add it to the graph automatically — use Add source in the Twin configuration modal. Scheduled scans run headless and require a long-lived credential. User OAuth connections appear in the Twin picker but Add source stays disabled; use a Service Account connection for unattended Context Graph harvesting. When registered, Twin reads documents from the configured shared folder, clusters them into wiki summaries, and indexes content for semantic search.Multiple Named Connections
You can create multiple Google Workspace connections for different teams or purposes:connection_name is omitted, Genesis resolves the effective default google_workspace connection for the current user (My default, then Role default). When multiple role defaults for google_workspace conflict, Genesis treats the scoped default as unset and can fall back to legacy service-account configuration instead of returning an error. See Default connection layers.
Migration from Legacy Setup
If you previously configured Google Workspace through the old standalone setup page, Genesis automatically runs theaa004_google_workspace_connection startup migration to copy those credentials into a google_workspace.shared connection. No manual action is required when the migration succeeds.
The migration is idempotent. If google_workspace.shared already exists in AppConfig, Genesis skips it. On retry after a partial failure, Genesis reconciles secrets that were already created instead of aborting on a conflict.
If the migration fails, Genesis logs a CRITICAL STARTUP MIGRATION CHAIN HALTED message listing every later startup migration that was blocked (for example LLM provider backfill migrations). Resolve the reported failure and restart Genesis; pending migrations run on the next startup. Search Pulse Monitoring Live Logs or your server log for STARTUP MIGRATION CHAIN HALTED.
Related Pages
- Google Drive Tools — full tool reference
- Connections — managing connections
- OAuth Providers — OAuth configuration

