Templates in the Hello World Agent are used to structure the agent's responses, prompts, and interactions. This guide explains how to customize these templates to modify the agent's behavior and output format.
Templates are primarily stored in agent/config/prompts.yaml
. These templates use YAML syntax and support variable interpolation.
System prompts define the agent's core behavior and personality. They are found in the prompts.yaml
file:
system_prompt: |
You are an AI assistant focused on {task_type}.
Your primary goal is to {goal_description}.
Approach:
1. Analyze the given prompt
2. Break down complex tasks
3. Execute step-by-step
Task templates define how different types of tasks are processed:
research_task: |
Research Task:
Topic: {topic}
Depth: {depth}
Focus Areas:
- {focus_points}
execute_task: |
Execution Task:
Objective: {objective}
Steps:
1. {step1}
2. {step2}
Output templates control how results are presented:
analysis_output: |
Analysis Results:
==================
Key Findings:
{findings}
Recommendations:
{recommendations}
You can add new variables to templates using curly braces:
custom_template: |
Processing {custom_var1} with {custom_var2}
Change the structure and formatting:
# Original
result: "Result: {output}"
# Modified
result: |
╔════ RESULT ════╗
{output}
╚════════════════╝
- Open
agent/config/prompts.yaml
- Add your new template:
my_template: |
Custom output for {scenario}
Details:
- {point1}
- {point2}
Common variables you can use:
{task_type}
: Type of task (research/execute/analyze){prompt}
: User's input prompt{timestamp}
: Current time{result}
: Task results{status}
: Task status
Use YAML anchors and aliases for conditional content:
templates:
base: &base |
Base content here
detailed: &detailed |
Detailed analysis:
{details}
combined: |
<<: *base
<<: *detailed
YAML supports various multi-line string formats:
# Literal Block (preserves newlines)
template: |
Line 1
Line 2
# Folded Block (folds newlines)
template: >
This is a long line
that will be folded
into a single line
Templates can inherit from others:
base_template: &base
header: "Standard Header"
footer: "Standard Footer"
custom_template:
<<: *base
body: "Custom Content"
- Consistency: Maintain consistent formatting across templates
- Documentation: Comment your templates for clarity
- Modularity: Break down complex templates into reusable components
- Testing: Test templates with various inputs
- Version Control: Track template changes in version control
# System Configuration
system:
name: "Hello World Agent"
version: "1.0"
# Task Templates
tasks:
research:
prompt: |
Research Task: {topic}
Depth: {depth}
Outputs:
- Key findings
- Supporting evidence
- Recommendations
execute:
prompt: |
Execution Task: {objective}
Parameters:
- Target: {target}
- Method: {method}
- Success Criteria: {criteria}
# Output Formats
output:
success: |
✅ Task Completed
==================
Results:
{results}
Next Steps:
{next_steps}
error: |
❌ Task Error
==================
Error: {error_message}
Resolution: {resolution_steps}
-
Variable Not Found
- Check variable names match exactly
- Verify variables are passed correctly
-
Formatting Issues
- Validate YAML syntax
- Check indentation
- Ensure proper use of | or > for multi-line strings
-
Template Not Loading
- Verify file path
- Check YAML structure
- Validate template name
Test your templates using the agent's debug mode:
./start.sh --prompt "test prompt" --task research --debug
Templates provide a powerful way to customize the Hello World Agent's behavior and output. By understanding and modifying these templates, you can create a unique and effective agent experience tailored to your needs.