Skip to main content
A handler task runs your Python function instead of an LLM.
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 a WorkflowContext with .input, .current_step, and .variables.

Async handlers

An async 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.
Skip the LLM when the answer already lives in variables.

Best Practices

A handler should compute from its inputs and return a value — avoid hidden global state so runs stay repeatable.
Return a plain string or a dict. A dict merges into the shared variables so later tasks can read each key.
Set output_variable on the handler task to name its result, then read it downstream with {{name}} or ctx.variables["name"].
Reach for a handler when a step is a deterministic API or database call that does not need an LLM.

Tasks

The full Task parameter reference

Conditions

Skip tasks with should_run gates

Output Variables

Pass values between tasks

Workflows

Chain agents into pipelines