criogenai

Multi-agent

Swarm

Agents hand off to each other; no one is in charge.

In a swarm there is no supervisor. Each agent does its part and either hands the conversation to a peer it knows about or answers. Control moves around the team the way a call moves between departments.

Hand-offs are capped and checked: a hand-off to a name that does not exist ends the run instead of looping.

Use it when
Conversations that move between departments
Agents that each own a slice of tools and data
No single agent should see everything
Skip it when
You need one place that decides (Supervisor)
Strict audit of who decided what (a central coordinator is easier to trace)

Run it

Scripted model · no key needed · CriogenAI engine in your browser
Ready
handoffhandofffinalCustomerTriageOrderslookup_order()RefundsAnswer
The runmodel 0 · tools 0
  1. Press Run to watch the pattern work, step by step.
Try it with your own key optional: a real model makes the decisions; the tools stay simulated
  • Your key stays in this tab's memory: not saved, not in cookies or the address bar. Reload or close the tab and it is gone.
  • Your browser calls OpenAI directly. Nothing passes through criogenai.com, and nothing is logged.
  • Each run makes at most 16 short model calls, billed to your account. Tools, data and side effects are simulated.

This run is the TypeScript code below, running on the CriogenAI engine in your browser (WebAssembly). Without a key, a scripted model stands in for MODEL; with your key, your provider answers, called from this tab. The tools return made-up data.

Build it with CriogenAI

Ready-made: patterns.swarm
@tool(read_only=True)
def lookup_order(customer: str) -> dict:
    """The customer's latest order and its return status."""
    return {"order": "A-1001", "return": "received 24 Oct", "refund": None}

team = patterns.swarm(
    {
        "triage": Agent(MODEL, instructions="Work out what the customer needs."),
        "orders": Agent(MODEL, instructions="Look up orders and returns.", tools=[lookup_order]),
        "refunds": Agent(MODEL, instructions="Issue refunds for returned items."),
    },
    start="triage",
    max_handoffs=6,
)
# Each agent ends with "HANDOFF: <name>" or "FINAL"; no one is in charge.
result = await team.run("I returned my headphones two weeks ago and have no refund.")
print(result.output, result.stop_reason)
const lookupOrder = tool({
  name: "lookup_order",
  description: "The customer's latest order and its return status.",
  input: z.object({ customer: z.string() }),
  readOnly: true,
  run: () => ({ order: "A-1001", return: "received 24 Oct", refund: null }),
});

const team = patterns.swarm(
  {
    triage: new Agent({ model: MODEL, instructions: "Work out what the customer needs." }),
    orders: new Agent({ model: MODEL, instructions: "Look up orders and returns.", tools: [lookupOrder] }),
    refunds: new Agent({ model: MODEL, instructions: "Issue refunds for returned items." }),
  },
  { start: "triage", maxHandoffs: 6 },
);
// Each agent ends with "HANDOFF: <name>" or "FINAL"; no one is in charge.
const result = await team.run(task);
console.log(result.output, result.stopReason);