Automate Document Q&A with Multi-Agent RAG Orchestration using Contextual AI & Gemini
UnknownWhat this workflow does
This AI workflow has 14 nodes and runs when someone submits an n8n form (“Create your AI Agent”) (plus 1 other trigger). Along the way it connects Google Gemini Chat Model and Contextualai (community).
How it runs
Trigger: When someone submits an n8n form (“Create your AI Agent”) (plus 1 other trigger).
- Preprocessing Step (Code): runs custom JavaScript code
- Agent Orchestrator (AI Agent): runs an AI agent, with model: Google Gemini Chat Model; 2 tools (List Agents Tool, Query Agent Tool); memory: Simple Memory
- Create Agent (Contextual Ai): uses Contextual Ai
- Split Out: splits a list into separate items
- Iterate over each files (Loop Over Items (Split in Batches)): loops over the items in batches
- Wait: waits 30 seconds
- Get Document Ingestion Status (Contextual Ai): get document metadata (datastore)
- If: checks a condition and branches into true / false
Services it uses
Before you upgrade to n8n 3.0
We can't fully verify this one: it relies on 2 community packages, and n8n 3.0 turns unverified community packages off by default (N8N_UNVERIFIED_PACKAGES_ENABLED=false).
- Check that n8n-nodes-contextualai is verified or supports 3.0 (used in Create Agent, Get Document Ingestion Status).
- Check that n8n-nodes-contextualai is verified or supports 3.0 (used in Query Agent Tool, List Agents Tool).
Nodes used (12)
- Contextual Ai
n8n-nodes-contextualai.contextualAi - n8n Form Trigger
n8n-nodes-base.formTrigger - Code
n8n-nodes-base.code - AI Agent
@n8n/n8n-nodes-langchain.agent - Chat Trigger
@n8n/n8n-nodes-langchain.chatTrigger - Google Gemini Chat Model
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - Simple Memory
@n8n/n8n-nodes-langchain.memoryBufferWindow - Contextual Ai Tool
n8n-nodes-contextualai.contextualAiTool - Split Out
n8n-nodes-base.splitOut - Wait
n8n-nodes-base.wait - If
n8n-nodes-base.if - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches
From the author
PROBLEM Managing multiple RAG AI agents can be complex when each has its own purpose and vector database. - Manually tracking agents and deciding which one to query wastes time. - LLMs often struggle to determine which agent best fits a user’s request. This…