n8n is a workflow-automation tool. The official community node @surrealdb/n8n-nodes-surrealdb connects a workflow to SurrealDB for full CRUD and custom SurrealQL, and works as both an action node and an AI agent tool node. To give an n8n AI Agent long-term memory with Spectron, call the REST API from an HTTP Request node.
Install the SurrealDB node
The node runs on self-hosted n8n (v0.214.0+):
Open Settings → Community Nodes.
Click Install and enter
@surrealdb/n8n-nodes-surrealdb.Restart n8n if prompted.
It requires SurrealDB v3.0.0+ and connects over HTTP/HTTPS (WebSocket is not supported). It offers record, table, field, index, and relationship operations, a visual SELECT builder, and raw SurrealQL execution.
Give an AI Agent memory with Spectron
Spectron is a hosted service reached over HTTP with a Bearer key, so an HTTP Request node is the direct path. Store the endpoint and API key in n8n Credentials (Header Auth), not in the node.
Recall before the agent runs with an HTTP Request node calling context:
POST https://api.spectron.example/api/v1/acme-prod/context
Authorization: Bearer <your-api-key>
Content-Type: application/json
{
"query": "{{ $json.chatInput }}",
"scope": ["org/acme/user/{{ $json.userId }}"],
"k": 8
}Feed the returned context block into the AI Agent node's system prompt.
Store the turn afterwards with an HTTP Request node calling facts/batch:
POST https://api.spectron.example/api/v1/acme-prod/facts/batch
Authorization: Bearer <your-api-key>
Content-Type: application/json
{
"turns": [
{ "role": "user", "content": "{{ $json.chatInput }}" },
{ "role": "assistant", "content": "{{ $json.output }}" }
],
"scope": ["org/acme/user/{{ $json.userId }}"]
}Expose Spectron as an agent tool
Wrap either request in an HTTP Request Tool node and attach it to the AI Agent. The agent then calls recall or remember on its own during a run, the same way the framework adapters expose Spectron tools.
Scope per user or workflow
Set the scope on each call to isolate memory. A scope is a slash path or an array of paths, for example ["org/acme/user/alice"]. Derive it from workflow data such as a chat user id. Register paths with spectron scopes create before first use.
Next steps
REST API: the endpoints the HTTP Request nodes call
MCP server: if your n8n host speaks MCP instead