Skip to main content
This notebook demonstrates how to build a retrieval-augmented HR assistant in n8n with ZeroGPU Embeddings. You’ll build the policy assistant for Northwind Labs, a made-up company whose HR team answers the same questions every day about leave, expenses, and remote work. ZeroGPU Embeddings turns a seven-section employee handbook into vectors in an n8n vector store, and an AI Agent on the ZeroGPU Chat Model searches it before every answer, quotes the exact numbers, and says so when the handbook doesn’t cover a question instead of making something up. By combining n8n and herogpu, this notebook walks you through a practical pattern for grounding an assistant in your own documents, with the handbook indexed in about 2 seconds and each answer for about a tenth of a cent. For the full reference, see the n8n integration guide. Just want the workflow? Copy it from the 📥 Copy the Workflow section below and paste it into n8n. In this notebook, you’ll explore:
  • n8n: A fair-code workflow automation platform with a visual canvas, hundreds of built-in integrations, and AI nodes for agents, memory, vector stores, and tools. Here it loads the handbook into a vector store and runs the chat and the AI Agent that searches it.
  • Herogpu: A compute-efficient inference provider for apps and agents. We run purpose-built small and nano language models across an edge network for the high-volume tasks you run constantly - classification, extraction, moderation, routing, summarization - at ~10x lower latency and 50%+ lower cost than frontier-model workflows. Auto-scaling, with zero GPU infrastructure to manage. Plug in and you’re live.
  • ZeroGPU nodes for n8n: The official community node package, @zerogpu/n8n-nodes-zerogpu, which adds a ZeroGPU Chat Model, ZeroGPU Embeddings, and a ZeroGPU node to n8n. Here ZeroGPU Embeddings turns the handbook and every question into vectors, and the ZeroGPU Chat Model writes the answers.
This setup not only demonstrates a practical application of retrieval-augmented generation on low-cost models, but also provides a flexible framework that can be adapted to other real-world scenarios requiring assistants that answer only from your own policies, manuals, and knowledge bases.

🎥 Watch the Video Guide

If you prefer a visual walkthrough, check out the accompanying video guide below:

📥 Copy the Workflow

Want to skip the build? The finished workflow from the video, exported from n8n, is in its own file. It includes the blue note from the canvas in the video.

n8n-hr-policy-assistant.json

Open the workflow as raw JSON on its own page.
Bring it into n8n in any of three ways:
  • Paste it. Open the link, select everything and copy it (Cmd + A, then Cmd + C on a Mac, or Ctrl + A, then Ctrl + C elsewhere). Then click an empty spot on a new workflow’s canvas and paste.
  • Import from URL. In a new workflow, open the … menu at the top right, choose Import from URL, and paste the link.
  • Import from File. Save the page as n8n-hr-policy-assistant.json, then choose Import from File in the same menu.
Before you run it, install the ZeroGPU nodes and create your credential, as described in the next two sections. Then double-click ZeroGPU Embeddings, ZeroGPU Chat Model, and ZeroGPU Embeddings (search) and select your credential on each. The export leaves credentials out, so no API key travels with it. It also has no model field on the ZeroGPU nodes, because n8n leaves default values out of exported workflows, so both embeddings nodes run on all-minilm-l6-v2 and the chat model on deepseek-v4.1-flash. Then click Execute workflow once to load the handbook before you open the chat. To see how every node is set up and why, follow Building the HR Policy Assistant with n8n below.

📦 Installation

First, you need a self-hosted n8n instance where you’re the owner or an admin. If you don’t have one yet, start n8n locally with Node.js 20.19 to 24.x, then open http://localhost:5678:
Next, install the herogpu community nodes. In n8n, go to Settings > Community Nodes and select Install. Enter the package name below, check I understand the risks of installing unverified code from a public source, and select Install:
Search for ZeroGPU in the nodes panel to confirm the install. You’ll see three nodes: ZeroGPU, ZeroGPU Chat Model, and ZeroGPU Embeddings. If n8n runs in queue mode, or you’d rather install from a shell, follow the manual steps in the n8n integration guide. The vector store in this cookbook is n8n’s built-in Simple Vector Store, which keeps vectors in n8n’s memory, so there’s no database to set up.

🔑 Setting Up API Keys

You’ll need to set up your API key for herogpu. This ensures that n8n can reach herogpu’s models securely. You can go to here to get an API key from herogpu. The key starts with zgpu-api-. n8n keeps API keys in encrypted credentials, so you paste the key once and pick it on every ZeroGPU node:
  1. Open Credentials, create a new credential, and search for ZeroGPU API.
  2. Paste your key into API Key and save. n8n checks the key against an endpoint that needs authentication, without running any inference.
This workflow has three ZeroGPU nodes (two ZeroGPU Embeddings and the ZeroGPU Chat Model), and all three use the same credential.

🔢 Access Embeddings with herogpu

Herogpu is a compute-efficient inference provider for apps and agents. We run purpose-built small and nano language models across an edge network for the high-volume tasks you run constantly - classification, extraction, moderation, routing, summarization - at ~10x lower latency and 50%+ lower cost than frontier-model workflows. Auto-scaling, with zero GPU infrastructure to manage. Plug in and you’re live. In this section, we will turn one sentence into a vector with the ZeroGPU node as an example. Create a new workflow, click an empty spot on the canvas, and paste this (Cmd + V on a Mac, Ctrl + V elsewhere). It’s a manual trigger and one ZeroGPU node set to Embedding > Embed Text:
Paste onto the canvas
Double-click Embed Text, select your credential, and click Execute workflow:
The vector is truncated here; the real one has 384 numbers that capture the sentence’s meaning, so sentences that mean similar things get vectors that sit close together. That’s what lets the assistant find the right policy for a question that uses different words. all-minilm-l6-v2 costs $0.004 per 1M input tokens, so those 18 tokens cost a tiny fraction of a cent. In the RAG workflow below, you won’t call Embed Text yourself: the ZeroGPU Embeddings node plugs into the vector store and embeds every document and question for you. 🎉 herogpu effortlessly turns text into 384-dimensional vectors, providing fast, near-free embeddings for AI integration!

📚 Building the HR Policy Assistant with n8n

This section builds two flows on one canvas: one that embeds the handbook into a vector store, and one where an AI Agent searches it to answer questions. Every embedding and model call behind them runs on herogpu. When you’re done, the canvas looks like this:
You can build it step by step below, or copy the finished workflow from the 📥 Copy the Workflow section near the top of this page.

Step 1: Write the handbook

Create a new workflow and add a Manual Trigger (When clicking ‘Execute workflow’). After it, add a Code node, rename it Employee handbook, and paste this code. It returns the handbook as seven items, one per policy section:
Employee handbook
One section per item is a simple, effective way to chunk a document: each policy becomes one searchable piece, and none is longer than the 256 tokens all-minilm-l6-v2 reads. Northwind Labs and its handbook are made up for this demo. For your own handbook, you could load a file from Google Drive or a URL instead, and read PDFs with the ZeroGPU node’s Extract Text operation.

Step 2: Store the handbook in a vector store

Add a Simple Vector Store after Employee handbook and rename it Store handbook in vector store. Set:

Step 3: Connect ZeroGPU Embeddings and a data loader

The vector store has two inputs underneath it. Under Embedding, click +, choose ZeroGPU Embeddings, and select your credential. Keep Model Name or ID on all-minilm-l6-v2, the node’s default, which returns 384-dimensional vectors for $0.004 per 1M tokens. Under Document, click + and choose Default Data Loader. Set Type of Data to JSON, Mode to Load Specific Data, and Data to this expression, so each handbook section becomes one document:
Data
Leave Text Splitting on Simple. It splits text into chunks of 1,000 characters with a 200-character overlap, and every handbook section is shorter than that, so each section stays one chunk.

Step 4: Load the handbook

Click Execute workflow at the bottom of the canvas. The flow finishes in about 2 seconds (1.2 to 2.0 in testing), and Store handbook in vector store shows 7 items: one stored document per policy. Open ZeroGPU Embeddings to see the call it made, with the seven documents going in and seven vectors coming back. The whole handbook is about 1,200 characters, roughly 300 tokens, so embedding it costs about $0.0000012. Run this step again whenever the handbook changes. The Simple Vector Store keeps its data in n8n’s memory, so it’s also empty after n8n restarts, and the assistant would say the handbook doesn’t cover anything until you load it again.

Step 5: Add the chat and the AI Agent

Now the second flow. Add a Chat Trigger (When chat message received) and rename it Employee question. Add an AI Agent after it, open it, add the System Message option, and paste:
System message
Three rules keep the assistant honest: search first, answer only from the results, and say so (with a person to contact) when the handbook is silent. That last rule is what turns an unanswerable question into a helpful handoff instead of a made-up policy.

Step 6: Connect the ZeroGPU Chat Model and Simple Memory

Under the agent’s Chat Model input, click +, choose ZeroGPU Chat Model, and select your credential. Keep Model Name or ID on deepseek-v4.1-flash, at $0.30 per 1M input tokens and $1.20 per 1M output tokens. Under Memory, click +, choose Simple Memory, and set Context Window Length to 8, so employees can ask follow-ups like “And for sick leave?”

Step 7: Give the agent the handbook as a search tool

Under the agent’s Tool input, click + and choose Simple Vector Store. Rename it HR handbook and set: Then, under HR handbook’s own Embedding input, click +, choose ZeroGPU Embeddings, select your credential, keep all-minilm-l6-v2, and rename it ZeroGPU Embeddings (search). It turns each question into a vector to compare against the stored ones. It must use the same model as the node that stored the handbook: vectors from a different model wouldn’t match.

Step 8: Or import the finished workflow

Prefer to skip the clicking? Copy the finished workflow from the 📥 Copy the Workflow section near the top of this page, paste it onto an empty canvas, and select your credential on ZeroGPU Embeddings, ZeroGPU Chat Model, and ZeroGPU Embeddings (search). Save the workflow, then click Execute workflow once to load the handbook, as in Step 4.

Step 9: Ask the HR assistant

Click Fit view (the first button at the bottom left of the canvas), then Open chat. Ask these four questions one at a time. First, a question with a number in the answer:
In the Logs panel, the agent called HR handbook, which ran ZeroGPU Embeddings (search) on your question, before ZeroGPU Chat Model wrote the answer. It searched first, as its instructions say. Next, another exact figure:
Now a plain question that doesn’t use the handbook’s words:
The handbook never says “Hawaii”, but the question’s vector sat closest to the remote-work policy, so the search found it anyway. That’s the point of embeddings: plain questions work, not just keywords. Last, something the handbook doesn’t cover:
Instead of making up a perk, the assistant said so and pointed to HR. The numbers show in bold because that’s the agent’s own formatting, and the wording changes a little between runs, but the facts come straight from the handbook.

Step 10: Check the speed and the cost

Click the rows in Logs to see each step’s time and tokens. In testing, each answer took about 3 seconds (2.8 to 3.5), with one handbook search per question, and four answers together cost about $0.004, about a tenth of a cent each. Almost all of that is the chat model. The embeddings round to zero: each question is a dozen or so tokens at $0.004 per 1M, and the whole handbook cost about $0.0000012 to index.

Step 11: Take it to production (optional)

The Simple Vector Store is perfect for a demo, but it lives in n8n’s memory: it’s empty after a restart, and its memory keys are shared across the whole n8n instance. For production, swap both Simple Vector Store nodes for a persistent store such as Pinecone, Supabase, Qdrant, or PGVector, create the index with 384 dimensions to match all-minilm-l6-v2, and keep ZeroGPU Embeddings on both the insert and search side. If your n8n runs in queue mode, replace Simple Memory with a database-backed memory, since n8n’s docs say Simple Memory doesn’t work in that mode. Then turn on Make Chat Publicly Available on Employee question to give employees their own chat page. 🎉 You built an HR assistant that answers from your own handbook: ZeroGPU Embeddings indexed seven policies in about 2 seconds, and an AI Agent on the ZeroGPU Chat Model searched them before every answer, quoted the exact numbers, and admitted when the handbook was silent, for about a tenth of a cent per answer.

🌟 Highlights

This notebook has guided you through setting up and running an n8n workflow with herogpu for an HR policy assistant built on retrieval-augmented generation. You can adapt and expand this example for various other scenarios requiring assistants that answer only from your own policies, manuals, and knowledge bases. Key tools utilized in this notebook include:
  • n8n: A fair-code workflow automation platform with a visual canvas, hundreds of built-in integrations, and AI nodes for agents, memory, vector stores, and tools. Here it loads the handbook into a vector store and runs the chat and the AI Agent that searches it.
  • Herogpu: A compute-efficient inference provider for apps and agents. We run purpose-built small and nano language models across an edge network for the high-volume tasks you run constantly - classification, extraction, moderation, routing, summarization - at ~10x lower latency and 50%+ lower cost than frontier-model workflows. Auto-scaling, with zero GPU infrastructure to manage. Plug in and you’re live.
  • ZeroGPU nodes for n8n: The official community node package, @zerogpu/n8n-nodes-zerogpu, which adds a ZeroGPU Chat Model, ZeroGPU Embeddings, and a ZeroGPU node to n8n. Here ZeroGPU Embeddings turns the handbook and every question into vectors, and the ZeroGPU Chat Model writes the answers.
This comprehensive setup allows you to adapt and expand the example for various scenarios requiring assistants that answer only from your own policies, manuals, and knowledge bases.