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 coordination and final-response events.

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. Streams expose coordination events and the final member response, but not intermediate model text.