Skip to main content
Read a Gmail conversation and create a contextual reply draft for human review.
The source’s draft-only instruction is prompt guidance. GmailTools() exposes send_email and send_email_reply by default. Disable the send tools before running.
draft_reply.py

Run the Example

1

Set up your virtual environment

2

Install dependencies

3

Export environment variables

4

Disable send tools

Replace GmailTools() with GmailTools(send_email=False, send_email_reply=False, send_draft=False).
5

Run the example

Save the code above as draft_reply.py, then run:
Full source: cookbook/91_tools/google/gmail/draft_reply.py