Skip to content

chimera.composition

chimera.composition provides three patterns for combining agents.

For a tutorial walk-through, see Compose Agents.

from chimera import Pipeline, Ensemble, Supervisor
PatternUse whenCost
Pipeline(agents=[...])Clearly ordered stages (plan → implement → review). Output of agent N is task of agent N+1.Sequential.
Ensemble(agents=[...])You want diversity and will pick the best result.N agents in parallel.
Supervisor(coordinator=..., workers={name: agent, ...})Coordinator delegates sub-tasks. Each worker is exposed to the coordinator as a DelegateTool.Whatever the coordinator chooses.

All three return AgentResult (or list[AgentResult] from Ensemble), so they nest: a Pipeline whose first stage is a Supervisor, an Ensemble of Pipelines, etc.

Ensemble.best(results) returns the first successful result by default; subclass or write your own selector for cost / quality tradeoffs.