class LittleGhost::Swarm

Lets configured Agent members hand one request directly to one another.

A swarm is an Assembly for model-selected routing. One member is active at a time. It either produces the final answer or uses a model-visible handoff tool to choose one of the next members allowed by the application.

class ProblemSolverSwarm < LittleGhost::Swarm
  member TriageAgent
  member BillingAgent
  member AccountAgent

  start TriageAgent
  handoff TriageAgent, to: [BillingAgent, AccountAgent]
  max_steps 12
end

run = ProblemSolverSwarm.ask("Why was I charged twice?")
run.response

Call a named Swarm with ask for its final Run, or the streaming entrypoint for live source-tagged Agent progress, coordination events, and the final result.

Swarm members are Agent definitions rather than arbitrary assemblies so a handoff remains a direct model-to-model transition. Original conversation history and application context stay isolated unless a member opts in with history: true or context: true. Every member publishes live progress to the Run, including members that hand off. The final result selects the answering member without replaying its text. Applications filter sources for the destination before forwarding progress; see Run.