Use this powerful n8n workflow to automatically deploy and orchestrate multiple RAG agents via Contextual AI and Gemini. This advanced n8n template leverages sophisticated n8n nodes, memory, and specialized tools, starting with the n8n trigger.
Download this n8n workflow template and start using it instantly.
AI Developers needing robust RAG orchestration.
Businesses aiming to automate support or research using multiple specialized knowledge bases.
n8n users looking for advanced examples of LangChain integration and custom tool usage.
Engineers wanting to deploy a dynamic, contextual AI system using an n8n trigger and n8n node logic.
Managing specialized knowledge across multiple Retrieval-Augmented Generation (RAG) agents can be challenging. This innovative n8n workflow solves this by providing a two-part solution: agent creation and agent orchestration. The first part uses an n8n trigger (Form) to define a new agent, upload documents, and wait for ingestion completion. The second part uses a Chat n8n trigger combined with an advanced Agent Orchestrator n8n node, powered by Gemini 2.5 Flash, to intelligently determine which Contextual AI agent holds the relevant information for a user query. This setup ensures grounded, context-aware responses without manual agent selection, making this n8n template highly valuable for scaling AI operations.
This n8n workflow operates in two distinct phases:
Submit Agent Information form n8n trigger, capturing the agent's name, description, datastore name, and binary files (documents).Create Agent Contextual AI n8n node creates the new agent and initiates document ingestion.Split Out and Iterate over each files). It then enters a loop using the Wait n8n node (30-second delay) and the Get Document Ingestion Status n8n node. An If n8n node checks if the document status is 'completed'. If not, the loop repeats until all files are successfully ingested and the agent is ready for querying.Chat n8n trigger receives a user question.Agent Orchestrator n8n node takes the query. It is configured with a system message that directs it to use the List Agents Tool to identify available agents and the Query Agent Tool to interact with the selected agent.Google Gemini Chat Model as the foundational LLM and maintains context across the conversation using the Simple Memory n8n node (Buffer Window).Query Agent Tool with the user's question, and returns the grounded answer.To deploy this comprehensive RAG multi-agent n8n workflow, follow these setup steps:
CONTEXTUALAIAPIKEY. Add this API key as a credential named 'Contextual AI account' in your n8n setup.Submit Agent Information n8n trigger or swap the Form Trigger with a Webhook Trigger for seamless external integration.This n8n workflow utilizes several specialized n8n node components:
Submit Agent Information (Form Trigger): The initial n8n trigger, collecting agent configuration (Name, Description, Datastore) and required binary files.
Create Agent (ContextualAi n8n node): Creates the agent structure in Contextual AI and handles the initial document upload. Key configuration links agent details using expressions from the trigger data.
Wait (Wait n8n node): Implements a necessary 30-second pause to create a polling loop for checking asynchronous document ingestion status.
Get Document Ingestion Status (ContextualAi n8n node): Retrieves the status of document processing using the document ID and datastore ID, essential for the RAG setup.
Chat (ChatTrigger n8n trigger): The conversational n8n trigger that initiates the RAG query process.
Agent Orchestrator (Langchain Agent n8n node): The central logic n8n node. It dictates tool selection, utilizing the system prompt to guide dynamic agent choice based on user intent. It requires connections to the LLM, memory, and tools.
Google Gemini Chat Model (Langchain n8n node): Provides the LLM reasoning capability (Gemini 2.5 Flash) for the orchestrator to decide which agent to query.
Query Agent Tool & List Agents Tool (ContextualAi Tool n8n nodes): These are the callable functions used by the Agent Orchestrator to interact directly with the underlying Contextual AI agents and their RAG knowledge bases.
Use this powerful n8n workflow to automatically ingest, chunk, embed, and index Google Drive documents into Pinecone for a custom RAG (Retrieval Augmented Generation) knowledge base, powered by OpenAI. Discover how to create efficient n8n templates.

Automate sophisticated multi-level document approval processes using this n8n workflow template, leveraging Supabase as the backend database and Gmail for secure, tokenized approval links. Track every step with audit logs.

Use this robust n8n workflow to automate Docker-based n8n updates securely. Features scheduled checks, digest comparison, and required email approval before executing critical SSH commands.

Use this n8n workflow template to automatically manage DigitalOcean Droplet snapshots. Schedule runs, enforce snapshot limits, and ensure timely backups using n8n.

Comprehensive n8n workflow for fetching, parsing, cleaning, and filtering Dutch TenderNed procurement data using sophisticated n8n nodes, custom code, XML handling, and the n8n Data Table.

Use this reliable n8n workflow template to automate new order processing from platforms like Shopify or WooCommerce. Features instant customer confirmation and internal team notification using the EmailSend n8n node.


DevRel at Contextual AI







































