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.
The Zihin Agent node ships in the latest n8n-nodes-zihin release. Update the package to the
newest version to see it.
Installation
Community Nodes (recommended)
- In n8n: Settings → Community Nodes → Install
- Search for
n8n-nodes-zihin - Click Install
npm (self-hosted)
npm install n8n-nodes-zihin
Requires n8n ≥ 1.20 and Node.js ≥ 18.
Credential setup
- Get your API key at console.zihin.ai → Settings → API Keys (
zhn_live_*). - In n8n: Credentials → Add Credential → Zihin API.
- 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:
| Field | Description |
|---|---|
| Agent | The agent to invoke — loaded from your tenant (dropdown). |
| Message | The input sent to the agent. |
| Session ID | Reuse to continue a conversation; the output returns the session ID for the next call. |
Options:
| Option | Default | Description |
|---|---|---|
| Temperature | — | Sampling temperature passed to the agent. |
| Max Tokens | — | Maximum tokens to generate. |
| Timeout (Ms) | 120000 | Max total time for the call. |
| Base URL | — | Override for a private deployment. |
| Allow Custom Base URL | false | Allow a base URL outside the Zihin domain whitelist (your key is sent there). |
| Include Raw Events | false | Include 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]
- Add any trigger (Webhook, Chat, Schedule…).
- Add a Zihin Agent node and connect the trigger.
- Select the Agent, map the Message (e.g.
{{ $json.text }}), and optionally pass a Session ID to keep context. - Use
contentdownstream; persistsessionIdto continue the conversation later.
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
| Operation | Endpoint |
|---|---|
| Invoke agent | POST /api/v2/agents/:agentId/stream (SSE) |
| Agent picker | GET /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
| Issue | Solution |
|---|---|
| "Invalid API Key" | Verify the key is active at console.zihin.ai. |
| Agent not in the dropdown | Confirm the key's tenant owns the agent; reopen the node to reload. |
| Timeout errors | Increase Timeout (Ms) in the node options. |
| Localhost / private host blocked | Enable Allow Custom Base URL (and HTTP for localhost) only in development. |