Docs /concepts/ Templates
concepts / fundamentals

Templates

Learn how Templates perform transformations over DataContainers.

templatesfundamentalsDocumentation latest

A Template is the fundamental unit of transformation in Sinapsis. A normal Template consumes one DataContainer, performs an operation, and returns one DataContainer.

◇ DiagramDrag nodes · Scroll to zoom · Drag canvas to pan
flowchart LR
    A[Input DataContainer] --> B[Template]
    B --> C[Output DataContainer]

Green-bordered nodes reference Sinapsis templates. Hover or focus them to fetch documentation.

View Mermaid source
mermaid
flowchart LR
    A[Input DataContainer] --> B[Template]
    B --> C[Output DataContainer]

A Template can read packets, modify data, add or remove packets, enrich metadata, add annotations or derive new content. It does not need a new interface every time the payload changes from text to images or tensors.

Example: enriching an image

An object-detection Template can consume an ImagePacket and return the same kind of packet enriched with annotations such as labels, bounding boxes or masks. A downstream Template might crop regions or calculate embeddings using those annotations.

Templates are combined inside Agents. When a graph branches, the special DataSplit operation establishes copy/ownership semantics for downstream branches; DataMerge handles explicit fan-in. These operations are exceptions to the normal one-input/one-output Template contract.

Templates work on the semantic data model, not MessagePack bytes or payload codec details. For exact semantics and exceptions, see Template Model.

Published from Git revision 7b7ba25d627b