On this page
Sommatic Docs
Open portal

Retrieve Context (RAG)

Orchestrates the retrieval of context for RAG (Retrieval-Augmented Generation).

View as Markdown
Open in
AI Experimental ai.rag.retrieve Version 1.0.0 Execution: async

Experimental and not runnable: the slug does not resolve to a registered worker, so the node fails before it starts. The code behind it only fills a prompt template; it performs no retrieval.

This high-level operator abstracts the Embedding -> Vector Search -> Reranking pipeline into a single step. It takes a text query, handles the embedding internally (or via configuration), searches the vector store, and returns the best matching text chunks.

Use Cases:

  • "One-click" RAG context retrieval.
  • Simplifying the graph by hiding vector complexity.

How it works

  1. The runner looks for a worker registered for this slug, finds none and falls back to the name AiRagRetrieveWorker, which is not registered either.
  2. Spawning throws Worker not found: AiRagRetrieveWorker; the engine records the step on error and fails the run.

In a workflow

The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.

{
  "node_id": "node-rag-retrieve",
  "label": "Retrieve context",
  "operator_slug": "ai.rag.retrieve",
  "operator_version": "1.0.0",
  "config": {
    "knowledge_base_id": "<knowledge_base_id>",
    "top_k": 3
  }
}

Configuration

knowledge_base_id string Required

ID of the managed Knowledge Base to search.

top_k number Optional

Default: 3

Its configuration shows the shared execution settings, but this node does not apply retries (retryOnFail, maxTries) yet. continueOnFail is not applied by any node.

Behaviour in the code

What the implementation does with these keys beyond what the schema says.

knowledge_base_id / top_k
Declared but never read.

Output ports

success default

Never fires.

empty

Never fires.

error

Every run fails at spawn. The error is thrown, so edges from error do not receive it; only an enclosing flow.try catches it.

Data
{
  "error": "Worker not found: AiRagRetrieveWorker"
}

In expressions

What a later node can read from this node's output with $("Retrieve Context (RAG)").item.json.<path>, as the workflow editor suggests it under Previous Nodes (the output contract).

Expression
$("Retrieve Context (RAG)").item.json.contextarrayRetrieved text chunks.
$("Retrieve Context (RAG)").item.json.sourcesarrayMetadata about sources (page numbers, filenames).

Errors

Message Port Cause and fix
Worker not found: AiRagRetrieveWorker error Thrown, not returned as an envelope: the engine marks the run as failed, unless the node sits inside a flow.try scope, which receives the error on its catch branch.

Input contract

query string Required

The user question/query.

Output contract

context array<string> Optional

Retrieved text chunks.

sources array<object> Optional

Metadata about sources (page numbers, filenames).

Contracts (JSON Schema)

The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.

{
  "slug": "ai.rag.retrieve",
  "name": "Retrieve Context (RAG)",
  "category": "ai",
  "version": "1.0.0",
  "description": "Orchestrates the retrieval of context for RAG (Retrieval-Augmented Generation).\n\n  This high-level operator abstracts the Embedding -> Vector Search -> Reranking pipeline into a single step. It takes a text query, handles the embedding internally (or via configuration), searches the vector store, and returns the best matching text chunks.\n  \n  **Use Cases:**\n  - \"One-click\" RAG context retrieval.\n  - Simplifying the graph by hiding vector complexity.",
  "capabilities": [
    "rag",
    "retrieval",
    "search",
    "abstraction"
  ],
  "config_schema": {
    "type": "object",
    "required": [
      "knowledge_base_id"
    ],
    "properties": {
      "knowledge_base_id": {
        "type": "string",
        "title": "Knowledge Base",
        "description": "ID of the managed Knowledge Base to search."
      },
      "top_k": {
        "type": "number",
        "default": 3
      },
      "execution": {
        "type": "object",
        "title": "Execution Settings",
        "properties": {
          "alwaysOutputData": {
            "type": "boolean",
            "title": "Always Output Data",
            "description": "Always output data, even on error (if configured).",
            "default": false
          },
          "retryOnFail": {
            "type": "boolean",
            "title": "Retry On Fail",
            "description": "Retry the execution if it fails.",
            "default": false
          },
          "maxTries": {
            "type": "integer",
            "title": "Max Retries",
            "description": "Number of retries.",
            "default": 3,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "waitBetweenTries": {
            "type": "integer",
            "title": "Wait Between Retries (ms)",
            "default": 1000,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "continueOnFail": {
            "type": "boolean",
            "title": "Continue On Fail",
            "description": "Do not crash workflow on error.",
            "default": false
          },
          "timeout_ms": {
            "type": "integer",
            "title": "Timeout (ms)",
            "description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
            "default": 300000
          }
        }
      }
    }
  },
  "input_contract_schema": {
    "type": "object",
    "properties": {
      "query": {
        "type": "string",
        "description": "The user question/query."
      }
    },
    "required": [
      "query"
    ]
  },
  "output_contract_schema": {
    "type": "object",
    "properties": {
      "context": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Retrieved text chunks."
      },
      "sources": {
        "type": "array",
        "items": {
          "type": "object"
        },
        "description": "Metadata about sources (page numbers, filenames)."
      }
    }
  },
  "ports": [
    {
      "port_id": "success",
      "label": "Retrieved",
      "is_default": true
    },
    {
      "port_id": "empty",
      "label": "No Data"
    },
    {
      "port_id": "error",
      "label": "Error"
    }
  ],
  "execution_mode": "async",
  "tags": [
    "rag",
    "retrieval",
    "search"
  ],
  "is_stateful": false,
  "publisher": {
    "identity": "org_sommatic_ai",
    "profile": {
      "name": "Sommatic AI",
      "verified": true,
      "url": "https://me.veripass.com/sommatic",
      "logo_url": null
    }
  }
}

Execution

Execution
async
Stateful
No
Retries (retryOnFail)
No
Capabilities
ragretrievalsearchabstraction
Tags
ragretrievalsearch

Notes and limits

  • Not implemented: embedding the query, searching a knowledge base, ranking and returning context/sources. The worker file that would serve it only replaces {{context}} and {{query}} in a template.
  • There is no successful envelope: the example shows the failure the engine records.

Reviewed against the orchestrator code · 31e874b · 2026-11-26

Install agent tools

Give your coding agent the official Sommatic AI docs: skills, the docs MCP server and Markdown pages, so it never has to scrape the site.

Skills only. They do not update by themselves; run it again to refresh.

npx skills add https://docs.sommatic.ai
How agents read these docs