> For the complete documentation index, see [llms.txt](https://docs.blockbrain.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.blockbrain.ai/for-admins/agents/google-agent.md).

# Google Agent

<table data-card-size="large" data-column-title-hidden data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-cover data-type="image">Cover image</th></tr></thead><tbody><tr><td><strong>Overview</strong></td><td><ul><li>Search and retrieve emails, calendar events, and Drive files from Google through Blockbrain</li><li>Compose, send, draft, read, and organize Gmail messages directly within Blockbrain</li><li>Create, read, update, and delete Google Calendar events, including availability and free/busy checks</li><li>Search, retrieve, and summarize Google Drive documents for reporting or AI analysis (read-only)</li><li>Automate email and calendar workflows using Google Workspace data</li></ul></td><td><a href="/files/ikR2AL5octrVSvEocI7Z">/files/ikR2AL5octrVSvEocI7Z</a></td></tr><tr><td><strong>Prerequisites</strong></td><td><ul><li>Complete the <a href="https://docs.en.theblockbrain.ai/for-users/agents">general setup steps</a> from the main AI Agents page</li><li>Ensure users have active Google Workspace (or Google) accounts with Gmail, Calendar, and Drive enabled</li></ul></td><td><a href="/files/X7MpGP1nVARHAWPFype1">/files/X7MpGP1nVARHAWPFype1</a></td></tr></tbody></table>

#### Google Cloud OAuth Configuration

**Required APIs**

In the Google Cloud Console, enable the following APIs for your project:

| API                 | Used for                                 |
| ------------------- | ---------------------------------------- |
| Gmail API           | Email search, read, send, drafts, labels |
| Google Calendar API | Calendar and event management, free/busy |
| Google Drive API    | File search and download (read-only)     |

**Google Cloud OAuth Configuration**

> **Recommended: use an "Internal" app (Google Workspace).**&#x20;
>
> Several of the scopes the Google Agent uses are classified by Google as **restricted** (Gmail and Drive) or **sensitive** (Calendar). For an **External** app, these scopes trigger Google's OAuth verification *and* an annual, paid security assessment by a Google-approved third party (CASA); until verified, the app is also capped at **100 users for the entire lifetime of the project** (this cap cannot be reset).
>
> Apps configured as **Internal** — owned by the customer's own Google Workspace organization and limited to users in that organization — are **fully exempt from verification, the CASA security assessment, and the 100-user cap**.

**Required OAuth Scopes**

Add the following Google OAuth scopes to your OAuth consent screen, grouped by the service they enable:

| Service         | Scope                                                     | Type      | Description                                                         |
| --------------- | --------------------------------------------------------- | --------- | ------------------------------------------------------------------- |
| Gmail           | `https://www.googleapis.com/auth/userinfo.email`          | Delegated | View the user's email address (sign-in / identity)                  |
| Gmail           | `https://www.googleapis.com/auth/gmail.compose`           | Delegated | Compose and send messages, and create and manage drafts             |
| Gmail           | `https://www.googleapis.com/auth/gmail.readonly`          | Delegated | Read and search messages, threads, labels, and attachments          |
| Google Calendar | `https://www.googleapis.com/auth/calendar`                | Delegated | Full read/write access to calendars and events, including free/busy |
| Google Drive    | `https://www.googleapis.com/auth/drive.readonly`          | Delegated | Read and download Drive files and content                           |
| Google Drive    | `https://www.googleapis.com/auth/drive.metadata.readonly` | Delegated | Read Drive file metadata (names, owners, types, dates) for search   |

> **Notes**
>
> * The Google Agent reads from Google Drive only (search and download), so Drive scopes are read-only by design.
> * Gmail access is split between `gmail.readonly` (reading and searching) and `gmail.compose` (composing, sending, and managing drafts).
> * `userinfo.email` identify the signed-in user and only need to be added once on the consent screen.
> * Offline access (refresh tokens) is handled by Blockbrain's OAuth broker (Nango) via `access_type=offline` — there is no separate "offline" scope to add.

**Scope Configuration Steps**

1. In the Google Cloud Console, go to **APIs & Services** > **Enabled APIs & services** and enable the Gmail, Google Calendar, and Google Drive APIs.
2. Go to **APIs & Services** > **OAuth consent screen** and configure the consent screen (Internal for a single Workspace, or External as required).
3. Under **Scopes**, click **Add or remove scopes** and add each required scope listed above.
4. Go to **APIs & Services** > **Credentials** > **Create credentials** > **OAuth client ID**, choose **Web application**, and create the client.
5. Note the **Client ID** and **Client Secret** — you will enter these in Blockbrain.

### Google Agent Configuration in Blockbrain

#### Gmail

* Scopes (in app)
  * `https://www.googleapis.com/auth/userinfo.email`
  * `https://www.googleapis.com/auth/gmail.compose`
  * `https://www.googleapis.com/auth/gmail.readonly`

<figure><img src="/files/aGFFq4HA2XcG28GyVig0" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/ZsViPR2eYkn13cGuFVTb" alt=""><figcaption></figcaption></figure>

#### GCalender

Scopes (in app)

* `https://www.googleapis.com/auth/calendar`

<figure><img src="/files/zsLhjlQeFmRMpumLOZtt" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/7E3G7m3yLBb74Z01UJc3" alt=""><figcaption></figcaption></figure>

#### GDrive

Scopes (in app)

* `https://www.googleapis.com/auth/drive.readonly`
* `https://www.googleapis.com/auth/drive.metadata.readonly`

<figure><img src="/files/C3nap6lPKzRZ8S16NXfk" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/KhdBXt6iPjjGkdjWaaMd" alt=""><figcaption></figcaption></figure>

#### Configuration Steps

1. **Access Agent Settings**:
   * Navigate to your Blockbrain admin panel
   * Go to **Agents** > **Gmail/Google Calendar/Google Drive Agent**
   * Click **"Install"**
2. **Enter Google Credentials**:
   * **Client ID**: Enter the Client ID from your Google OAuth client
   * **Client Secret**: Paste the client secret you generated
3. **Configure OAuth Scopes**:
   * Add each required scope individually using the **"Add"** button as listed above
   * Each scope appears as a removable tag with visual indicators
   * Use the **"X"** button to remove any incorrect scopes
4. **Save Configuration**:
   * Click **"Save"** to apply all settings

#### Common Google Integration Use Cases

**Email Management**

* **Automated Responses**: AI-powered email replies and drafting
* **Email Analysis**: Content analysis and summarization
* **Search & Retrieval**: Find and summarize specific emails

**Calendar Integration**

* **Meeting Scheduling**: AI-assisted meeting coordination with overlap detection
* **Event Creation**: Automated calendar event generation with sensible default durations
* **Availability Analysis**: Free/busy lookups to suggest open time slots

**Document Management**

* **File Discovery**: Locate documents by name, content, type, owner, or date
* **Content Analysis**: Summarize and extract key points from retrieved documents
* **Cross-Referencing**: Connect information across related files for reporting

#### Troubleshooting

**Email Permission Errors**

**Problem**: Cannot send or read emails

* **Solution**: Confirm both `gmail.readonly` (reading/search) and `gmail.compose` (sending and drafts) scopes are granted
* **Check**: Verify the user has an active Gmail mailbox and the Gmail API is enabled
* **Validate**: Test with a different user account to isolate permission issues

**Calendar Access Issues**

**Problem**: Calendar events not accessible

* **Solution**: Ensure the `https://www.googleapis.com/auth/calendar` scope is properly configured
* **Check**: Verify the user has calendar access and the Google Calendar API is enabled
* **Test**: Try listing calendars to confirm read access before testing writes

**Drive Access Issues**

**Problem**: Documents not found or not downloadable

* **Solution**: Ensure the `drive.readonly` and `drive.metadata.readonly` scopes are granted and the Google Drive API is enabled
* **Check**: Confirm the file is owned by, or shared with, the connected user
* **Note**: The agent has read-only Drive access — it can search and download, but not create or edit files

#### Security and Compliance

**Data Protection**

* **Email Security**: All email data is handled according to Blockbrain's security policies
* **Calendar Privacy**: Calendar access respects user privacy settings and sharing permissions
* **Document Confidentiality**: Drive content is accessed read-only and processed with appropriate confidentiality measures

**Compliance Considerations**

* **GDPR Compliance**: Email, calendar, and document data processing follows GDPR requirements
* **Data Retention**: Configure appropriate data retention policies for email and calendar data
* **Audit Logging**: All Google Agent activities are logged for compliance reporting

**Access Control**

* **User Permissions**: Agent inherits the authenticated user's Google permissions
* **Delegation**: Respects Google Drive and calendar sharing permissions
* **Domain Controls**: Can be governed via Google Workspace API access controls and app allowlisting

#### Next Steps

After successful Google Agent configuration:

* **User Training**: Provide training on email, calendar, and document AI features
* **Integration Setup**: Configure integration with existing business workflows
* **Monitoring**: Set up monitoring for agent performance and usage
* **Complementary Agents**: Consider the Outlook Agent for organizations running both Google and Microsoft 365 environments

#### Support and Resources

For assistance with Google Agent configuration:

* **Blockbrain Support**: Contact your Customer Success Manager for feature-specific help
* **Google Documentation**: Reference the Gmail, Google Calendar, and Google Drive API documentation for detailed scope information
* **Google Cloud Troubleshooting**: Use the Google Cloud Console and Workspace Admin audit logs for authentication diagnostics


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.blockbrain.ai/for-admins/agents/google-agent.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
