Skip to main content
A manager agent decides which task runs next and which agent takes it, one delegation turn at a time.

Quick Start

1

Delegate two tasks to two agents

The manager on manager_llm picks the next task and agent each turn.
2

See each delegation turn

Add verbose=True to watch the manager emit {task_id, agent_name, action} on every turn.

Which hierarchical?

Two flows share the hierarchical keyword — pick the one that matches your setup.

How It Works

The manager loops: it picks a task and agent, the worker runs it, and the loop repeats until the manager returns action="stop". Each turn the manager reads the goal and remaining tasks, returns a single {task_id, agent_name, action} object, and the framework runs the named agent on that task. When no work remains, the manager returns action="stop" and the team aggregates the results.

The Manager’s Schema

The manager returns a fixed three-field object every delegation turn.

OpenAI Strict-Mode Compatibility

Hierarchical process uses OpenAI’s strict structured-output API natively — no JSON fallback, no per-turn retry. Under the hood, every manager delegation turn asks the LLM for a fixed 3-field object: The model (ManagerInstructions in praisonaiagents/process/manager_schema.py) sets extra="forbid", so its generated JSON schema includes additionalProperties: false — the exact shape OpenAI’s strict structured-output validator requires.
Before PraisonAI 2026-08-04, hierarchical runs on OpenAI models silently fell back to JSON-mode on every delegation turn, making runs 5–13× slower. If you added a local workaround (patching response_format, or forcing manager_llm="anthropic/..." to sidestep the issue), you can remove it — process="hierarchical" is now strict-native by default on any OpenAI model.

Manager LLM Choice

manager_llm is optional and defaults to the team’s LLM. A cheaper model is a good default for the manager, because it only picks the next task and agent — it does not do the work.

Common Patterns

Three realistic setups where a manager delegates by name.

Best Practices

The manager only picks the next (task_id, agent_name, action) — it does not do the actual work. gpt-4o-mini (or an equivalently cheap model on another provider) is a good default.
The manager delegates by agent_name and picks tasks by task_id. A clear task description helps the manager reason about ordering.
The framework already asks for the strict ManagerInstructions schema and OpenAI accepts it natively. Overriding response_format re-introduces the JSON fallback.
When debugging why the manager stops early, run with verbose=True and read the {task_id, agent_name, action} payloads emitted on each turn.

Hierarchical Workflows

The AgentFlow variant, where a manager validates each step.

Agents

The underlying Agent class.

Tasks

The Task class the manager delegates.

Process

The process-mode concept page.