RAG Compose Prompt
Constructs a RAG (Retrieval-Augmented Generation) prompt by combining a query with retrieved context.
Experimental stub. It returns a fixed { message, timestamp } object through out and does not build any prompt: query, context, template and max_context_tokens are ignored.
This operator formats a list of retrieved documents into a context block and injects it into a "Answer with context" prompt template.
Use Cases:
- Q&A over internal documentation.
- Summarizing search results.
- Grounding LLM responses in factual data.
How it works
- Resolves the node config: expressions in config keys are evaluated against the run; the incoming item is used as-is.
- Returns
{ message: "Executed ai.rag.compose", timestamp }with no port, so the engine routes it toout.
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-compose",
"label": "Compose RAG prompt",
"operator_slug": "ai.rag.compose",
"operator_version": "1.0.0",
"config": {
"max_context_tokens": 4000
}
}{
"ok": true,
"port": "out",
"data": {
"message": "Executed ai.rag.compose",
"timestamp": "2026-11-26T15:04:05.000Z"
}
}Configuration
-
templatestring Optional -
Must contain {{context}} and {{query}} placeholders.
-
max_context_tokensnumber Optional -
Limit context size to fit model window.
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.
-
template / max_context_tokens - Declared but ignored.
Output ports
out default Every run.
{
"message": "Executed ai.rag.compose",
"timestamp": "2026-11-26T15:04:05.000Z"
}error Never emitted by the code.
In expressions
What a later node can read from this node's output with $("RAG Compose Prompt").item.json.<path> (write your node's label instead of RAG Compose Prompt). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through out, from the output shown in Ports.
| Expression | Editor | Worker |
|---|---|---|
$("RAG Compose Prompt").item.json.promptThe final prompt ready for generation. | — | |
$("RAG Compose Prompt").item.json.message | — | |
$("RAG Compose Prompt").item.json.timestamp | — |
— Editor: The editor suggests it, but the worker does not return it: it reads as undefined.
— 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).
Input contract
-
querystring Required -
The user question.
-
contextarray | string Required -
List of text chunks or already joined string.
Output contract
-
promptstring Optional -
The final prompt ready for generation.
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.compose",
"name": "RAG Compose Prompt",
"category": "ai",
"version": "1.0.0",
"description": "Constructs a RAG (Retrieval-Augmented Generation) prompt by combining a query with retrieved context.\n\n This operator formats a list of retrieved documents into a context block and injects it into a \"Answer with context\" prompt template.\n\n **Use Cases:**\n - Q&A over internal documentation.\n - Summarizing search results.\n - Grounding LLM responses in factual data.",
"capabilities": [
"rag",
"prompt-engineering",
"context-window"
],
"config_schema": {
"type": "object",
"properties": {
"template": {
"type": "string",
"title": "RAG Template",
"format": "textarea",
"default": "Context:\n{{context}}\n\nQuery:\n{{query}}\n\nAnswer using only the context above:",
"description": "Must contain {{context}} and {{query}} placeholders."
},
"max_context_tokens": {
"type": "number",
"default": 4000,
"title": "Max Context Tokens",
"description": "Limit context size to fit model window."
},
"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."
},
"context": {
"type": [
"array",
"string"
],
"description": "List of text chunks or already joined string."
}
},
"required": [
"query",
"context"
]
},
"output_contract_schema": {
"type": "object",
"properties": {
"prompt": {
"type": "string",
"description": "The final prompt ready for generation."
}
}
},
"ports": [
{
"port_id": "out",
"label": "Composed",
"is_default": true
},
{
"port_id": "error",
"label": "Error"
}
],
"execution_mode": "sync",
"tags": [
"rag",
"prompt",
"compose"
],
"is_stateful": false,
"publisher": {
"identity": "org_sommatic_ai",
"profile": {
"name": "Sommatic AI",
"verified": true,
"url": "https://me.veripass.com/sommatic",
"logo_url": null
}
}
}{
"type": "object",
"properties": {
"template": {
"type": "string",
"title": "RAG Template",
"format": "textarea",
"default": "Context:\n{{context}}\n\nQuery:\n{{query}}\n\nAnswer using only the context above:",
"description": "Must contain {{context}} and {{query}} placeholders."
},
"max_context_tokens": {
"type": "number",
"default": 4000,
"title": "Max Context Tokens",
"description": "Limit context size to fit model window."
},
"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
}
}
}
}
}{
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "The user question."
},
"context": {
"type": [
"array",
"string"
],
"description": "List of text chunks or already joined string."
}
},
"required": [
"query",
"context"
]
}{
"type": "object",
"properties": {
"prompt": {
"type": "string",
"description": "The final prompt ready for generation."
}
}
}[
{
"port_id": "out",
"label": "Composed",
"is_default": true
},
{
"port_id": "error",
"label": "Error"
}
]Execution
- Execution
sync- Stateful
- No
- Retries (
retryOnFail) - No
- Capabilities
ragprompt-engineeringcontext-window- Tags
ragpromptcompose
Notes and limits
- Not implemented: placeholder substitution, context joining and context-size limits. To build a RAG prompt today, use
data.templateorai.generatewith your own template.
Reviewed against the orchestrator code · 31e874b · 2026-11-26