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

# Gmail Tools

## Code

```python cookbook/tools/gmail_tools.py theme={null}
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,
)
```

## Usage

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Set your API key">
    ```bash theme={null}
    export OPENAI_API_KEY=xxx
    ```
  </Step>

  <Step title="Set up Gmail credentials">
    ```bash theme={null}
    export GOOGLE_CLIENT_ID=xxx
    export GOOGLE_CLIENT_SECRET=xxx
    export GOOGLE_PROJECT_ID=xxx
    ```
  </Step>

  <Step title="Install libraries">
    ```bash theme={null}
    pip install -U google-auth google-api-python-client openai agno
    ```
  </Step>

  <Step title="Run Agent">
    <CodeGroup>
      ```bash Mac theme={null}
      python cookbook/tools/gmail_tools.py
      ```

      ```bash Windows theme={null}
      python cookbook/tools/gmail_tools.py
      ```
    </CodeGroup>
  </Step>
</Steps>
