Modular Recipes
Build complex workflows by composing smaller, reusable recipes with the include: pattern
Build complex workflows by composing smaller, reusable recipes with the include: pattern.
from praisonaiagents import Agent
agent = Agent(name="publisher", instructions="Run modular recipe steps.")
agent.start("Publish this article using the wordpress-publisher include.")The user defines a main recipe with include: steps; PraisonAI runs each included recipe in order.
How It Works
Quick Start
- Simple Usage
yaml steps: - agent: content_writer action: "Write article about {{topic}}" - include: wordpress-publisher input: "{{previous_output}}" - With Configuration
python from praisonaiagents import AgentFlow, include workflow = AgentFlow( name="Content Pipeline", steps=[ content_writer_agent, include("wordpress-publisher", input="{{previous_output}}") ] ) result = workflow.run("Write about AI")
Overview
Instead of duplicating common functionality across recipes, extract it into a standalone recipe and include it where needed:
roles:
content_writer:
role: Content Writer
goal: Write articles
includes:
- wordpress-publisherUsage Patterns
Include in Steps Format
name: Content Pipeline
steps:
- agent: content_writer
action: "Write article about {{topic}}"
- include: wordpress-publisher
input: "{{previous_output}}"Include in Roles Format
framework: praisonai
topic: "AI News"
roles:
topic_gatherer:
role: Topic Researcher
goal: Find news topics
tasks:
find_topics:
description: Search for AI news
content_writer:
role: Content Writer
goal: Write articles
tasks:
write:
description: Write about {{previous_output}}
includes:
- wordpress-publisherInclude with Configuration
includes:
- recipe: wordpress-publisher
input: "{{previous_output}}"Python API
from praisonaiagents import AgentFlow, Include, include
workflow = AgentFlow(
name="Content Pipeline",
steps=[
content_writer_agent,
include("wordpress-publisher", input="{{previous_output}}")
]
)
result = workflow.run("Write about AI")from praisonaiagents import Include
step = Include(recipe="wordpress-publisher", input="Custom input here")call_recipe Tool
Give agents the ability to call other recipes as a tool:
from agent_recipes import call_recipe
from praisonaiagents import Agent
orchestrator = Agent(
name="Orchestrator",
instructions="Coordinate content publishing workflows",
tools=[call_recipe]
)run_recipe Function
from agent_recipes import run_recipe
result = run_recipe(
recipe_name="wordpress-publisher",
input_data="ARTICLE_TITLE: My Title\nARTICLE_CONTENT: ...",
output="status"
)
print(result['output'])Creating Reusable Recipes
wordpress-publisher/
├── TEMPLATE.yaml
├── agents.yaml
├── tools.py
└── README.mdagents.yaml:
framework: praisonai
topic: "Publish article to WordPress"
roles:
publisher:
role: WordPress Publisher
goal: Validate and publish blog post
tools:
- create_wp_post
tasks:
validate_and_publish:
description: |
{{previous_output}}
Extract ARTICLE_TITLE and ARTICLE_CONTENT and call create_wp_post.
expected_output: Published post with ID and confirmationCycle Detection
The include system automatically detects circular includes:
# recipe-a includes recipe-b
# recipe-b includes recipe-a
# → Error: "Circular include detected"Best Practices
Single responsibility per recipe
Each recipe should do one thing well — publish, transform, or validate — not all three.
Document input/output contracts
State the expected {{previous_output}} format so included recipes parse input reliably.
Handle malformed input defensively
Included recipes should fail gracefully when required fields are missing.
Keep operations idempotent
Publishing or side-effect steps should be safe to retry without duplicating output.
Available Recipes
praisonai templates listKey reusable recipes:
wordpress-publisher— Publish content to WordPresstranscript-generator— Generate transcripts from mediadata-transformer— Transform data between formats