Templates, fixed blocks and validated output
Use Templates for reusable writing formats. Choose Writing guidance when the model may adapt the structure. Choose Strict layout when ZASTRA must assemble fixed headings, section order, spacing and signatures from validated data. Both are private to their owner and work with models available in the administrator's catalogue.
When you select a file, its filename stays visible while you edit the template or correct a failed save. Changing the output mode clears the file selection; select the appropriate source again before saving. A successful save clears the form for the next template.
You can ask Raggy to create or change a private writing template. For example: “Make a short invoice note with three bullets and flag anything still needing checks.” Give its name, purpose and writing preferences, then review the proposed save. Raggy checks the saved template before confirming completion. You can also review and edit it under Templates.
Fill a Word source template
Choose Output mode → Word source template to generate a downloadable document from an existing Word master. This mode preserves the master's styles, tables, images, headers, footers and signature areas. It is separate from importing a Word file as writing guidance. A source template is not offered in the chat or Agent writing-template selector.
-
Make a reviewed copy of the master. Replace each changing value with a named placeholder such as
{{customer_name}}. Use letters, digits and underscores, starting with a letter or underscore. A placeholder can span Word formatting runs, but must remain in one paragraph without a line break, tab or automatic field inside it. Use placeholders in body paragraphs, table cells, headers or footers. Use the optional sections described below for clauses that depend on an explicit choice. Resolve other alternatives and drafting notes before uploading; source filling does not infer clause choices or repeat table rows. -
Under Templates, enter the name, type and purpose, select Word source template, and upload the DOCX. Define an object schema containing exactly the placeholder names. Each field must have a scalar type: string, number, integer, boolean, or a nullable combination. For example,
{"type":"object","properties":{"customer_name":{"type":"string","minLength":1}},"required":["customer_name"],"additionalProperties":false}. Required fields must be present; useminLength: 1when empty text is unacceptable. Optional missing values and null appear as empty text. Zero and false remain explicit values. -
Save. ZASTRA retains the original source unchanged and records its SHA-256 identity. Open the saved template, enter Sample field values (JSON) and download a Word authoring preview or PDF authoring preview. Save schema changes before previewing. Inspect every page for wrapping, page breaks, table layout and signature space. Preview neither publishes nor approves a business document.
-
In the workflow designer, add Document generator and select Word source template as its mode. Choose the master. For each field, choose From an earlier step and use the variable picker, or choose Fixed value and enter a literal scalar of the schema's type. Not mapped leaves the field absent; required fields then fail validation. A fixed string resembling a workflow reference remains literal. The source hash is captured with the selection.
-
Choose DOCX or PDF and a filename. The master supplies all document formatting; Markdown content, added headers, footers, watermarks, timestamps and page-number settings are not applied. Connect the generator's download output to Message to show the normal file card. Generated files can enter the existing document-storage and human approval steps when configured.
For a prepared value set, choose Template values → Values object from an earlier step and select a connected Object. Its keys must match the selected Word schema; supplied values keep their types. Optional keys can be omitted. Explicit null is accepted only when that field permits it; false and zero remain values. Do not add dummy values for inactive clauses. Required keys, unknown keys, types and clause selectors are validated before generation. Switching value modes or reselecting the master clears the previous mappings.
For the filename, choose Fixed or automatic, or From an earlier step and select a connected String. An input must contain nonblank text without a folder or path. ZASTRA cleans the name and applies the selected DOCX or PDF extension. Switching filename modes clears the previous value. If generation stops, correct the source values or filename rather than substituting invented data.
An AI drafting step may prepare structured values from approved inputs; map those actual fields into the Document generator. The AI builder and Raggy can prepare this wiring using an available owned source template. The master text and values do not grant permission or authorize actions. Rendering verifies structure and identity, not facts, legal suitability, signature or approval. Keep human review where required.
The source must belong to the account executing the workflow; sharing an agent does not share a private master. Other accounts cannot read or render it by guessing its ID. Replacing source bytes requires a new template and a deliberate workflow selection; a changed or unavailable source fails instead of falling back to a rebuilt document. Descriptive metadata and the scalar schema can be edited on the saved template; review and test schema changes before subsequent runs.
Source files allow 6 MiB compressed, 30 MiB expanded, 1,000 package parts and 250 named fields total, including conditional selector names (with at most 64 conditional blocks). Total inserted text is limited to 200,000 characters. Formatting of a replacement starts from its first placeholder run; longer values can change pagination. Values are literal text, including quotes and line breaks; no expressions, loops, scripts, macros, embedded programs, external content fetching or digital-signature preservation are supported. Passive HTTP, HTTPS and mailto hyperlinks remain. Use a reviewed unsigned copy when a source has a digital signature; retaining a signature area does not sign the generated document.
PDF uses the installation's local Office converter. If conversion is unavailable or fails, use DOCX and ask an administrator to check that converter; no text-based layout fallback is used. The generated Word custom properties or PDF metadata retain the source hash. If generation reports a missing field, correct its mapping or supply the evidence; do not invent a required value just to pass validation. Downloaded Word previews can be opened in Word or the normal native document preview.
The workflow also captures a separate policy hash for the scalar field schema. A schema change invalidates the previous selection even when the DOCX bytes stay identical. Select the updated master again and review the mappings before republishing; changing only its name, purpose or descriptive guidance does not change that policy identity.
Optional sections
To include a reviewed section only when a Boolean field is true, place these opening and closing markers in separate paragraphs around it:
{{#if include_note}}
Note: {{note}}
{{/if include_note}}
For a section used when the field is false, use {{#unless include_note}} and {{/unless include_note}}. Each pair must stay in the same text container, such as the document body or one table cell. Do not nest blocks, cross table cells, or include a section break. You can use up to 64 blocks; selector names count toward the combined 250 named-field limit.
Declare every selector as a required boolean in the field schema. Supply the actual JSON value true or false; a missing value, null, 0 or the text "false" cannot replace a decision. Fields in an excluded section may be omitted when the schema permits it. Use if and then to require them when that section is included:
{"type":"object","properties":{"include_note":{"type":"boolean"},"note":{"type":"string","minLength":1}},"required":["include_note"],"additionalProperties":false,"if":{"properties":{"include_note":{"const":true}}},"then":{"required":["note"]}}
Map each selector in Document generator to an earlier reviewed decision or a fixed Boolean value. The selected master supplies the clause wording; a selector does not establish a business fact or grant approval. Generated field values remain literal text, even if they contain marker-like text.
Create Word or PDF authoring previews with each choice and inspect the retained text, numbering, table layout and signature areas. If a marker is unmatched, nested or placed inside ordinary text, correct the master and upload the reviewed copy. If a required choice or fact is missing, correct the field mapping before generating again.
Conditional table rows
Use a conditional row when a whole table row should appear only after an explicit Boolean decision. Put {{#if-row show_details}} or {{#unless-row show_details}} as the entire first paragraph in the row’s first cell. The first form keeps the row only for Boolean true; the second keeps it only for Boolean false. There is no closing row marker. Define each selector as a required, nonnullable boolean in the existing object schema and map an actual decision. A missing or Not mapped choice stays missing and stops generation; never default it to false or infer it from absent facts. Use the schema’s if/then rules for facts required only when a row is included. Row selection omits a source row; it does not repeat the row or establish a fact or approval.
Use only top-level tables in the document body, header or footer. Put one marker in the complete first paragraph of the first direct cell of a row; a row can have only one marker. Each affected table must retain at least one unconditional row, and its header row must remain unconditional. Horizontal cell spans are preserved. Nested tables, vertical cell merges, and conditional rows that overlap Word fields, bookmarks, comments or other range markers are unsupported and validation stops. Keep row conditions separate from paragraph optional-section markers. Row and paragraph conditions share the existing limit of 64 blocks; selector names count toward the combined 250 named fields. If validation refuses the master, simplify the table structure or resolve the optional wording in the master before upload.
Fill an XLSX source template
Use an Excel source template when a workflow must fill a copy of an existing workbook while preserving its layout. This source mode is separate from writing guidance and strict text layout. Source templates are not offered in chat or writing-template selectors.
-
Prepare an
.xlsxmaster with one exact sheet name, a header row, sample data rows, and a sample row whose cell styles should be copied. Formula cells cannot be used as headers. Keep the file within 20 MB. -
Under Templates, enter the name, type and purpose, select Excel source template, upload the master and enter its fill policy as JSON. The policy includes
sheet_name, 1-basedheader_row, exactheaders,data_start_row,sample_data_range,style_prototype_row,max_data_rowsand onecolumnsrule per header. A rule names its exactheader, usestypetext,decimalordate, and setsblanktoalloworreject; decimal rules also setprecisionfrom 0 to 14. For example:
{"sheet_name":"Sheet1","header_row":1,"headers":["Reference","Amount"],"data_start_row":2,"sample_data_range":{"start_row":2,"end_row":3},"style_prototype_row":2,"max_data_rows":1000,"columns":[{"header":"Reference","type":"text","blank":"reject"},{"header":"Amount","type":"decimal","blank":"allow","precision":2}]}
Headers must be unique and match the workbook exactly. There can be 1–256 columns, no more than 10,000 output rows or 100,000 cells. data_start_row follows header_row; the sample range begins at data_start_row, and the style row must be inside that range. Save the template to validate the sheet and policy. ZASTRA records separate SHA-256 identities for the workbook and policy.
Within Excel’s supported numeric precision, Decimal values may contain extra trailing fractional zeroes beyond the declared precision when removing only those zeroes leaves the value unchanged: with precision 2, 1.2500 is accepted as 1.25. A value such as 1.234 is rejected at precision 2 and is never rounded automatically; choose an appropriate higher precision or correct the input. The master workbook’s number format controls how an accepted value is displayed.
-
In the workflow designer, add ExcelProcessor and choose Fill an XLSX source template. Select your private template. ZASTRA stores its workbook and policy identities in the node; they are refreshed when you deliberately select a template. Choose an upstream array containing row objects keyed by the exact headers, or row arrays with the same width and column order. Set the output filename.
-
Connect the node's download output to Message to show the generated workbook. Each run creates an XLSX copy using the master layout; it does not ask for another workbook upload. Check the run log if a row fails validation or the selected template is unavailable or has changed.
Metadata can be edited without changing the saved workbook and policy. To change either one, create a new source template and select it in the workflow. The source must belong to the account that runs the workflow; sharing an agent does not share its private template. XLSX source templates are not Word source templates and are not available to Document generator.
Writing guidance and Word files
Create a template with a name, type, purpose and optional Additional guidance. Write its content directly, or upload a .docx, .txt or .md file. Word import extracts body paragraphs and tables in order; table cells are separated by |. It does not transfer page layout, typography, images, logos, headers or footers. This mode produces a guided chat response, not a new Word document preserving the uploaded design.
For a memo, write Summary, Analysis and Sources in the template content. In Additional guidance, write: “Use these headings in this order. Keep the summary brief. Support factual statements with the supplied sources. State when information is not established.” Writing guidance influences wording and structure but does not guarantee an exact layout. The template provides no factual evidence and does not change data access, available tools or citation requirements.
Select the template in the chat composer before sending the request. In the agent designer, select it on the Agent generation node, before a Message or Email node. Merely mentioning a template's name in a question does not load it. Selection does not add sources, change retrieval queries or override dataset permissions.
Reusable fixed blocks and signatures
Open Templates → Fixed blocks & signatures. Add a name and the exact text, including the intended line breaks. For example:
Kind regards,
Claire Martin
Customer Services | Example Company
claire@example.com
Save the block. In a strict template, select it from Choose a fixed block and click Insert block. ZASTRA inserts a reference such as {{block:0123456789abcdef0123456789abcdef}} into the layout; use your actual saved block rather than the illustrative ID. Move this reference to the desired position in the layout. It may be used for signatures, disclaimers, introductions or standard closing text.
Saved blocks keep their exact text without being rewritten by the model. Placeholder-looking text inside a generated field or fixed block appears literally. Ask the model to produce the body without a signature to avoid an additional model-written closing.
Edits apply on the next request/run; a run already in progress uses its captured configuration. ZASTRA prevents deletion of a block referenced by an owned template. Remove its references first. Blocks are private, with no cross-user lookup. They are not imported automatically from a mailbox's signature settings. Gmail and Outlook workflows currently use plain-text bodies; this feature does not create HTML signatures or inline logos.
Configure a strict layout
-
Add a template and select Output mode → Strict layout. Enter its purpose and writing instructions. For example: “Write a concise support answer from the supplied information. Preserve source links. Do not add headings or a signature inside the fields.”
-
Define the Output fields (JSON Schema). Load example schema & layout supplies a starting point; adapt it to your task.
-
Enter the Fixed layout using literal text and
{{field_name}}placeholders. Field names must match the schema. Use letters, digits and underscores, with a letter or underscore first. -
Insert any saved fixed blocks. Enter sample JSON in Sample values, then choose Validate & preview. Preview checks the structure and shows the formatted text without a model call or token cost. It does not check the truth of sample facts.
-
Save, select the template in a chat or generation node, and run a representative request.
Example schema:
{
"type": "object",
"additionalProperties": false,
"properties": {
"body": {"type": "string", "minLength": 1, "description": "The answer, grounded in supplied information"},
"sources": {"type": "array", "items": {"type": "string"}, "description": "Supplied source links and citations"}
},
"required": ["body", "sources"]
}
Example layout, before inserting your saved signature:
Response
{{body}}
Sources
{{sources}}
Sample values:
{"body": "The return instructions are available in the support guide.", "sources": ["https://example.org/support"]}
The headings and their position remain exactly as entered. String arrays appear one item per line. Missing optional fields and null values appear as empty text; other values, including nested objects, appear as JSON. Layouts support fixed text and placeholders, without calculations or loops. A strict layout fixes the text structure; it does not produce a precisely typeset document or guarantee identical display in different email clients.
Validation and structured agent output
The validator checks JSON Schema types, required fields, enums, string/item limits, numeric limits, nested objects and supported formats such as email addresses. required requires presence; add minLength: 1 to forbid empty strings. Use additionalProperties: false to reject unexpected fields. An empty source array is allowed unless you set minItems; do not force a citation that the research cannot supply. Schema references and regular expressions are rejected. Duplicate JSON keys, non-finite JSON numbers and malformed JSON are rejected rather than silently repaired.
An Agent's Structured output → Configuration can define a schema without selecting a strict template. That returns validated data for branching and downstream tools. With a strict template selected, the template controls the schema: structured contains the validated fields and content contains the rendered text. Connect Email Content or Message to that content output using the variable picker. No additional Text processing node is needed. If a subject is a schema field, select that structured field for Email Subject separately.
Agent generation uses its configured model and retry count. Invalid output produces a node error when retries are exhausted; no rendered content is supplied to the normal downstream path. Configure an exception branch for review and test it. A configured fallback is a separate deliberate workflow action: do not route fallback/error text into automatic Send. Schema validity verifies structure, not factual accuracy or research completeness; keep research-success and source-review checks before sending.
In chat, a strict template shows a complete, validated answer in the configured format. If the fields cannot be validated, ZASTRA shows an error rather than an invalid partial answer. Strict formatting uses more model tokens and takes longer than writing guidance. Adding fixed blocks does not require additional model usage. A local-only dataset still requires an allowed local model; formatting does not bypass that restriction.
Maintenance, limits and troubleshooting
Templates and blocks use the selecting user's identity in chat and the workflow owner's identity in agents. Another user's saved template/block cannot be referenced. A deleted template or missing block fails visibly. Changing a template or block affects subsequent uses; publish an agent again after changing its selected template ID or wiring. Review important template edits because existing schedules use the newly saved content on their next runs.
Ordinary files are limited to 6 MiB, extracted/template text to 20,000 characters, instructions to 4,000 and purpose to 2,000. Blocks allow 10,000 characters; each user may save up to 200 templates and 200 blocks. Strict schemas allow up to 100 top-level fields, 64,000 serialized characters and bounded nesting. A rendered result is limited to 200,000 characters. Replace an uploaded file by creating a new template; its extracted content is not edited in place.
Upload one source file per request. Excel source workbooks may be up to 20 MiB. The complete upload, including its settings, may be up to 21 MiB.
If preview fails, check the reported field and constraint, spelling of placeholders, required fields, types and selected block ownership. If generation fails, inspect the Agent logs or chat error, adjust field descriptions and sensible limits, check model/context capacity and rerun. Do not weaken a requirement merely to let unsupported facts pass. Use a separate document-generation step when a downloadable document is needed, and review the resulting file independently.
Create a strict template with AI
Choose Create strict template with AI, describe the required report and paste an example. Name a saved fixed block when exact wording or a signature is required. The assistant proposes a schema, layout and instructions and renders sample values through the normal strict-template validator. Check fixed wording, placeholders, source links and the sample preview before Apply to form and Save. Preview is illustrative and does not certify factual accuracy. Source-file templates keep their imported layout; create a separate text template to redesign it. Templates and fixed blocks remain private. Model, schema or missing-block errors leave the form unchanged; correct the problem and prepare another proposal.
If the assistant asks a question, type in Your answer, directly below the question, and select Send answer. For a refinement, use What would you like to change? → Send reply. Earlier answers stay in Conversation so far. Start over clears the conversation and retains form edits. After Apply to form, the assistant closes so you can review the ordinary fields and use Save or Test. Undo applied changes is available beside the assistant button; it preserves unrelated manual edits. A failed or cancelled reply keeps the question and your typed answer for retry.
Deleting an uploaded template also deletes its stored source file. If storage cleanup fails, the template remains available for retry. Ask the operator to restore storage availability, refresh the list and retry deletion. Creating or changing a template or fixed block requires an available account; a removed account cannot save new personal resources.