In Description Files
Using systemPromptTemplate in YAML and JSON agent description files — automatic conversion to PromptTemplate.
Agent description files and strategy files support templates via the systemPromptTemplate field:
name: reviewer
model: openai/gpt-4o
systemPromptTemplate:
template: "You are {{ role }}, reviewing {{ language }} code."
variables:
role: senior engineer
language: TypeScriptWhen both systemPromptTemplate and systemPrompt are present, the template takes precedence. The loader converts systemPromptTemplate to a PromptTemplate automatically, so the agent receives the same object as if you had passed createPromptTemplate(...) as systemPrompt.
Using templates with loadAgent
Any agent loaded via loadAgent or loadAgentFromString supports systemPromptTemplate:
# agents/reviewer.yaml
name: reviewer
model: openai/gpt-4o
systemPromptTemplate:
template: "You are {{ role }}. Focus on {{ focus }}."
variables:
role: a reviewer
focus: correctness
tools:
- read_file
- edit_fileimport { loadAgent } from "@comma-agents/core";
const agent = await loadAgent("./agents/reviewer.yaml");
// Variables are baked in — the template renders automatically at call time.
const result = await agent.call("Review this code.");
// Override at runtime without modifying the YAML.
agent.updatePromptVariables({ focus: "performance" });Strategy files
Strategy files support the same systemPromptTemplate field on LLMAgentDef:
strategy: "1.0"
agents:
- name: coder
model: openai/gpt-4o
systemPromptTemplate:
template: "You are a {{ role }} writing {{ language }}."
variables:
role: software engineer
language: TypeScriptThe strategy loader builds the agent with the same template logic — systemPromptTemplate takes precedence over systemPrompt.
Related
- Prompts & Templates — overview and
createPromptTemplate. - Template Overrides — updating variables at runtime.
- Template Syntax — LiquidJS syntax and custom filters.
- loadAgent — loading agents from description files.