AI Model Wiki

    Skip to main content
    20 min
    Lesson 2 of 4

    Building AI Agents & RAG Pipelines

    From the course n8n AI Workflow Builder

    n8n's AI Agent node is one of the most powerful no-code agent builders available. It lets you create agents that can reason, use tools, and maintain conversation memory.

    AI Agent Architecture

    An n8n AI Agent consists of:

    1. LLM: The brain (GPT-4, Claude, Gemini, local models via Ollama)
    2. Tools: Actions the agent can take (HTTP requests, database queries, calculations)
    3. Memory: Conversation history (window buffer, summary, or vector memory)
    4. Output Parser: Structures the agent's response

    Building a RAG Pipeline

    Retrieval-Augmented Generation (RAG) lets your AI answer questions using your own documents:

    Ingestion Workflow:

    1. File Trigger: Watch a folder for new documents
    2. Document Loader: Parse PDF, Word, or text files
    3. Text Splitter: Break documents into chunks (500-1000 tokens)
    4. Embeddings: Generate vector embeddings (OpenAI, Cohere)
    5. Vector Store Insert: Store in Pinecone, Qdrant, or Supabase

    Query Workflow:

    1. Chat Trigger: User asks a question
    2. Vector Store Retrieval: Find relevant document chunks
    3. AI Agent: Answer using retrieved context + conversation memory
    4. Response: Return the answer with source citations

    Tool Integration

    n8n agents can use these built-in tools:

    • HTTP Request Tool: Call any API
    • Code Tool: Execute JavaScript or Python
    • Database Tool: Query SQL databases
    • Wikipedia Tool: Search Wikipedia
    • Calculator Tool: Perform calculations
    • Custom Tools: Build your own with sub-workflows

    Key Takeaways

    • •AI Agents combine an LLM, tools, and memory for autonomous task execution
    • •RAG pipelines ingest documents into vector stores for context-aware AI answers
    • •n8n supports multiple vector stores including Pinecone, Qdrant, and Supabase
    • •Custom tools can be built as sub-workflows for agent extensibility
    0 of 4 lessons marked complete

    Progress is kept in this browser only.