Skip to Content
DocsArchitecturesOverview

Architectures

The agent loop is a strategy. The default is ReAct. Observe / think / act. And works for most things. When it doesn’t fit, swap it with one kwarg; everything else (model, memory, tools, budget, telemetry, runtime) stays exactly the same.

from loomflow import Agent agent = Agent("...", model="claude-opus-4-7") # ReAct (default) agent = Agent("...", model="...", architecture="self-refine") # iterate until critic happy agent = Agent("...", model="...", architecture="reflexion") # verbal RL with lessons agent = Agent("...", model="...", architecture="plan-and-execute") # plan once, execute steps agent = Agent("...", model="...", architecture="rewoo") # plan + parallel tools, 30-50% cheaper agent = Agent("...", model="...", architecture="tree-of-thoughts") # BFS beam over candidate thoughts

For multi-agent shapes (Supervisor, Swarm, Router, Debate, ActorCritic, Blackboard) use the Team facade or pass the architecture instance directly:

from loomflow import Agent from loomflow.architecture import Supervisor agent = Agent( "manage the pipeline", model="claude-opus-4-7", architecture=Supervisor(workers={ "researcher": researcher, "writer": writer, }), )

Single-agent loops

Multi-agent teams

Higher-order

When to use what

You need…UseCost relative to ReAct
The default that just worksReAct
Cheaper multi-step that knows the plan upfrontPlan-and-Execute0.5–0.7×
Cheaper tool-heavy with parallelizable stepsReWOO0.4–0.6×
Iterative quality improvement, single modelSelf-Refine1.5–3×
Cross-attempt learning (“don’t repeat that mistake”)Reflexion1.5–3×
Best-of-N with a different-model criticActorCritic2–4×
Combinatorial / puzzle / planningTree of Thoughts5–10×
Cheapest classify-and-dispatchRouter1.2×
Hierarchical worker delegationSupervisor2–4×
High-stakes contested questionsMulti-Agent Debate3–5×
Exploratory / research-mode handoffsSwarm2–4×
Shared-workspace collaborationBlackboard3–5×

The architecture protocol. Every architecture implements three methods: name, run, declared_workers. The Agent calls architecture.run(session, dependencies) and consumes the events it yields. Setup and teardown stay in Agent; architectures focus on their own iteration. See Custom architectures.

Standalone testing

run_architecture(arch, prompt, model=...) builds a minimal Agent shell around any Architecture and runs it. Useful for testing orchestrators in isolation:

from loomflow.architecture import Supervisor from loomflow.team import run_architecture sup = Supervisor(workers={"a": agent_a}) result = await run_architecture(sup, "do the thing", model="claude-opus-4-7")
Last updated on