> ## Documentation Index
> Fetch the complete documentation index at: https://docs.guild.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Gmail

> Give agents access to the Gmail API.

The `@guildai-services/guildai~gmail` package gives your agents access to the Gmail API through Guild's Gmail integration.

## Authentication

* **Type:** OAuth 2.0
* **Token management:** Refreshed automatically

### Setup

<Steps>
  <Step title="Open Credentials">Go to **Credentials** in Guild.</Step>
  <Step title="Connect Gmail">Click **Gmail** and authorize with your Google account.</Step>
</Steps>

## Usage

```typescript theme={null}
import { gmailTools } from "@guildai-services/guildai~gmail"
import { llmAgent } from "@guildai/agents-sdk"

export default llmAgent({
  description: "An agent that reads and sends email",
  tools: { ...gmailTools },
})
```

### Selecting specific tools

Tools are named with the `gmail_` prefix. Use `pick()` to include only what your agent needs.

```typescript theme={null}
import { gmailTools } from "@guildai-services/guildai~gmail"
import { llmAgent, pick } from "@guildai/agents-sdk"

export default llmAgent({
  description: "An agent that monitors and replies to email",
  tools: {
    ...pick(gmailTools, [
      "gmail_messages_list",
      "gmail_messages_get",
      "gmail_messages_send",
    ]),
  },
})
```
