Flow description
Purpose and benefits
Overview
This workflow automates the handling and response of incoming emails in Gmail using an AI-powered agent, document retrieval for knowledge-based answers, and Gmail management tools (send, label, unlabel). It is designed to streamline email processing, provide consistent and knowledge-grounded replies, and scale email operations with minimal human intervention.
How the Workflow Operates
1. Trigger: New Email Received
- The workflow begins when a new email message is received in the connected Gmail account.
- This event acts as the input and passes the message to the AI agent for processing.
2. AI Agent: Email Assistant
- The core of the workflow is an AI Agent configured with the backstory of a “mail manager” and the explicit goal:
“You are an email assistant in charge of responding to incoming emails in a professional and calm manner using the knowledge base given to you in the document retriever tool.” - The agent receives the content of the new email as its prompt.
The agent is enhanced with several tools, enabling it to take actions beyond generating text:
- Send Email Tool: Allows the agent to draft and send replies directly via Gmail.
- Add Label Tool: Lets the agent organize or categorize emails by adding labels.
- Remove Label Tool: Gives the agent the ability to unlabel emails when needed.
- Document Retriever Tool: Provides the agent access to a knowledge base, enabling it to ground its responses using up-to-date internal documentation or resources.
3. Document Retriever
- This component searches predefined knowledge sources for relevant documents based on the email content.
- It retrieves up to 3 documents per query, ensuring that responses can be informed by the latest or most relevant information.
- The agent uses this as a tool, meaning it can query the knowledge base as needed when composing a reply.
- Send Email: The agent can compose and send emails, including setting recipients, subject, body, and attachments.
- Label Management: The agent can both add and remove labels to help organize and track emails automatically.
5. Output: Chat Display
- Once the agent has processed the message (including querying the knowledge base and possibly sending a reply or labeling the email), the workflow outputs the response for visibility in a chat-like interface or log.
Workflow Structure
Stage | Action | Purpose/Benefit |
---|
Gmail New Message | Triggers on email arrival | Automates email intake |
AI Agent | Reads, understands, and responds to email | Scales professional, consistent replies |
Document Retriever | Supplies relevant knowledge to agent | Ensures factual, grounded responses |
Send Email Tool | Allows agent to reply directly | Full automation of email replies |
Add/Remove Label Tools | Agent organizes email with labels | Automated inbox management |
Chat Output | Displays agent’s response | Transparency, monitoring, and further integration |
Key Benefits and Use Cases
- Scalability: Handles large volumes of inbound emails without human bottlenecks.
- Consistency: Ensures every reply is professional and based on the latest knowledge.
- Automation: Reduces manual work for support, sales, or info email addresses.
- Knowledge Integration: Taps into internal or external documentation for accurate, context-aware replies.
- Inbox Management: Automatically organizes emails with labels, helping teams stay organized.
Example Use Cases
- Customer Support: Instantly answer customer queries using up-to-date FAQs and documentation.
- Sales Inquiries: Reply to leads with tailored, knowledge-based responses and track their status with labels.
- Internal Requests: Route and answer employee questions using company policies stored in the document retriever.
Summary
This workflow represents a powerful automation pattern for email handling. By integrating Gmail with advanced AI and document retrieval, organizations can deliver fast, accurate, and professional email responses while keeping the inbox organized. This helps scale operations, improve service quality, and free up human resources for more complex tasks.