On this page
Sommatic Docs
Open portal

Get Prompt Template

Hydrates a managed prompt template with dynamic variables.

View as Markdown
Open in
AI Partial ai.prompt Version 1.0.0 Execution: sync

Loads a managed prompt template from the backend, replaces its {{ key }} placeholders with variables, and returns the prompt plus the provider and model of the template. It does not call any LLM.

Instead of hardcoding prompts in your workflow, use this operator to fetch versioned, managed templates from the Prompt Registry and fill them with workflow data.

Benefits:

  • Separation of Concerns: Prompts can be tuned by Prompt Engineers without changing code.
  • Version Control: Use specific versions of a prompt.
  • Reusability: Share standard system prompts across workflows.

How it works

  1. Resolves the node config: expressions in config keys are evaluated against the run; the incoming item is used as-is.
  2. Merges the incoming item with the resolved config and requires template_id.
  3. Fetches the template record from the backend prompt registry and takes its body from template_body, content or template, in that order.
  4. Replaces every {{ key }} (spaces optional) with the value of variables.key. Placeholders without a variable stay as they are.
  5. If the template has an llm_provider_id, reads that provider record to fill config.provider (its slug) and config.model (deployment name or default model); a failure here only logs and leaves them null.
  6. Returns { prompt, config } without a port, so the engine routes it to out.

In a workflow

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

{
  "node_id": "node-load-prompt",
  "label": "Load complaint prompt",
  "operator_slug": "ai.prompt",
  "operator_version": "1.0.0",
  "config": {
    "template_id": "<prompt_template_id>",
    "version": "latest"
  }
}

Configuration

template_id string Required

ID of the managed prompt template.

version string Optional

Specific version tag or "latest".

Default: latest

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.

version
Declared but ignored: the current record of the template is always used.
variables
Read from the incoming item; a variables key in the config (undeclared, may be an expression) overrides it. Values are inserted as strings, so objects become [object Object]. Keys are used inside a regular expression without escaping, so use plain names (letters, digits, _).

Output ports

success default

Never fires. On success the worker returns no port, the engine uses out, and out is not declared by this node: edges drawn from success do not run, so the workflow stops here.

Data
{
  "prompt": "Summarize the complaint from Ana Ruiz in two sentences.",
  "config": {
    "provider": "azure-openai",
    "model": "gpt-4o-mini",
    "language": "en",
    "format": "text"
  }
}
error

Validation or a backend call failed. data is { error }, plus response with the backend body when the HTTP call failed.

Data
{
  "error": "Prompt Template <template_id> not found"
}

In expressions

What a later node can read from this node's output with $("Get Prompt Template").item.json.<path> (write your node's label instead of Get Prompt Template). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through success, from the output shown in Ports.

ExpressionEditorWorker
$("Get Prompt Template").item.json.promptstring= "Summarize the complaint from Ana Ruiz in two…"The fully hydrated prompt string.
$("Get Prompt Template").item.json.configobject= {…}Model configuration associated with the prompt.
$("Get Prompt Template").item.json.config.providerstringNot suggested by the editor= "azure-openai"—
$("Get Prompt Template").item.json.config.modelstringNot suggested by the editor= "gpt-4o-mini"—
$("Get Prompt Template").item.json.config.languagestringNot suggested by the editor= "en"—
$("Get Prompt Template").item.json.config.formatstringNot suggested by the editor= "text"—

— Worker: The worker returns it but the editor does not suggest it: write it by hand. Keys inside objects can depend on your data or configuration (for example one key per label).

Errors

Message Port Cause and fix
Missing 'template_id' error template_id is empty.
Prompt Template <template_id> not found error The registry has no template with that id.
Template <template_id> has no content error The template record has no body.
Request failed with status code <status> error The backend answered the template lookup with a non-2xx status.

Input contract

variables object Required

Key-value pairs to inject into the template placeholders.

Output contract

prompt string Optional

The fully hydrated prompt string.

config object Optional

Model configuration associated with the prompt.

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.prompt",
  "name": "Get Prompt Template",
  "category": "ai",
  "version": "1.0.0",
  "description": "Hydrates a managed prompt template with dynamic variables.\n\n  Instead of hardcoding prompts in your workflow, use this operator to fetch versioned, managed templates from the Prompt Registry and fill them with workflow data.\n\n  **Benefits:**\n  - **Separation of Concerns:** Prompts can be tuned by Prompt Engineers without changing code.\n  - **Version Control:** Use specific versions of a prompt.\n  - **Reusability:** Share standard system prompts across workflows.",
  "capabilities": [
    "prompt-engineering",
    "template",
    "ai"
  ],
  "config_schema": {
    "type": "object",
    "required": [
      "template_id"
    ],
    "properties": {
      "template_id": {
        "type": "string",
        "title": "Template ID",
        "description": "ID of the managed prompt template.",
        "ui_widget": "prompt_picker"
      },
      "version": {
        "type": "string",
        "title": "Version",
        "default": "latest",
        "description": "Specific version tag or \"latest\"."
      },
      "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": {
      "variables": {
        "type": "object",
        "description": "Key-value pairs to inject into the template placeholders."
      }
    },
    "required": [
      "variables"
    ]
  },
  "output_contract_schema": {
    "type": "object",
    "properties": {
      "prompt": {
        "type": "string",
        "description": "The fully hydrated prompt string."
      },
      "config": {
        "type": "object",
        "description": "Model configuration associated with the prompt."
      }
    }
  },
  "ports": [
    {
      "port_id": "success",
      "label": "Success",
      "is_default": true
    },
    {
      "port_id": "error",
      "label": "Error"
    }
  ],
  "execution_mode": "sync",
  "tags": [
    "prompt",
    "template",
    "registry"
  ],
  "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
sync
Stateful
No
Retries (retryOnFail)
No
Capabilities
prompt-engineeringtemplateai
Tags
prompttemplateregistry

Notes and limits

  • This node is partial: until the success port is fixed, do not connect nodes after it. Use the template body directly in an ai.* node instead.
  • Backend requests have no timeout set.
  • The engine does not apply execution.retryOnFail, maxTries, waitBetweenTries or continueOnFail to this node. Handle failures by wiring the error port.

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