Skip to main content
Prompt templating lets you inject runtime context into assistant instructions so responses are personalized, deterministic, and easier to control.
Treat prompt templates like code: define a stable variable contract, review changes, and version updates before release.

Why This Matters


Variable Access Styles

You can access runtime arguments in two equivalent ways:
Use args.* for most custom business fields. It makes prompts easier to maintain as your variable set grows.
If your team has multiple developers editing prompts, enforce a naming convention like args.customer_*, args.order_*, args.billing_*.

General Jinja-Style Guidelines

Rapida prompt rendering uses Pongo2 (Jinja-style syntax).
Use this safe subset for predictable behavior:
Supported patterns above are validated by parser tests in pkg/parsers/pongo2_template_parser_test.go.
Keep template logic lightweight. Put business decision logic in instructions and runtime data, not deeply nested template control flow.

Built-in Variables (What + Why)

system.*

assistant.*

conversation.*

message.*


Practical Production Example


Runtime Argument Example (from your app/backend)

This enables both:
  • {{ args.customer_name }}
  • {{ customer_name }}
Use one canonical style in production prompts (recommended: args.*) even though both styles resolve.

UX Guidelines for Better Prompts


Common Mistakes

Do not assume every runtime variable is always present. Add explicit fallback behavior in the prompt for missing or empty values.
For voice assistants, add a hard instruction such as: “Keep responses under 2 short sentences unless the user asks for details.”