Skip to main content

n8n

Invoke Zihin agents from n8n workflows with the Zihin Agent node. The node calls a hosted agent (over @zihin/agent-client), which runs the full loop — tools, memory, governance — and returns the result.

Rolling out

The Zihin Agent node ships in the latest n8n-nodes-zihin release. Update the package to the newest version to see it.

Installation

  1. In n8n: Settings → Community Nodes → Install
  2. Search for n8n-nodes-zihin
  3. Click Install

npm (self-hosted)

npm install n8n-nodes-zihin

Requires n8n ≥ 1.20 and Node.js ≥ 18.

Credential setup

  1. Get your API key at console.zihin.aiSettings → API Keys (zhn_live_*).
  2. In n8n: Credentials → Add Credential → Zihin API.
  3. Enter your API key. It is validated against the Zihin API automatically.

The Zihin Agent node

Add the Zihin Agent node to a workflow and configure:

FieldDescription
AgentThe agent to invoke — loaded from your tenant (dropdown).
MessageThe input sent to the agent.
Session IDReuse to continue a conversation; the output returns the session ID for the next call.

Options:

OptionDefaultDescription
TemperatureSampling temperature passed to the agent.
Max TokensMaximum tokens to generate.
Timeout (Ms)120000Max total time for the call.
Base URLOverride for a private deployment.
Allow Custom Base URLfalseAllow a base URL outside the Zihin domain whitelist (your key is sent there).
Include Raw EventsfalseInclude the raw SSE events in the output (debugging).

Output — the node returns:

{
"content": "…the agent's answer…",
"sessionId": "sess-123",
"model": "anthropic.claude-haiku-4-5",
"usage": { "inputTokens": 0, "outputTokens": 0, "totalTokens": 0, "costUsd": 0 },
"sources": []
}

Example workflow

[Trigger] → [Zihin Agent] → [Respond / next step]
  1. Add any trigger (Webhook, Chat, Schedule…).
  2. Add a Zihin Agent node and connect the trigger.
  3. Select the Agent, map the Message (e.g. {{ $json.text }}), and optionally pass a Session ID to keep context.
  4. Use content downstream; persist sessionId to continue the conversation later.
Conversation continuity

Store the returned sessionId (e.g. keyed by chat/user) and feed it back into the next call so the agent remembers the conversation.

Endpoints used

OperationEndpoint
Invoke agentPOST /api/v2/agents/:agentId/stream (SSE)
Agent pickerGET /api/v2/agents

Legacy nodes (deprecated)

Earlier versions shipped a Zihin Chat Model sub-node (a direct LLM gateway over /api/v3/llm/public/call) and standalone media nodes (image / audio / document). These are deprecated in favor of the agent pattern and hidden by default. Existing workflows keep working, but new automations should use the Zihin Agent node.

Troubleshooting

IssueSolution
"Invalid API Key"Verify the key is active at console.zihin.ai.
Agent not in the dropdownConfirm the key's tenant owns the agent; reopen the node to reload.
Timeout errorsIncrease Timeout (Ms) in the node options.
Localhost / private host blockedEnable Allow Custom Base URL (and HTTP for localhost) only in development.