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.

info

The Zihin Agent node ships in n8n-nodes-zihin ≥ 0.9.0 (npm). Update the package if you don't 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.ai → Settings → 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
Temperature—Sent to the agent, but the /stream endpoint does not apply it (reported in ignored_fields). Configure it in the agent's llm_config.
Max Tokens—Same as Temperature: not applied by /stream. Configure it in the agent's llm_config.
Timeout (Ms)120000Max total time for the call. Sent to the backend as options.timeout_ms, which only shortens the turn deadline (180 s on the platform). See Agent invocation contract.
Base URL—Override 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 errorsThe turn deadline is fixed by the platform (180 s) and cannot be extended; Timeout (Ms) only shortens it. For longer tasks use an async trigger. See Agent invocation contract.
Localhost / private host blockedEnable Allow Custom Base URL (and HTTP for localhost) only in development.