Skip to content

pyagent-patterns — Orchestration (Tier 1)

pyagent_patterns.orchestration.supervisor.Supervisor

Bases: Pattern

Classify → route → collect orchestration pattern.

Parameters:

Name Type Description Default
classifier Agent

Agent that classifies the task into a route key.

required
routes dict[str, Agent]

Mapping of route keys to specialist agents.

required
formatter Agent | None

Optional agent that formats the final response.

None
default_route str | None

Key to use when classification doesn't match any route.

None

pyagent_patterns.orchestration.pipeline.Pipeline

Bases: Pattern

Sequential stage chain — output of stage N becomes input of stage N+1.

Parameters:

Name Type Description Default
stages list[Agent]

Ordered list of agents, each processing the previous output.

required

stream(task, context=None) async

Stream stage completions as they finish.

pyagent_patterns.orchestration.fan_out_fan_in.FanOutFanIn

Bases: Pattern

Parallel execution with result aggregation.

Parameters:

Name Type Description Default
agents list[Agent]

List of agents to run in parallel on the same task.

required
aggregator Agent

Agent that combines all parallel outputs into one.

required

stream(task, context=None) async

Stream individual agent results as they complete.

pyagent_patterns.orchestration.hierarchical.Hierarchical

Bases: Pattern

Manager → Team Leads → Workers hierarchical coordination.

Parameters:

Name Type Description Default
manager Agent

Top-level manager that decomposes work and synthesizes results.

required
teams list[Team]

List of teams, each with a lead and workers.

required

pyagent_patterns.orchestration.orchestrator_workers.OrchestratorWorkers

Bases: Pattern

Dynamic task delegation: orchestrator plans → workers execute → synthesize.

Parameters:

Name Type Description Default
orchestrator Agent

Agent that plans the work and synthesizes results.

required
workers list[Agent]

Pool of available worker agents. The orchestrator selects from these.

required