Skip to main content
Templates let you control exactly what an agent says, how it says it, and how it formats its response — all in a few lines.
The user sends a message; system, prompt, and response templates shape what the agent sees and how it replies.

Quick Start

1

Custom System Prompt

Override the default system message so the agent stays in character.
2

With TemplateConfig

Use TemplateConfig for full control over system, prompt, and response templates.
3

YAML Template Variables

Define reusable workflows with {placeholder} variables in YAML.

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_prompt

TemplateConfig Fields


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

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.
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.
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.
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.

YAML Template Variables

Safely use {placeholder} in YAML alongside JSON literals

Industry Templates

Pre-built agent workforces for Manufacturing, Energy, Healthcare, and more