Prerequisites
The Gmail toolkit requires Google API client libraries and proper authentication setup. Install the required dependencies:- Go to Google Cloud Console
- Create a project or select an existing one
- Enable the Gmail API
- Create OAuth 2.0 credentials
- Set up environment variables:
Example
cookbook/tools/gmail_tools.py
Toolkit Params
Parameter | Type | Default | Description |
---|---|---|---|
creds | Credentials | None | Pre-fetched OAuth credentials |
credentials_path | str | None | Path to credentials file |
token_path | str | None | Path to token file |
scopes | List[str] | None | Custom OAuth scopes |
port | int | None | Port to use for OAuth authentication |
Toolkit Functions
Function | Description |
---|---|
get_latest_emails | Get the latest X emails from the user’s inbox |
get_emails_from_user | Get X number of emails from a specific sender |
get_unread_emails | Get the latest X unread emails |
get_starred_emails | Get X number of starred emails |
get_emails_by_context | Get X number of emails matching a specific context |
get_emails_by_date | Get emails within a specific date range |
create_draft_email | Create and save an email draft |
send_email | Send an email immediately |
search_emails | Search emails using natural language queries |
include_tools
or exclude_tools
to modify the list of tools the agent has access to. Learn more about selecting tools.