Quick Start
With TemplateConfig
Use
TemplateConfig for full control over system, prompt, and response templates.How It Works
Templates are applied in a specific order before the LLM sees your request.Configuration Options
TemplateConfig API Reference
Full API reference for
TemplateConfig — system, prompt, response, use_system_promptTemplateConfig Fields
| Field | Type | Default | Description |
|---|---|---|---|
system | str | None | None | Override the system prompt |
prompt | str | None | None | Template for the user message; use {input} as a placeholder |
response | str | None | None | Format template applied to the LLM response |
use_system_prompt | bool | True | Whether to send a system message at all |
Common Patterns
Structured Output Format
Force the agent to return a consistent format every time.Persona Agent
Lock the agent into a role with a strong system template.YAML Variable Substitution
Run the same workflow against different inputs without editing the YAML.Best Practices
Keep system templates focused
Keep system templates focused
A system template that tries to do everything usually does nothing well. One clear role per template — “You are a customer support agent for Acme Corp” — produces better results than a long list of unrelated instructions.
Use {input} placeholder in prompt templates
Use {input} placeholder in prompt templates
When your prompt template includes
{input}, PraisonAI substitutes the user’s actual request at runtime. This keeps your template generic and reusable across many different queries.Test response templates with diverse outputs
Test response templates with diverse outputs
Response templates are applied as a format instruction to the LLM. Test with edge-case inputs (short answers, long answers, refusals) to make sure the template doesn’t corrupt valid responses.
Prefer YAML templates for team workflows
Prefer YAML templates for team workflows
When multiple people run the same workflow, store templates in a YAML file rather than hardcoding them in Python. YAML files are easier to version, review, and swap without touching code.
Related
YAML Template Variables
Safely use
{placeholder} in YAML alongside JSON literalsIndustry Templates
Pre-built agent workforces for Manufacturing, Energy, Healthcare, and more

