Skip to main content
This will help you get started with the Gmail toolkit. This toolkit interacts with the Gmail API to read messages, draft and send messages, and more. For detailed documentation of all GmailToolkit features and configurations head to the API reference.

Setup

To use this toolkit, you will need to set up your credentials explained in the Gmail API docs. Once you’ve downloaded the credentials.json file, you can start using the Gmail API.

Installation

This toolkit lives in the langchain-google-community package. We’ll need the gmail extra:
To enable automated tracing of individual tools, set your LangSmith API key:

Instantiation

By default the toolkit reads the local credentials.json file. You can also manually provide a Credentials object.

Customizing authentication

Behind the scenes, a googleapi resource is created using the following methods. you can manually build a googleapi resource for more auth control.

Tools

View available tools:

Use within an agent

Below we show how to incorporate the toolkit into an agent. We will need a LLM or chat model:

API reference

For detailed documentation of all GmailToolkit features and configurations head to the API reference.