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.
graph LR
M[Main recipe] --> I[include]
I --> P[wordpress-publisher]
P --> O[📤 Output]
classDef agent fill:#8B0000,stroke:#7C90A0,color:#fff
classDef process fill:#189AB4,stroke:#7C90A0,color:#fff
classDef result fill:#10B981,stroke:#7C90A0,color:#fff
class M agent
class I,P process
class O resultHow It Works
sequenceDiagram
participant User
participant Agent
participant Feature as Modular Recipes
User->>Agent: Request
Agent->>Feature: Process request
Feature-->>Agent: Result Agent-->>User: ResponseQuick 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")How include() resolves a name
- If
agent_recipesis installed andget_template_path(name)returns a path, use it. - Otherwise (package missing, lookup raises, or empty result), use the local path
./name. - If neither exists, the step fails with
Recipe not found: name.
graph LR
Inc[📦 include name] --> Pkg{agent_recipes<br/>path found?}
Pkg -->|Yes| Use[✅ Use package path]
Pkg -->|No / error| Local{Local ./name<br/>exists?}
Local -->|Yes| UseLocal[✅ Use local path]
Local -->|No| Fail[⚠️ Recipe not found]
classDef input fill:#8B0000,stroke:#7C90A0,color:#fff
classDef check fill:#F59E0B,stroke:#7C90A0,color:#fff
classDef ok fill:#10B981,stroke:#7C90A0,color:#fff
classDef fail fill:#189AB4,stroke:#7C90A0,color:#fff
class Inc input
class Pkg,Local check
class Use,UseLocal ok
class Fail failBoth arrangements work together: install agent_recipes for shared templates and keep project recipes checked into the repo.
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