Skip to main content

How to Create a Custom Template from Scratch

1

Create Template Directory

Create a new directory for your template with the required structure:
mkdir -p my-template
cd my-template
2

Create TEMPLATE.yaml

Create the main template configuration file:
# TEMPLATE.yaml
name: my-template
version: "1.0.0"
description: "My custom AI agent template"
author: "Your Name"

variables:
  task:
    description: "The task to perform"
    required: true
  output_format:
    description: "Output format"
    default: "markdown"

requires:
  tools: [internet_search, shell_tool]
  packages: []
3

Create agents.yaml

Define your agents and their tasks:
# agents.yaml
framework: praisonai
topic: "{{task}}"

roles:
  researcher:
    role: Research Specialist
    goal: Research the given topic thoroughly
    backstory: Expert researcher with attention to detail
    tools:
      - internet_search
    tasks:
      research_task:
        description: |
          Research: {{task}}
          Provide comprehensive findings.
        expected_output: "Detailed research report in {{output_format}}"
4

Test Your Template Locally

Run your template to verify it works:
praisonai templates run ./my-template --task "AI trends 2024"

How to Create a Template with CLI

1

Initialize Template

praisonai templates init my-new-template
2

Edit Generated Files

cd my-new-template
# Edit TEMPLATE.yaml, agents.yaml as needed
3

Validate Template

praisonai templates validate ./my-new-template
4

Run Template

praisonai templates run my-new-template --task "Your task here"

Template File Structure

my-template/
├── TEMPLATE.yaml      # Template metadata and variables
├── agents.yaml        # Agent definitions and tasks
├── workflow.yaml      # Optional: workflow definitions
├── tools.py           # Optional: custom tools
└── README.md          # Optional: documentation

TEMPLATE.yaml Schema

FieldTypeRequiredDescription
namestringYesTemplate name
versionstringYesSemantic version
descriptionstringNoTemplate description
authorstringNoAuthor name
variablesobjectNoInput variables
requires.toolsarrayNoRequired tools
requires.packagesarrayNoRequired packages
requires.tools_sourcesarrayNoTool source modules