Create Custom Recipes
Step-by-step guide to creating your own PraisonAI recipes
Define roles and tasks in agents.yaml, then run the recipe from the CLI.
from praisonaiagents import Agent
agent = Agent(
name="Recipe Author",
instructions="Design multi-step recipe roles and validate outputs.",
)
agent.start("Outline a two-agent research recipe.")The user authors agents.yaml, runs praisonai recipe run, and receives output from each role.
How It Works
How to Create a Custom Recipe from Scratch
- Create Recipe Directory
Create a new directory for your recipe with the required structure:
bash mkdir -p my-recipe cd my-recipe - Create agents.yaml
Create the main recipe configuration file:
yaml # 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" - Test Your Recipe Locally
Run your recipe to verify it works:
bash praisonai recipe run ./my-recipe --var task="AI trends 2024"
How to Create a Recipe with CLI
- Initialize Recipe
bash praisonai recipe init my-new-recipe - Edit Generated Files
bash cd my-new-recipe # Edit agents.yaml as needed - Validate Recipe
bash praisonai recipe validate ./my-new-recipe - Run Recipe
bash praisonai recipe run my-new-recipe --var task="Your task here"
Recipe File Structure
my-recipe/
├── agents.yaml # Agent definitions and tasks
├── tools.py # Optional: custom tools
└── README.md # Optional: documentationagents.yaml Schema
| Field | Type | Required | Description |
|---|---|---|---|
framework | string | Yes | Should be praisonai |
topic | string | Yes | Main topic/task |
roles | object | Yes | Agent definitions |
roles.*.role | string | Yes | Agent role name |
roles.*.goal | string | Yes | Agent goal |
roles.*.tools | array | No | Tools for agent |
roles.*.tasks | object | Yes | Agent tasks |
Best Practices
Start from praisonai recipe init
The scaffold gives you a valid agents.yaml to edit, so you avoid schema mistakes on the first pass.
Give each role a clear goal and expected_output
Specific goals and expected_output fields keep multi-role recipes on track and make outputs predictable.
Validate before running
Run praisonai recipe validate ./my-recipe after each change so schema errors surface before execution.