> ## Documentation Index
> Fetch the complete documentation index at: https://docs.herogpu.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 🧑‍💼 Build an HR Policy Assistant with n8n and ZeroGPU Embeddings

> Embed an employee handbook with ZeroGPU Embeddings into an n8n vector store, then answer HR questions with an AI Agent on the ZeroGPU Chat Model that quotes the exact numbers and says so when the handbook doesn't cover something, for about a tenth of a cent per answer.

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](https://docs.herogpu.com/integrations/n8n.md). 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:

[YouTube video player](https://www.youtube.com/embed/2y3TWeXR3-0)

## 📥 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.

> [card] [n8n-hr-policy-assistant.json](https://raw.githubusercontent.com/zerogpu/docs/main/cookbook/workflows/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](http://localhost:5678):

```bash theme={null}
npx n8n
```

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**:

```
@zerogpu/n8n-nodes-zerogpu
```

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](https://docs.herogpu.com/integrations/n8n.md#install-the-zerogpu-nodes).

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](https://platform.herogpu.com/dashboard) 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**:

```json Paste onto the canvas theme={null}
{
  "nodes": [
    { "name": "Start", "type": "n8n-nodes-base.manualTrigger", "typeVersion": 1, "position": [0, 0], "parameters": {} },
    { "name": "Embed Text", "type": "@zerogpu/n8n-nodes-zerogpu.zeroGpu", "typeVersion": 1, "position": [224, 0], "parameters": { "resource": "embedding", "operation": "embedText", "model": "all-minilm-l6-v2", "text": "ZeroGPU runs high-volume inference tasks on small models at the edge." } }
  ],
  "connections": { "Start": { "main": [[{ "node": "Embed Text", "type": "main", "index": 0 }]] } }
}
```

Double-click **Embed Text**, select your credential, and click **Execute workflow**:

```json theme={null}
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [0.012601, -0.072932, 0.043332, 0.028129, 0.033064, -0.078302, -0.153619, -0.011621]
    }
  ],
  "model": "all-MiniLM-L6-v2",
  "usage": { "prompt_tokens": 18, "total_tokens": 18 }
}
```

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:

```
Load the handbook:
When clicking 'Execute workflow' ──▶ Employee handbook ──▶ Store handbook in vector store
                                                              ├─ Embedding: ZeroGPU Embeddings (all-minilm-l6-v2)
                                                              └─ Document:  Default Data Loader

Answer questions:
Employee question ──▶ AI Agent
                        ├─ Chat Model: ZeroGPU Chat Model (deepseek-v4.1-flash)
                        ├─ Memory:     Simple Memory
                        └─ Tool:       HR handbook (search, top 3)
                                         └─ Embedding: ZeroGPU Embeddings (search) (all-minilm-l6-v2)
```

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:

```javascript Employee handbook theme={null}
return [
  "Paid time off (PTO): every employee at Northwind Labs gets 15 days of paid time off per year, accrued at 1.25 days per month. Up to 5 unused PTO days can be rolled over into the next year and must be used by March 31.",
  "Sick leave: employees get 10 days of paid sick leave per year. A doctor's note is required for absences longer than 3 consecutive workdays.",
  "Remote work: Northwind Labs is hybrid. Teams are in the office Tuesday through Thursday. Employees can work fully remote from anywhere in the US for up to 4 weeks per year with their manager's approval.",
  "Travel and expenses: submit expense reports within 30 days through the Expenses app. Meals are reimbursed up to a $75 per diem while traveling for work. Book economy class flights unless the flight is longer than 6 hours.",
  "Parental leave: the birthing parent gets 16 weeks of fully paid leave and the other parent gets 8 weeks of fully paid leave, to be taken within the first year.",
  "Equipment: laptops are refreshed every 3 years. New hires get a one-time $500 home-office stipend for a chair, desk or monitor.",
  "Holidays: Northwind Labs observes 11 paid US holidays a year, including Independence Day and Thanksgiving, and the office is closed from December 25 to January 1.",
].map(text => ({ json: { text } }));
```

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](https://docs.herogpu.com/integrations/n8n.md#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:

| Parameter | Value | Why |
| - | - | - |
| Operation Mode | Insert Documents | This flow writes the handbook into the store. |
| Memory Key | `northwind_hr_policies` | The name of the store. The search tool in Step 7 reads the same key. |
| Clear Store | On | Wipes the store before inserting, so running the flow again never stores duplicates. |

### 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:

```text Data theme={null}
{{ $json.text }}
```

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:

```text System message theme={null}
You are the Northwind Labs HR assistant. Always search the HR handbook tool before answering, and answer only from what it returns, quoting the exact numbers. If the handbook does not cover the question, say so and suggest contacting hr@northwindlabs.com.
```

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:

| Parameter | Value | Why |
| - | - | - |
| Operation Mode | Retrieve Documents (As Tool for AI Agent) | The agent can search the store whenever it needs to. |
| Description | `Search the Northwind Labs employee handbook for HR policies: PTO, sick leave, remote work, travel and expenses, parental leave, equipment and holidays.` | Tells the agent what's in the store, so it knows when to search. |
| Memory Key | `northwind_hr_policies` | The same store the first flow filled. |
| Limit | `3` | Returns the three closest policy sections for each search. |

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:

```text theme={null}
How many unused PTO days can I roll over to next year?
```

```
You can roll over up to **5** unused PTO days into the next year, and they must be used by **March 31**.
```

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:

```text theme={null}
What's the per diem for meals when I travel for work?
```

```
Meals are reimbursed up to a **$75** per diem while you're traveling for work.
```

Now a plain question that doesn't use the handbook's words:

```text theme={null}
Can I work remotely from Hawaii for a month?
```

```
The handbook doesn't mention Hawaii specifically, but employees can work fully remote from anywhere in the US for up to **4 weeks** per year with their manager's approval.
```

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:

```text theme={null}
Do we get a free gym membership?
```

```
The handbook doesn't cover gym memberships. Please contact hr@northwindlabs.com for more information.
```

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.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.