agent-knowledge-block

A read-only static knowledge block that can be used as a tool by n8n AI Agents.

Package Information

Released: 4 mo ago
Downloads: 12 weekly / 199 monthly
Latest Version: 1.0.0
Author: Agent Knowledge Block contributors

Documentation

n8n-nodes-agent-knowledge-block

Agent Knowledge Block is a read-only n8n Community Node for storing static
knowledge, rules, policies, prices, booking instructions, and similar reference
text directly in a workflow.

The node works as a normal n8n node and is also marked with
usableAsTool: true, so it can be connected to an n8n AI Agent as a Tool. It
does not call external APIs, use a database, require credentials, or provide any
write, update, or delete operation.

Requirements

  • Node.js 22 or newer
  • A modern n8n version that supports Community Nodes as AI Agent tools

Installation

Install from npm

After the package is published:

npm install n8n-nodes-agent-knowledge-block

You can also install it from Settings > Community Nodes in n8n by entering:

n8n-nodes-agent-knowledge-block

Restart n8n after installation if your deployment does not restart
automatically.

Install a local build

From this package directory:

npm install
npm run build
npm pack

Then, in the directory where n8n is installed:

npm install /absolute/path/to/n8n-nodes-agent-knowledge-block-1.0.0.tgz

Restart n8n, then search the node picker for Agent Knowledge Block.

Node Fields

Field Purpose
Block Name A short identifier for the knowledge block
Tool Description Tells the AI Agent when it should call this tool
Knowledge Text The static, read-only text exposed by the node
Output Mode Returns either the full text or summary metadata

Use as a Normal Node

  1. Add Agent Knowledge Block to a workflow.
  2. Connect a preceding node to its main input.
  3. Enter a block name and paste the static content into Knowledge Text.
  4. Choose Full Text or Summary Metadata Only.
  5. Execute the workflow.

The node emits one clean JSON item for each incoming item. It never changes the
stored text.

Use as an AI Agent Tool

  1. Add an AI Agent node to the workflow.
  2. Add Agent Knowledge Block from the Agent's Tool connector.
  3. Set Tool Description to clearly explain the topic and when the Agent
    should read it.
  4. Paste the source material into Knowledge Text.
  5. Keep Output Mode set to Full Text when the Agent needs the content.
  6. Connect the Agent to your preferred chat model and run the workflow.

The toolDescription parameter is used by n8n as the tool description. The
Agent receives the knowledge only when it chooses to call the tool.

Recommended AI Agent system message:

Use the Agent Knowledge Block tool when you need to read stored rules, policies, prices, booking instructions, or any static knowledge. Do not guess if the answer should come from the knowledge block.

Example Output

With Output Mode set to Full Text:

{
  "blockName": "booking_policy",
  "knowledgeText": "Bookings may be rescheduled up to 24 hours before arrival.",
  "characterCount": 58,
  "wordCount": 10,
  "source": "agent_knowledge_block",
  "readOnly": true
}

With Output Mode set to Summary Metadata Only:

{
  "blockName": "booking_policy",
  "characterCount": 58,
  "wordCount": 10,
  "source": "agent_knowledge_block",
  "readOnly": true,
  "message": "Knowledge block exists and is available for reading."
}

When Knowledge Text is empty:

{
  "blockName": "booking_policy",
  "knowledgeText": "",
  "characterCount": 0,
  "wordCount": 0,
  "source": "agent_knowledge_block",
  "readOnly": true,
  "warning": "Knowledge Text is empty."
}

Token Usage

Using the node as a Tool can reduce the size of the Agent's main system prompt.
The knowledge text is sent to the Agent only when the Agent calls the tool,
instead of being included in every request. Tool results still consume model
context tokens when called, and very large blocks must fit within the selected
model's context window.

Development

Install dependencies:

npm install

Build:

npm run build

Lint:

npm run lint

Run tests:

npm test

Start n8n with the local node development loader:

npm run dev

The development command prints the local n8n URL and rebuilds the node while
files change.

Security and Data Handling

  • No credentials are defined or required.
  • No network requests are made.
  • No database is used.
  • No secrets or API keys are included.
  • No create, update, overwrite, or delete operation exists.
  • Anyone who can view or export the workflow can view the stored knowledge
    text, so do not use this node as a secret store.

License

MIT

Discussion