Prompt Templates
Create and customize AI prompt templates that define how content is generated at each workflow stage.
On This Page
Overview
Prompt templates are stored in the ai.template model and define
the instructions sent to the AI for content generation. Templates support
variable substitution to include dynamic content.
Template Structure
Each template has these key components:
| Field | Type | Description |
|---|---|---|
name |
Char | Template identifier |
system_prompt |
Text | System message defining AI behavior |
user_prompt |
Text | User message with task instructions |
output_format |
Selection | "text", "json", "html", "markdown" |
temperature |
Float | Creativity level (0.0 - 1.0) |
max_tokens |
Integer | Maximum response length |
Variable Substitution
Use {{variable_name}} syntax to include dynamic values:
Template
You are creating content for {{company_name}}, a {{industry}} company.
Target audience: {{target_audience}}
Generate a {{page_type}} page that:
1. Highlights the company's value proposition
2. Appeals to the target demographic
3. Uses a {{tone}} tone
Additional context:
{{description}}
Available Variables
Common variables available in workflow contexts:
project.name- Project nameproject.ai_params.*- All parameters from ai_params dicttask.name- Current task nametask.description- Task descriptionstage.name- Current stage nameprevious_output- Output from previous stage
Template Examples
Website Page Generation
Python
template = env['ai.template'].create({
'name': 'website_page_generator',
'system_prompt': '''You are an expert web content writer specializing in
{{industry}} websites. Create compelling, SEO-optimized content that
engages {{target_audience}}.''',
'user_prompt': '''Create HTML content for the {{page_type}} page of
{{company_name}}'s website.
Requirements:
- Include a compelling headline
- Write 3-5 sections with headers
- Add calls-to-action where appropriate
- Use semantic HTML structure
- Target keywords: {{keywords}}
Company Description:
{{description}}
Output only the HTML content without doctype or head sections.''',
'output_format': 'html',
'temperature': 0.7,
'max_tokens': 4000,
})
Ebook Chapter Generation
Python
template = env['ai.template'].create({
'name': 'ebook_chapter_generator',
'system_prompt': '''You are writing a book about {{topic}} for
{{target_audience}}. Maintain a {{writing_style}} tone throughout.
Previous chapters have established: {{previous_context}}''',
'user_prompt': '''Write Chapter {{chapter_number}}: {{chapter_title}}
Chapter summary from outline:
{{chapter_summary}}
Requirements:
- Approximately {{word_count}} words
- Include practical examples
- End with key takeaways
- Maintain narrative flow from previous chapters
Output in Markdown format.''',
'output_format': 'markdown',
'temperature': 0.8,
'max_tokens': 8000,
})