from agno.agent import Agent
from agno.tools.gmail import GmailTools
agent = Agent(
name="Gmail Agent",
tools=[GmailTools()],
instructions=[
"Based on user query, you can read, draft and send emails using Gmail.",
"While showing email contents, you can summarize the email contents, extract key details and dates.",
"Show the email contents in a structured markdown format.",
],
markdown=True,
show_tool_calls=True,
)
# Send a reply to an email
agent.print_response(
"Send a reply to the last email saying 'Thank you for your message. I'll get back to you soon.'",
stream=True,
)
Create a virtual environment
Terminal
and create a python virtual environment.python3 -m venv .venv
source .venv/bin/activate
Set your API key
export OPENAI_API_KEY=xxx
Set up Gmail credentials
export GOOGLE_CLIENT_ID=xxx
export GOOGLE_CLIENT_SECRET=xxx
export GOOGLE_PROJECT_ID=xxx
Install libraries
pip install -U google-auth google-api-python-client openai agno
Run Agent
python cookbook/tools/gmail_tools.py
Was this page helpful?