Available under both
PraisonAIAgents / AgentTeam and the standalone Workflow engine as of PraisonAI PR #4907. Earlier releases only honoured handler inside the standalone Workflow engine.Quick Start
1
Handler only
A task with a
handler runs your function directly — no agent required.2
Handler in a team with agents
An agent researches, a handler post-processes, and another agent writes the report.
How It Works
The team runs each task in order, calling your function for handler tasks and the model for agent tasks.The context argument
The handler receives aWorkflowContext with .input, .current_step, and .variables.
Async handlers
Anasync def handler works too — the SDK awaits it under both start() and astart().
Common Patterns
A deterministic data step between two LLM steps keeps parsing predictable.Best Practices
Keep handlers pure
Keep handlers pure
A handler should compute from its inputs and return a value — avoid hidden global state so runs stay repeatable.
Return strings or dicts
Return strings or dicts
Return a plain string or a dict. A dict merges into the shared variables so later tasks can read each key.
Use output_variable to hand data to the next step
Use output_variable to hand data to the next step
Set
output_variable on the handler task to name its result, then read it downstream with {{name}} or ctx.variables["name"].Prefer handlers for API and DB calls
Prefer handlers for API and DB calls
Reach for a handler when a step is a deterministic API or database call that does not need an LLM.
Related
Tasks
The full Task parameter reference
Conditions
Skip tasks with should_run gates
Output Variables
Pass values between tasks
Workflows
Chain agents into pipelines

