Swarms Logo

Swarms for Manufacturing

Quality ticket triage, maintenance work orders, supplier risk review, root cause analysis and shift reporting, run as agent teams on the Swarms API.

  • One router, three specialists: quality, maintenance and supply, each on its own model
  • Defect dispositions, work orders and supplier notes drafted for an engineer to approve
  • Every ticket's route, output, token usage and cost logged in Swarms Cloud
Line 2 · ticket deskMultiAgentRouter · gpt-5.4-mini routesPaused
  1. S1

    Stamping

    OEE 81.7%

    A
    P
    Q
  2. S2

    Welding

    OEE 80.2%

    A
    P
    Q
  3. S3

    Paint

    OEE 86.3%

    A
    P
    Q
  4. S4

    Assembly

    OEE 84.3%

    A
    P
    Q
  5. S5

    Test

    OEE 78.6%

    A
    P
    Q
  6. S6

    Pack

    OEE 80.4%

    A
    P
    Q
  • #4475

    Welding: weld spatter on B-pillar, tip dresser skipped

    router reading ticket

  • #4474

    Assembly: M8 flange bolt lot late, 2 days of cover left

    routed to Supply Analyst · gemini-2.5-flash

  • #4473

    Stamping: press P-2 drive bearing 7.1 mm/s, alarm at 7.5

    routed to Maintenance Planner · gpt-5.4

  • #4472

    Paint: orange peel on 14 door panels, booth humidity 71%

    routed to Quality Engineer · claude-sonnet-5-5

Defect rate

496 PPM

target under 500 PPM

Use cases

Where plant teams put agents to work

Each card names the Swarms API swarm type it maps to. The agents list is the roster you would send in the request. Every output is a draft for the engineer, planner or buyer who owns the decision.

MultiAgentRouter

Shop-floor ticket routing

Operators, sensors and ERP alerts all raise tickets in the same queue. A router reads each one and sends it to the quality, maintenance or supply specialist, which returns a drafted disposition, work order or supplier note for the line lead to approve.

  • Ticket Router
  • Quality Engineer
  • Maintenance Planner
  • Supply Analyst
SequentialWorkflow

Defect triage and 8D drafting

A defect reader normalises the inspection record and photos' captions, a root cause analyst works through the fishbone against process data, and a writer fills the 8D template for the quality manager to review and sign.

  • Defect Reader
  • Root Cause Analyst
  • 8D Writer
MixtureOfAgents

Predictive maintenance review

Vibration, thermal and maintenance history agents each read the same asset snapshot, and an aggregator writes one recommendation with a priority and a suggested window. The planner decides what goes on the schedule.

  • Vibration Agent
  • Thermal Agent
  • History Agent
  • Aggregator
ConcurrentWorkflow

Supplier risk analysis

Delivery, quality and financial agents score a supplier from the same data at once: on-time history, PPM and corrective actions, and public filings. The three reads come back together for the sourcing team's quarterly review.

  • Delivery Agent
  • Quality Agent
  • Financial Agent
AgentRearrange

Work instruction revision

When an engineering change lands, a reader extracts what changed, a procedure writer and a safety checker revise the work instruction in parallel, and an approver agent assembles the redlined draft for the process engineer.

  • Change Reader
  • Procedure Writer
  • Safety Checker
  • Approver
HierarchicalSwarm

Production planning what-if

A planning director splits a what-if question (a rush order, a line down for a week) into capacity, materials and labour sub-questions, three workers answer them, and the director integrates a plan for the plant manager.

  • Planning Director
  • Capacity Agent
  • Materials Agent
  • Labour Agent

Architecture

A ticket desk as a multi-agent router

The router reads each ticket and sends it to exactly one specialist. Only that specialist runs, so a supply question never pays for a quality engineer's reasoning, and the log records which route each ticket took. Watch tickets move through the desk.

swarm_typeMultiAgentRouterSimulation paused
ROUTERSPECIALISTS · ROUTEDTaskPOST /v1/swarmTicket Routergpt-5.4-miniQuality Engineerclaude-sonnet-5-5Maintenance Plannergpt-5.4Supply Analystgemini-2.5-flashDraft200 OK · JSON
  • 01run #1041 started

The router reads, then picks

A small fast model (gpt-5.4-mini) reads the ticket text and chooses the specialist whose description matches. It does not answer the ticket itself.

One specialist runs per ticket

The chosen agent gets the full ticket and returns its draft. The other two are not called, which is what keeps a high-volume queue affordable.

The route is in the log

Each run in Swarms Cloud shows which specialist the router chose, so a mis-routed ticket is visible and the agent descriptions can be tightened.

Routing table

Which tickets go where, and why that model

The router chooses from the agent descriptions in the request, so the table below is the request itself written out. Change a description or a model_name and the desk changes with it.

Quality tickets

claude-sonnet-5-5

Defects, nonconformances, holds, out-of-calibration tools, customer returns

Routed to
Quality Engineer
Why this model
Dispositions need careful reasoning over the evidence and a clear chain from symptom to containment to decision.
What comes back
Likely cause, containment, draft disposition marked for quality manager approval

Maintenance tickets

gpt-5.4

Sensor flags, equipment faults, drift, overdue inspections, operator-reported noise

Routed to
Maintenance Planner
Why this model
Work orders combine failure-mode knowledge with parts and scheduling, where a strong general model earns its price.
What comes back
Draft work order with priority P1 to P3, probable failure mode, parts and a shift window

Supply tickets

gemini-2.5-flash

Late lots, shortages, supplier notices, packaging and consumables running low

Routed to
Supply Analyst
Why this model
High volume and mostly arithmetic on cover and lead times, so a fast, cheap model keeps the per-ticket cost low.
What comes back
Days of cover, options (expedite, alternate, reschedule) and a draft supplier note

Maintenance

From sensor flag to shift slot, with the planner deciding

When the maintenance route fires, the agent drafts a work order with a priority, and a planner agent proposes a slot on the shift grid. The human planner confirms, moves or rejects the slot in the CMMS. The telemetry beside the board is what the reliability team sees in Swarms Cloud afterwards.

Maintenance work ordersflag → draft → shift slotPaused

Latest flag

Press P-2

drive bearing 7.1 mm/s RMS, rising

sensor flag received

Maintenance Planner drafted WO-7109

slotted Mon 1st shift

MonTueWedThuFri
1st
P1 Weld gun W-14
P2 Leak tester LT-1
2nd
P3 Paint pump PP-4
P3 Compressor K-2
3rd
P2 Hoist H-3
P3 Conveyor C-11
P1 next shift P2 this week P3 when the line is down6 orders on the board
Swarms Cloudline-2-ticket-desk · MultiAgentRouterSimulation paused

Runs / min

50

▲ last 30s

p50 latency

2.3s

▼ last 30s

Tokens / min

328.2k

▲ last 30s

Spend / hour

$11.41

▲ last 30s

Every run on the Swarms API appears in Swarms Cloud with its logs, token usage, cost and context use.

Open Swarms Cloud

Code

Run the desk from Python, TypeScript or cURL

The Swarms API examples share one request shape. Set SWARMS_API_KEY from your Swarms Cloud account before running. The fourth tab is the nightly job's credit check.

ticket_desk.py
import os
from swarms_client import SwarmsClient

client = SwarmsClient(api_key=os.environ["SWARMS_API_KEY"])

# A MultiAgentRouter: the router reads the ticket and picks one specialist.
# Each specialist runs on the model that suits its work and returns a draft
# for the line lead or engineer to approve.
ticket = (
    "Ticket 4471, Line 2, Station 3 (paint booth), 14:20. Operator reports "
    "orange peel on 14 consecutive door panels, lot DP-2291. Booth humidity "
    "reading 71 percent against a 55 to 65 percent spec. Units moved to the hold rack."
)

response = client.swarms.run(
    name="Line 2 Ticket Desk",
    description="Route shop-floor tickets to the quality, maintenance or supply specialist.",
    swarm_type="MultiAgentRouter",
    task=ticket,
    agents=[
        {
            "agent_name": "Quality Engineer",
            "description": "Defects, nonconformances, holds and dispositions.",
            "system_prompt": (
                "You are a quality engineer on an automotive paint and assembly line. "
                "For a defect ticket, state the likely cause from the evidence given, "
                "the containment (what to hold, what to inspect), and a draft disposition "
                "(use as is, rework, scrap) marked FOR QUALITY MANAGER APPROVAL."
            ),
            "model_name": "claude-sonnet-5-5",  # careful reasoning on dispositions
            "max_loops": 1,
        },
        {
            "agent_name": "Maintenance Planner",
            "description": "Equipment faults, sensor flags and work orders.",
            "system_prompt": (
                "You are a maintenance planner. For an equipment ticket, draft a work "
                "order: asset, symptom, probable failure mode, parts likely needed, "
                "priority P1 to P3 with the reason, and the shift window you suggest."
            ),
            "model_name": "gpt-5.4",
            "max_loops": 1,
        },
        {
            "agent_name": "Supply Analyst",
            "description": "Late lots, shortages and supplier notices.",
            "system_prompt": (
                "You are a supply chain analyst. For a material ticket, state days of "
                "cover from the inventory figures given, the options (expedite, "
                "alternate supplier, reschedule) and draft the note to the supplier."
            ),
            "model_name": "gemini-2.5-flash",  # fast, cheap for volume tickets
            "max_loops": 1,
        },
    ],
    max_loops=1,
)

print(response)
ticket_desk.sh
curl -X POST https://api.swarms.world/v1/swarm/completions \
  -H "x-api-key: $SWARMS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Line 2 Ticket Desk",
    "description": "Route shop-floor tickets to the quality, maintenance or supply specialist.",
    "swarm_type": "MultiAgentRouter",
    "task": "Ticket 4472, Line 2, Station 1 (stamping press P-2), 15:05. Vibration sensor on the main drive bearing reads 7.1 mm/s RMS, up from 4.2 mm/s last week. Alarm threshold is 7.5 mm/s. Press is running. 2,400 panels left on the shift order.",
    "agents": [
      {
        "agent_name": "Quality Engineer",
        "system_prompt": "You are a quality engineer. For a defect ticket, state likely cause, containment and a draft disposition marked FOR QUALITY MANAGER APPROVAL.",
        "model_name": "claude-sonnet-5-5",
        "max_loops": 1
      },
      {
        "agent_name": "Maintenance Planner",
        "system_prompt": "You are a maintenance planner. For an equipment ticket, draft a work order with asset, symptom, probable failure mode, parts, priority P1 to P3 with reason, and a suggested shift window.",
        "model_name": "gpt-5.4",
        "max_loops": 1
      },
      {
        "agent_name": "Supply Analyst",
        "system_prompt": "You are a supply chain analyst. For a material ticket, state days of cover, the options, and draft the supplier note.",
        "model_name": "gemini-2.5-flash",
        "max_loops": 1
      }
    ],
    "max_loops": 1
  }'

# The router sends this ticket to the Maintenance Planner. The response has
# "output" (the drafted work order) and "usage" (input_tokens, output_tokens,
# total_tokens), and the run appears in Swarms Cloud with the route it took.
reviewSupplier.ts
// Supplier risk review as a ConcurrentWorkflow: three agents score the same
// supplier from different evidence at the same time, and the sourcing team
// gets all three reads in one response.
const SWARMS_API = "https://api.swarms.world/v1/swarm/completions"

type Supplier = {
  name: string
  part: string
  onTimePct12m: number
  ppm12m: number
  openScars: number
  notes: string
}

const scorer = (name: string, model: string, lens: string) => ({
  agent_name: name,
  system_prompt:
    "You assess suppliers for a tier-one automotive plant. Your lens: " + lens + " " +
    "Give a risk rating LOW, MEDIUM or HIGH on the first line, then the evidence you used " +
    "and the one question the sourcing team should ask this supplier.",
  model_name: model,
  max_loops: 1,
})

export async function reviewSupplier(s: Supplier) {
  const res = await fetch(SWARMS_API, {
    method: "POST",
    headers: {
      "x-api-key": process.env.SWARMS_API_KEY!,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      name: "Supplier Risk Review",
      description: "Delivery, quality and financial reads on one supplier, in parallel.",
      swarm_type: "ConcurrentWorkflow",
      task:
        "Supplier: " + s.name + ", part family: " + s.part + ".\n" +
        "On-time delivery, trailing 12 months: " + s.onTimePct12m + " percent.\n" +
        "Defects, trailing 12 months: " + s.ppm12m + " PPM. Open SCARs: " + s.openScars + ".\n" +
        "Notes: " + s.notes,
      agents: [
        scorer("Delivery Agent", "gpt-4.1-mini", "on-time history, lead time changes and expedite frequency."),
        scorer("Quality Agent", "claude-haiku-5-5", "PPM trend, open corrective actions and repeat failure modes."),
        scorer("Financial Agent", "gpt-5.4", "signs of financial stress in the notes and any public information you were given."),
      ],
      max_loops: 1,
    }),
  })

  if (!res.ok) throw new Error("Swarms API " + res.status + ": " + (await res.text()))
  const data = await res.json()
  return { review: data.output as string, usage: data.usage }
}

reviewSupplier({
  name: "Northfield Fasteners",
  part: "M8 and M10 flange bolts",
  onTimePct12m: 91.4,
  ppm12m: 380,
  openScars: 2,
  notes: "Two late lots in the last quarter, both attributed to a plating subcontractor change. Payment terms extended from 30 to 60 days at their request in August.",
}).then((r) => {
  console.log(r.review)
  console.log(r.usage)
})
nightly_review.py
import os
import sys

import requests

BASE = "https://api.swarms.world"
HEADERS = {"x-api-key": os.environ["SWARMS_API_KEY"], "Content-Type": "application/json"}

# The nightly job reviews every asset flagged by the condition monitoring
# system. Before it starts, check the Swarms Cloud credit balance and the
# day's usage so a plant does not find out about an empty account at 03:00.
credits = requests.get(f"{BASE}/v1/account/credits", headers=HEADERS, timeout=30).json()
metrics = requests.get(f"{BASE}/v1/metrics/summary", headers=HEADERS, timeout=30).json()

print("credit balance:", credits)
print("usage summary:", metrics)

MIN_CREDITS = float(os.environ.get("MIN_CREDITS", "25"))


def balance_of(doc) -> float:
    """Find the first numeric credit figure in the response, whatever the nesting."""
    if isinstance(doc, dict):
        for key in ("credits", "credit", "balance", "remaining_credits"):
            if isinstance(doc.get(key), (int, float)):
                return float(doc[key])
        for value in doc.values():
            found = balance_of(value)
            if found is not None:
                return found
    return None


balance = balance_of(credits)
if balance is not None and balance < MIN_CREDITS:
    print(f"balance {balance:.2f} below {MIN_CREDITS:.2f}, skipping the nightly review")
    sys.exit(1)

with open("flagged_assets_tonight.txt", encoding="utf-8") as f:
    flagged = f.read()

review = {
    "name": "Nightly Maintenance Review",
    "description": "Vibration, thermal and history reads on each flagged asset, aggregated.",
    "swarm_type": "MixtureOfAgents",
    "task": "Review each flagged asset below and recommend a priority and window for the planner.\n\n" + flagged,
    "agents": [
        {"agent_name": "Vibration Agent", "system_prompt": "You read vibration trends (RMS, peak, spectrum notes) and name the probable failure mode.", "model_name": "gpt-4.1-mini", "max_loops": 1},
        {"agent_name": "Thermal Agent", "system_prompt": "You read bearing and motor temperatures against ambient and rating and flag abnormal rise.", "model_name": "claude-haiku-5-5", "max_loops": 1},
        {"agent_name": "History Agent", "system_prompt": "You read the maintenance history and note repeat failures and overdue PMs.", "model_name": "gemini-2.5-flash", "max_loops": 1},
        {"agent_name": "Aggregator", "system_prompt": "You are the reliability engineer. Combine the three reads into one recommendation per asset: priority P1 to P3, suggested window, parts. Mark it FOR PLANNER REVIEW.", "model_name": "gpt-5.4", "max_loops": 1},
    ],
    "max_loops": 1,
}

resp = requests.post(f"{BASE}/v1/swarm/completions", headers=HEADERS, json=review, timeout=600)
resp.raise_for_status()
data = resp.json()
print(data["output"])
print(data["usage"])

The Python SDK (pip install swarms-client) sends one request that runs the ticket desk as a MultiAgentRouter. The router reads the paint defect ticket, picks the Quality Engineer, and the response carries that agent's draft disposition with its token usage.

Questions plant teams ask

What quality managers, reliability engineers and the people who run the MES ask before they put agents on a line.

Which Swarms API swarm type fits a shop-floor ticket queue?

MultiAgentRouter when each ticket should go to exactly one specialist and you want the route recorded. MixtureOfAgents when several specialists should read the same asset and one aggregator should combine them. ConcurrentWorkflow when you want the independent reads without an aggregator. All of them take the same agents list, so switching is a one-field change.

Swarm types on the Swarms API

How do agents get data from the MES, CMMS or historian?

The Swarms API takes text in the task field, so the common pattern is a small job that pulls the ticket, the sensor window or the work order history from your systems and puts it in the task. Agents can also call tools you provide, which is how a plant connects a historian query or a CMMS lookup without exporting everything up front.

Do the agents release holds, close work orders or change the schedule?

No. The examples on this page return drafts: a disposition marked for quality manager approval, a work order with a suggested priority and window, a supplier note. A person approves each one in the system of record, and the run log shows what the agent saw and wrote.

Can we run the same review across every line or plant?

Yes. The batch endpoints accept a list of requests and return the results together, so one nightly job can review every flagged asset or every open ticket. Each request is logged separately in Swarms Cloud with its inputs, outputs, token usage and cost, so each plant sees its own entries.

What does a ticket cost to process?

Each response carries a usage block with input, output and total tokens, and Swarms Cloud shows the cost per run. Routing on a small model such as gpt-5.4-mini and sending volume tickets to gemini-2.5-flash or claude-haiku-5-5 keeps the price per ticket low, with a stronger model reserved for the dispositions and work orders a person signs. Per-model prices are on the pricing page.

Model pricing

Put a ticket desk on one line

Create a Swarms Cloud account, copy the ticket desk example above, and paste in a real ticket from this week. The first run shows up in your logs with the route it took and its cost.

New Swarms Cloud accounts start with $5 in API credits. Enterprise teams can talk to us about volume pricing, data handling and deployment options.