đź’¬ Automated Gmail support agent with Gemini 2.5, RAG & Cohere reranking

⚡ 288 views · 💬 Support Chatbots

Description

AI Email Support Agent with RAG & Cohere Reranking

Transform your inbox into an intelligent support system: automatically detect new emails, retrieve relevant knowledge from Pinecone, rerank with Cohere for precision, generate contextual replies using Gemini AI, and respond—all while maintaining conversation history.

What It Does

This workflow triggers on incoming Gmail messages, leverages a LangChain agent with PostgreSQL memory for context, queries a Pinecone vector store (RAG) enhanced by Cohere reranking and OpenAI embeddings, crafts personalized responses via Gemini 2.5, and auto-replies to keep support flowing.

Key Features

Perfect For

Technical Highlights

Built on n8n’s LangChain ecosystem, this workflow highlights:

Setup Instructions

Prerequisites

Required Credentials

Gmail OAuth2

  1. Enable Gmail API in Google Cloud Console
  2. Create OAuth2 credential in n8n with scopes: https://www.googleapis.com/auth/gmail.readonly, https://www.googleapis.com/auth/gmail.send

OpenAI API

  1. Get API key from platform.openai.com
  2. Add as OpenAI credential in n8n

Cohere API

  1. Sign up at cohere.com
  2. Copy API key to n8n Cohere credential

Google Gemini API

  1. Generate key at https://aistudio.google.com/
  2. Add as Google PaLM credential in n8n (compatible with Gemini)

Pinecone API

  1. Create index “agency-info” with dimension 1024
  2. Add API key to n8n Pinecone credential

Postgres

  1. Set up database (e.g., Neon/Supabase) with a table for chat history
  2. Add connection details (host, database, user, password) to n8n Postgres credential

Configuration Steps

  1. Import the workflow JSON into your n8n instance
  2. Assign all required credentials to the respective nodes
  3. Populate the Pinecone “agency-info” index with your knowledge base documents (use a separate upsert workflow or Pinecone dashboard)
  4. Customize the tableName in the Postgres Memory node if needed (default: “email_support_agent_”)
  5. Adjust the agent’s system prompt or topK retrieval if required for your use case
  6. Activate the workflow and test by sending a sample email to trigger it

Troubleshooting

Perfect for deploying hands-off email automation. Import, connect credentials, and activate!

đź”— Nodes Used

Gmail, Gmail Trigger, AI Agent, Embeddings OpenAI, Pinecone Vector Store, Google Gemini Chat Model

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup