Expand description
Instruction templating — inject state values into instruction strings.
Replaces {key} placeholders with values from the state container.
Supports optional {key?} syntax that resolves to empty string if missing.
Structs§
- Template
Instruction - A full template-engine instruction (feature
templates) — minijinja (Jinja2 syntax: conditionals, loops, filters) over the session state, mirroring ADK’suse_jinja2instructions. The whole state is exposed asstate(subscript prefixed keys:{{ state["session:turn_count"] }}), and every key that is a bare identifier is also available at top level ({{ name }}). Falls back to the empty string for missing values under Jinja’s default undefined semantics.
Traits§
- Instruction
Provider - A dynamic instruction source — the ADK “instruction provider” pattern:
instead of a string fixed at build time, the instruction is produced
from live session state on every model request (persona switching,
risk-driven guardrails, multi-tenant instructions without rebuilding
the agent). Any
Fn(&State) -> Stringclosure is a provider.
Functions§
- inject_
session_ state - Replace
{key}placeholders intemplatewith values fromstate.