Minimum Required Fields
The absolute minimum to run a workflow:input vs topic: Use input (canonical) for clarity. topic still works for backward compatibility but input better conveys that this is the data going INTO your workflow.Workflow Input Resolution
The value that fills{{input}} is resolved with this precedence, highest first.
Before PraisonAI PR #2890 the CLI unconditionally called
workflow.start(""), which silently dropped the YAML input: field and left every {{input}} step empty. The CLI now honors the YAML default and shows a preview of the resolved input on start-up.CLI input examples
Programmatic input examples
Field Names Reference (A-I-G-S)
PraisonAI accepts both old (agents.yaml) and new (workflow.yaml) field names. Use the canonical names for new projects:
A-I-G-S Mnemonic - Easy to remember:
- Agents - Who does the work
- Instructions - How they behave
- Goal - What they achieve
- Steps - What they do
The parser accepts both old and new names. Run
praisonai workflow validate <file.yaml> to see suggestions for canonical names.Feature Parity
Bothagents.yaml and workflow.yaml now support the same features:
Quick Start
1
Run and validate a workflow
Programmatic Routing: The
AgentsGenerator wrapper auto-detects workflow YAML and routes to the appropriate engine:This means calling
AgentsGenerator(agent_file="release.yaml").generate_crew_and_kickoff() with a job/hybrid YAML now routes correctly to the workflow runner instead of falling through to the framework adapter.Async parity (extended in PR #2738):
agenerate_crew_and_kickoff() now initializes observability and adapter setup the same way generate_crew_and_kickoff() does — Langfuse / AgentOps traces are wired on both paths. Both paths also share a single _build_yaml_workflow builder, so config validation, merge, and dump logic live in exactly one place — sync and async behavior is guaranteed identical.Complete workflow.yaml Reference
Agent Fields Reference
Step Fields Reference
Models Fields Reference
Context Management (Token Overflow Prevention)
Enable automatic context optimization to prevent “context length exceeded” errors:What Context Management Does
Whencontext: true is enabled:
- Auto-compaction: Automatically compresses history when approaching token limits
- Tool Output Truncation: Limits large tool results (e.g., full web page content)
- Smart Strategy: Prioritizes recent/important messages, prunes tool outputs first
- Overflow Prevention: Prevents “context_length_exceeded” errors
Best Practices
Context Strategies
For more details, see Context Management.
Workflow Patterns
Sequential (Default)
Agents execute one after another, passing context.Parallel
Multiple agents work concurrently.Routing
Classifier routes to specialized agents.Loop
Iterate over a list of items.Multi-Step Loop
Execute multiple steps sequentially for each item in the loop. This is perfect for pipelines where each item needs to go through several processing stages (e.g., research → write → publish).Multi-Step Loop Features
Within vs Between Iterations:
- Within iteration: Steps run sequentially (step1 → step2 → step3)
- Between iterations: Can run in parallel with
parallel: true
Structured Output
Get structured JSON responses from agents usingoutput_json (inline schema) or output_pydantic (reference to Pydantic model in tools.py).
- Inline JSON Schema (Option A)
- Pydantic Reference (Option B)
How it works: When
output_json or output_pydantic is specified, PraisonAI automatically uses the LLM’s native structured output feature (response_format) for supported models.Supported Models: GPT-4o, GPT-4o-mini, Claude 3.5 Sonnet, Gemini 2.0 FlashFlow:- Agent checks if model supports native structured output
- If supported → uses
response_formatwith JSON schema (clean output) - If not supported → falls back to prompt injection (schema in prompt)
Repeat (Evaluator-Optimizer)
Repeat until a condition is met.Include (Modular Recipes)
Include reusable recipe files in your workflow.Variable Passing: When you include a recipe, the parent’s
topic, variables, and other fields are automatically passed to the child recipe. The child can use {{topic}} in its actions.Variables
Define reusable variables for use throughout your workflow.Extended agents.yaml
Use workflow patterns in agents.yaml withprocess: workflow:
Auto-Generate Workflows
Generate workflows automatically from a topic description:CLI Commands
CLI Options
Progress Indicators
When running workflows, you’ll see clear progress indicators:input:, no --var input, no argument), the CLI prints a warning instead of the preview line:
Debug Mode
Enable debug logging to see detailed execution:- Agent parameters (prompt, temperature, tools)
- Messages sent to LLM
- HTTP requests to API
- Full agent/role/goal context
Best Practices
Validate YAML before deploy
Validate YAML before deploy
Run workflows locally with
LOGLEVEL=debug to catch missing agents or tools early.Use variable substitution for secrets
Use variable substitution for secrets
Reference env vars in YAML instead of hard-coding API keys in workflow files.
Keep workflows focused
Keep workflows focused
Split large YAML files into modular recipes rather than one monolithic definition.
Version control workflow files
Version control workflow files
Treat YAML workflows like code — review changes and test in CI before production.
Related
Workflow Patterns
Sequential, parallel, routing, and loop patterns
Variable Substitution
Template variables in workflow actions

