Skip to content

Transform Node

NodeType = Transform (wire ordinal 13)

A model-free input-composition node. It renders its Mustache template against the current turn's slots — user_message, any slot.<name> written earlier this turn, knowledge_<source>, and the #instructions iterable block — and writes the result into its own slot. It runs no inference and never emits anything on the wire: send = None, history_role = none, fixed.

Use it to compose or rewrite text before a downstream node consumes it via input — the flagship case is query rewriting: Transform rewrites the raw user message (fixing grammar, resolving "this"/"that" references against prior turns) into a self-contained query, which a following Retrieve or Generate node then reads via input = <transform node name>.

See Slots and inter-node value passing for the full mental model, and How-to: query rewriting for RAG for the end-to-end recipe.


Parameters

Param Type Default Range Structural Description
template Optional[str] (multiline) inherit model default Mustache template rendered at execution time against the user_message tag, slot. tags, knowledge_ tags, and the #instructions iterable block.
output_name Optional[str] inherit model default Name this node's output slot is stored under. Empty = the node's own name. Structural: immutable after creation — renaming would re-wire the slot dataflow that is validated once at agent creation.

Exits

Each exit is a structural string field on the node's params; its value names the target node (empty = END).

Exit Param field Description
default default_exit Default exit target after rendering. Empty string = END.

Exit routes

Exit Condition
default Taken after the template is rendered into the node's slot.

Example

from tryll_client.graph import GraphDescription, TransformParams, RetrieveParams, GenerateParams

graph = (
    GraphDescription()
    .add_node("rewrite", TransformParams(
        template="Rewrite the user's message as a standalone question, "
                 "resolving pronouns against earlier turns: {{user_message}}",
        default_exit="retrieve",
    ))
    .add_node("retrieve", RetrieveParams(
        input="rewrite",
        embedded_string_storage="aquarium_kb",
        found_exit="generate",
        not_found_exit="generate",
    ))
    .add_node("generate", GenerateParams(input="rewrite", default_exit=""))
    .set_start_node("rewrite")
)
using namespace Tryll::Client;
using namespace Tryll::NodeParams;

TransformParamsT tp;
tp.template_ = "Rewrite the user's message as a standalone question: {{user_message}}";
tp.default_exit = "retrieve";

GraphDescription graph;
graph.AddTransform("rewrite", std::move(tp))
     .SetStartNode("rewrite");