Industrial AI Agents Across Every Plant: Deploying Quorum Swarms Under Shared Rules

A working playbook, with code, for running one Quorum agent swarm per plant under one set of corporate rules. In a three-plant simulation, learned routing cut compute by 55%, and screening the rules inside the planner lifted upsets contained from 70.1% to 99.4%.

Industrial AI agents across three simulated plants: dot plot of process upsets contained as each part of Quorum is added, rising from 59.7% with fixed wiring to 70.1% with learned routing and 99.4% once the corporate rules are screened inside the planner, with compute per upset shown beside each row

Industrial AI agents meet plants that already have rules

Siemens estimates that unplanned downtime costs the world's 500 largest companies about $1.4 trillion a year, 11% of their revenue. That figure is why industrial organizations want AI agents in operations. The rules every plant already runs under are why most of those agents never leave the pilot. A chemical site must run every change to a covered process through a written management of change procedure under OSHA's process safety management standard. A safety instrumented function may be bypassed only under the controls IEC 61511 requires, written into the safety requirements specification. Alarm management guidance from EEMUA 191 and ISA-18.2 treats about one new alarm every ten minutes per console operator as very likely acceptable. An agent that ignores any of these gets switched off by the first shift lead it surprises.

Yesterday I introduced Quorum, my open-source control plane for agent swarms, on a simulated power grid. This piece is about what an industrial company does with it: one swarm per plant, each working its own plant's systems and processes, under one set of corporate rules, one event schema and one stop button. I wrote a process-upset domain for three plants (a chemicals site, a food and beverage site and a metals site), ran an ablation across all three, and measured which design choices earn their keep.

Two results set the agenda. Learned routing, which sends most scout calls to cheap, plant-specific scouts instead of the language model, cut compute per upset by 55%. The larger gain came from where the rules live. With the rules checked only at the approval gate, the swarm's best plan was blocked in 29.6% of upsets, and the plant got nothing. Screening the same rules inside the planner lifted upsets contained from 70.1% to 99.4%.

The Quorum plant fleet demo lets you switch each part of the swarm on and off and replay all 40 recorded upsets on each plant map. Everything below runs on a laptop CPU with no API keys: the plant domain, the fleet, the ablation and the math. The code blocks are complete files, and together they reproduce every simulated number in this article.

Plants, systems, processes: where the swarm sits

ISA-95, the standard most manufacturers use to describe their technology stack, is built on the Purdue reference model. Level 0 is the physical process, level 1 the sensors and actuators, level 2 the control systems (DCS, SCADA, PLCs), level 3 manufacturing operations (MES, historians, maintenance and batch systems) and level 4 business systems such as ERP. The levels also run on different clocks: level 3 works in days, shifts, hours and minutes, while levels 0 to 2 react in seconds and milliseconds.

A Quorum swarm belongs at level 3. It reads alarms and process values from the historian, reads maintenance status and work permits from the systems that own them, and proposes moves to the people who own level 2. It does not write setpoints into a controller, at least not in the first year. In IEC 62443 terms, the swarm sits in its own security zone and reaches the control zone only through a conduit you define, and in the first phase that conduit should be read-only.

The mapping from the plant to Quorum's pieces is direct. A plant is one swarm, with its own event log, its own learning and its own circuit breaker. The plant's systems (steam, cooling water, compressed air, power, refrigeration) and its process units become the nodes of that swarm's field graph, and the headers, pipes and product lines between them become the edges. A process upset is one episode: scouts search for a fix, a gate decides whether a person needs to see it, and the plant either contains the upset or does not. The company is the layer above all of it: corporate rules every site inherits, site rules that add to them, a kill switch that reaches every plant, and a roll-up of every site's event log.

The framing model: an attention budget per console

One constraint decides how much a swarm can do in a control room before any code runs: the operator's attention. EEMUA 191, ISA-18.2 and IEC 62682 suggest that up to 12 new alarms an hour, averaged over the long run, is the most an operator can manage, and about one every ten minutes is very likely acceptable. A swarm that asks for approval is one more alarm on that console. That gives a simple proposed model for the most upsets per hour a swarm can work before it pushes the console past its target:

u_max = (B − a) / p

where B is the console's alarm target per hour, a is the alarm rate the console already carries, and p is the swarm's interrupts per upset. Take a console with a target of B = 6 alarms an hour that already sees a = 4. The headroom is 2 interrupts an hour. A swarm that asks about every plan (p = 1) can work 2 upsets an hour on that console. In the ablation below, fixed wiring with the rules screened asked 0.173 times per upset, which allows 11.6 upsets an hour. The full Quorum configuration asked 0.116 times per upset, about once every 8.6 upsets, which allows 17.3.

The formula turns p into a design target. Every rule the swarm can check for itself, and every class of plan it can apply without asking, moves p down. Every wasted interrupt moves the console closer to an alarm flood.

The plant as a field graph

Quorum's runtime knows nothing about plants. A domain tells it how to lay out the field graph, what stress looks like, which scouts exist, and how to evaluate, stress-test and apply a plan. Here is the whole process-upset domain.

"""A process-upset domain for Quorum: one plant, its units, its utilities.

The field graph is the plant itself. Nodes are units (boilers, pumps,
reactors, fillers), edges are the steam, cooling water, air and product
lines between them. An upset starts at one unit and shows up as alarms
that fade with distance. Utilities carry fewer alarm points than process
units, so the loudest alarm is often one step downstream of the cause.
"""
from __future__ import annotations

from dataclasses import dataclass, field

import networkx as nx
import numpy as np

from quorum import Candidate, Evaluation, Strategy

# action -> (cost in margin units, throughput cut)
ACTIONS = {"setpoint": (0.05, 0.0), "standby": (0.2, 0.0), "derate": (0.3, 0.2), "shutdown": (1.0, 0.6)}


@dataclass
class PlantSpec:
    name: str
    lines: list[tuple[str, str]]
    utilities: set[str]
    spares: set[str] = field(default_factory=set)  # units with an installed spare
    psm: set[str] = field(default_factory=set)  # covered by process safety management
    ccp: set[str] = field(default_factory=set)  # food-safety critical control points


@dataclass
class Upset:
    root: str
    severity: float
    alarms: dict[str, float]
    spare_out: set[str]  # spares down for maintenance (from the CMMS)
    permit: str  # unit under a hot-work permit; the shift lead knows, the gate does not


class PlantUpsetDomain:
    def __init__(self, spec: PlantSpec, permit_feed: bool = False):
        self.spec, self.name = spec, f"plant:{spec.name}"
        self.permit_feed = permit_feed  # True when the permit-to-work system is wired in
        self.g = nx.Graph(spec.lines)
        self.units = sorted(self.g.nodes)
        self.dist = dict(nx.all_pairs_shortest_path_length(self.g))

    # scenario ------------------------------------------------------------------
    def reset(self, rng):
        util = sorted(self.spec.utilities)
        proc = [u for u in self.units if u not in self.spec.utilities]
        root = str(rng.choice(util if rng.random() < 0.6 else proc))  # most upsets start in a utility
        sev = float(rng.uniform(0.5, 1.0))
        gain = {u: 0.4 if u in self.spec.utilities else 1.0 for u in self.units}
        alarms = {u: max(0.0, sev * gain[u] * np.exp(-0.8 * self.dist[root][u]) + rng.normal(0, 0.05))
                  for u in self.units}
        out = {u for u in sorted(self.spec.spares) if rng.random() < 0.15}
        self._permit = str(rng.choice(self.units))
        return Upset(root, sev, alarms, out, self._permit)

    def field_graph(self, s): return self.g
    def stress(self, s): return s.alarms
    def noop(self, s): return Candidate("noop", None, [], "noop")
    def view(self, s): return {}
    def combine(self, s, cands): return None
    def resolved(self, ev): return ev.metrics["residual"] < 0.1

    # scouts ---------------------------------------------------------------------
    def _plans(self, units, rng):
        out = []
        for u in dict.fromkeys(units):
            acts = ["setpoint", "derate"] + (["standby"] if u in self.spec.spares else [])
            acts += ["shutdown"] if rng.random() < 0.2 else []
            out += [Candidate(f"{a}@{u}", (a, u), [u], "") for a in acts]
        return out

    def strategies(self):
        loudest = lambda s: max(s.alarms, key=s.alarms.get)  # noqa: E731

        def random_(s, fld, rng, llm):
            return self._plans(list(rng.choice(self.units, 2, replace=False)), rng)

        def field_(s, fld, rng, llm):
            return self._plans(fld.sample(rng, size=2), rng)

        def local(s, fld, rng, llm):
            top = loudest(s)
            return self._plans([top, *list(self.g.neighbors(top))[:1]], rng)

        def utility_trace(s, fld, rng, llm):  # walk from the loudest alarm to the utilities feeding it
            top = loudest(s)
            feeders = [u for u in self.g.neighbors(top) if u in self.spec.utilities]
            return self._plans(feeders[:2] or [top], rng)

        def llm_(s, fld, rng, llm):
            board = ", ".join(f"{u}:{v:.2f}" for u, v in sorted(s.alarms.items(), key=lambda kv: -kv[1])[:6])
            text = llm.complete("Name the unit most likely causing these alarms.", board).text
            picks = [u for u in text.replace(",", " ").split() if u in self.g]
            return self._plans(picks[:2] or [loudest(s)], rng)

        return {"random": Strategy("random", 0.05, random_), "field": Strategy("field", 0.1, field_),
                "local": Strategy("local", 0.1, local), "utility_trace": Strategy("utility_trace", 0.15, utility_trace),
                "llm": Strategy("llm", 1.0, llm_)}

    @staticmethod
    def mock_llm(system, prompt):  # offline stand-in: names the two loudest units
        return " ".join(item.split(":")[0] for item in prompt.split(", ")[:2])

    # plant model (the analysts' digital twin) ----------------------------------
    def _residual(self, s, plan):
        if plan is None:
            return s.severity
        act, u = plan
        d = self.dist[s.root][u]
        if act == "setpoint":
            return max(0.0, s.severity - 0.6) if d == 0 else s.severity
        if act == "standby":
            return 0.0 if d == 0 and u not in s.spare_out else s.severity
        if act == "derate":
            return 0.35 * s.severity if d <= 1 else s.severity
        return 0.0 if d <= 2 else s.severity  # shutdown

    def evaluate(self, s, c):
        cost, cut = ACTIONS[c.plan[0]] if c.plan else (0.0, 0.0)
        return Evaluation({"residual": self._residual(s, c.plan), "cost": cost, "throughput_cut": cut})

    def stress_test(self, s, c, rng):  # skeptic: the upset grows 15% before the move lands
        ev = self.evaluate(s, c).metrics
        return Evaluation({**ev, "residual": min(1.0, ev["residual"] * 1.15 + abs(rng.normal(0, 0.03)))})

    # gating ----------------------------------------------------------------------
    def risk_features(self, s, c, ev, st):
        act, u = c.plan
        f = {"psm_unit": float(u in self.spec.psm), "ccp_unit": float(u in self.spec.ccp),
             "derate": float(act == "derate"), "shutdown": float(act == "shutdown"),
             "throughput_cut": ACTIONS[act][1], "residual": ev.metrics["residual"]}
        if self.permit_feed:
            f["under_permit"] = float(u == s.permit)
        return f

    def risk_score(self, f):
        return 0.4 * f["psm_unit"] + 0.3 * f["derate"] + 0.5 * f["shutdown"] + 0.3 * f["residual"]

    def operator_policy(self):
        # the shift lead's unwritten rules: no derate or shutdown on PSM units without an MOC,
        # and nothing that touches a unit under a hot-work permit
        def policy(p):
            act, u = p.plan
            return not ((act in ("derate", "shutdown") and u in self.spec.psm) or u == self._permit)
        return policy

    # live ------------------------------------------------------------------------
    def apply(self, s, c):
        res = self._residual(s, None if c is None else c.plan)
        cost, cut = ACTIONS[c.plan[0]] if c else (0.0, 0.0)
        return {"residual": res, "survived": float(res < 0.4), "cost": cost, "throughput_cut": cut}

    def describe(self, s, c):
        return f"Upset at {self.spec.name}" if c is None else f"{c.plan[0]} at {c.plan[1]}"

    @staticmethod
    def default_objective():
        return {"residual": -3.0, "cost": -0.3, "throughput_cut": -1.0, "survived": 2.0,
                "interrupts": -0.5, "compute_cost": -0.2, "misses": -3.0}

The alarm model is the part worth slowing down for. An upset of severity s starts at a root unit r, and the alarm reading at unit u is

a_u = s g_u e^− 0.8 d(r, u) + ε

where d(r, u) is the number of lines between the two units, g_u is the unit's alarm gain and ε is sensor noise with a standard deviation of 0.05. Process units get a gain of 1.0 and utilities 0.4, because a reactor or a filler usually carries far more alarm points than the pump or compressor feeding it. A worked example: a cooling water pump fails with severity s. The pump's own alarms read 0.4 s. The reactor it cools, one line away, reads e^(−0.8) s = 0.449 s, which is 12% louder than the cause. In 10,000 simulated upsets per plant, the loudest alarm pointed at the wrong unit 37% of the time across the three plants: 24.4% at the chemicals site, 34.7% at the food site and 51.7% at the metals site, where most process units hang off several utilities at once.

"""How often does the loudest alarm point at the wrong unit?"""
import numpy as np
from plant_domain import PlantUpsetDomain
from plants import PLANTS

for name, spec in PLANTS.items():
    domain, rng = PlantUpsetDomain(spec), np.random.default_rng(0)
    upsets = [domain.reset(rng) for _ in range(10_000)]
    wrong = np.mean([max(u.alarms, key=u.alarms.get) != u.root for u in upsets])
    print(f"{name}: loudest alarm is not the root cause in {wrong:.1%} of upsets")

This is the consequential-alarm problem every operator knows, and it is why the domain has a utility-trace scout that walks from the loudest alarm back to the utilities that feed it.

The swarm has five scouts. A random scout costs 0.05, the field scout and the local scout (the loudest alarm and one neighbor) cost 0.1, the utility-trace scout costs 0.15, and the LLM scout, which reads the six loudest alarms and names a unit, costs 1.0. Each scout proposes plans at the units it picks, and there are four kinds. A setpoint change costs 0.05 and takes 0.6 off the severity, but only at the root. A switch to an installed spare costs 0.2 and fixes the root, unless maintenance has the spare out of service (15% of the time). A derate costs 0.3, cuts that unit's throughput by 20% and brings the upset down to 35% of its severity from up to one line away. A controlled shutdown costs 1.0, cuts throughput by 60% and fixes anything within two lines. Skeptics replay the leading plans with the upset grown 15%, the way a disturbance grows while a crew walks to the valve. One move is missing on purpose: a safety bypass. It is not in the action space at all, which is the first guardrail and the cheapest one.

The simulated shift lead has two rules the gate cannot read: no derate or shutdown on a unit covered by process safety management without an MOC, and nothing that touches a unit under a hot-work permit.

Three plants in one file

"""Three plants in one company, each described by its units and the lines between them."""
from plant_domain import PlantSpec

CHEMICALS = PlantSpec(
    name="chemicals",
    lines=[("boiler_1", "steam_header"), ("boiler_2", "steam_header"), ("steam_header", "preheater"),
           ("steam_header", "column"), ("cooling_tower", "cw_pump_a"), ("cooling_tower", "cw_pump_b"),
           ("cw_pump_a", "reactor_1"), ("cw_pump_b", "reactor_2"), ("cw_pump_a", "condenser"),
           ("cw_pump_b", "condenser"), ("air_comp", "instrument_air"), ("instrument_air", "reactor_1"),
           ("instrument_air", "column"), ("substation", "cw_pump_a"), ("substation", "air_comp"),
           ("feed_tank", "preheater"), ("preheater", "reactor_1"), ("preheater", "reactor_2"),
           ("reactor_1", "separator"), ("reactor_2", "separator"), ("separator", "column"),
           ("column", "condenser"), ("condenser", "product_tank"), ("separator", "flare")],
    utilities={"boiler_1", "boiler_2", "steam_header", "cooling_tower", "cw_pump_a", "cw_pump_b",
               "air_comp", "instrument_air", "substation"},
    spares={"cw_pump_a", "cw_pump_b", "air_comp", "boiler_1", "boiler_2"},
    psm={"reactor_1", "reactor_2", "separator", "column", "flare"},
)

FOOD = PlantSpec(
    name="food",
    lines=[("boiler", "cip_skid"), ("boiler", "pasteurizer"), ("ammonia_refrig", "chiller"),
           ("chiller", "glycol_loop"), ("glycol_loop", "mix_tank_1"), ("glycol_loop", "mix_tank_2"),
           ("glycol_loop", "cold_storage"), ("air_comp", "filler_1"), ("air_comp", "filler_2"),
           ("air_comp", "labeler"), ("cip_skid", "mix_tank_1"), ("cip_skid", "mix_tank_2"),
           ("mix_tank_1", "pasteurizer"), ("mix_tank_2", "pasteurizer"), ("pasteurizer", "filler_1"),
           ("pasteurizer", "filler_2"), ("filler_1", "labeler"), ("filler_2", "labeler"),
           ("labeler", "palletizer"), ("palletizer", "cold_storage"), ("cip_skid", "wastewater")],
    utilities={"boiler", "ammonia_refrig", "chiller", "glycol_loop", "air_comp", "cip_skid"},
    spares={"air_comp", "chiller"},
    psm={"ammonia_refrig"},  # anhydrous ammonia above the threshold quantity
    ccp={"pasteurizer"},
)

METALS = PlantSpec(
    name="metals",
    lines=[("substation", "furnace"), ("substation", "rolling_mill"), ("substation", "hydraulics"),
           ("gas_skid", "furnace"), ("cooling_water", "furnace"), ("cooling_water", "caster"),
           ("cooling_water", "rolling_mill"), ("hydraulics", "caster"), ("hydraulics", "rolling_mill"),
           ("air_comp", "caster"), ("air_comp", "finishing"), ("furnace", "caster"),
           ("caster", "reheat"), ("gas_skid", "reheat"), ("reheat", "rolling_mill"),
           ("rolling_mill", "coiler"), ("coiler", "finishing"), ("finishing", "coil_yard"),
           ("crane", "coil_yard"), ("crane", "caster")],
    utilities={"substation", "gas_skid", "cooling_water", "hydraulics", "air_comp"},
    spares={"hydraulics", "air_comp", "cooling_water"},
)

PLANTS = {p.name: p for p in (CHEMICALS, FOOD, METALS)}

The three plants have 46 units and 65 lines between them. The chemicals site has two reactors, a separator, a column and a flare under process safety management. The food site's ammonia refrigeration is covered too, because OSHA's standard applies to anhydrous ammonia at 10,000 pounds or more in a process, and its pasteurizer is the critical control point in the site's food safety plan. The metals site has no PSM-covered units in this model, so its gate almost never needs a person.

Corporate rules, site rules, one stop button

"""One swarm per plant, one set of corporate rules, one stop button for the fleet."""
from __future__ import annotations

from pathlib import Path

from quorum import (CircuitBreaker, Controller, EventBus, GateKeeper, HardRule, Intent, KillSwitch, MockLLM,
                    SafetyMonitor, SimulatedOperator, StaticController, Swarm, SwarmConfig, ThresholdGate,
                    forbid, max_value)

from plant_domain import PlantUpsetDomain
from plants import PLANTS

# Corporate rules apply at every site. No optimizer can trade them away.
CORPORATE_RULES = [max_value("throughput_cut", 0.25, name="max_25pct_throughput_cut")]

# Site rules add to the corporate ones, never replace them.
SITE_RULES = {
    "food": [HardRule("no_derate_on_ccp", lambda f: not (f["ccp_unit"] and f["derate"]),
                      "never derate a food-safety critical control point")],
}


class RuleScreened:
    """Wraps a domain so analysts score rule-breaking plans as worthless.

    The gate still checks every rule before anything is applied. Screening here
    only stops the search from spending its one pick on a plan the gate will block.
    """

    def __init__(self, domain, rules):
        self._d, self._rules = domain, rules

    def __getattr__(self, name):
        return getattr(self._d, name)

    def evaluate(self, s, c):
        ev = self._d.evaluate(s, c)
        if c.plan is not None and any(not r.check(self._d.risk_features(s, c, ev, None)) for r in self._rules):
            return self._d.evaluate(s, self._d.noop(s))  # no better than doing nothing, so never ranked
        return ev


FLEET_STOP = KillSwitch(flag_file=Path("runs/FLEET_STOP"))  # touch the file to halt every site


def build_plant_swarm(site: str, mode: str = "quorum", seed: int = 0, screen: bool = True,
                      permits: bool = True, runs: Path = Path("runs")) -> Swarm:
    rules = CORPORATE_RULES + SITE_RULES.get(site, [])
    rules += [forbid("under_permit", name="no_moves_on_permitted_work")] if permits else []
    domain = PlantUpsetDomain(PLANTS[site], permit_feed=permits)
    domain = RuleScreened(domain, rules) if screen else domain
    intent = Intent(goal=f"contain process upsets at the {site} plant without surprising the shift lead",
                    objective=domain.default_objective(), rules=rules,
                    budget=6.0, interrupt_budget=1)
    arms = {"scout": {n: s.cost for n, s in domain.strategies().items()}}
    controller = (StaticController(arms, fixed={"scout": "llm"}) if mode == "static" else Controller(arms))
    policy = domain.operator_policy()
    gate = GateKeeper(ThresholdGate(0.4), SimulatedOperator(policy), oracle=policy)
    safety = SafetyMonitor(kill_switch=FLEET_STOP, breaker=CircuitBreaker(max_consecutive_failures=3))
    return Swarm(domain, intent, controller, gate, bus=EventBus(runs / site / f"{mode}-{seed}.jsonl"),
                 llm=MockLLM(domain.mock_llm), safety=safety,
                 config=SwarmConfig(ticks=6, twin_every=0), seed=seed)

Quorum keeps goals and rules apart. The objective is a weighted sum the learning loops can trade off: residual upset, margin cost, throughput cut, compute and interrupts. The rules are hard limits that no reward can buy an exception to. Here the corporate rule caps any single move at a 25% throughput cut, the food site adds a rule that its critical control point is never derated, and every site forbids moves on units under a hot-work permit once the permit system is wired in.

The circuit breaker opens after three upsets in a row that were not contained, and the fleet kill switch is a file. Touching it stops every site at its next tick:

food: halted after 0 upsets (kill switch: flag file runs/FLEET_STOP)

The routing is Quorum's open-core bandit. Each scout keeps a Beta posterior over how often it pays off. Before each call the controller draws one sample per scout and uses the highest draw, and after the call it updates that scout with a reward that charges for compute:

r = q − w c

where q is the share of the problem the scout's best plan fixed (0 to 1), c is its cost and w = 0.5 is the price of compute. If the utility-trace scout and the LLM scout both find the full fix, q = 1, the utility-trace scout earns 1 − 0.5 × 0.15 = 0.925 and the LLM scout earns 1 − 0.5 × 1.0 = 0.5. Equal answers at unequal prices, so the cheap scout wins more of the next calls, and the LLM scout still gets called when the cheap ones start coming back empty.

The RuleScreened wrapper exists because of how Quorum ranks plans. The search ranks plans by reward, and the hard rules are checked at the gate, which is the right place for the final check, since nothing can learn its way around it. But each upset gets one pick. If the best-scoring plan breaks a rule, the gate blocks it and the plant falls back to doing nothing. In this domain the usual culprit is a controlled shutdown: it resolves the upset on paper and cuts throughput by 60%, well over the corporate limit. Screening scores a rule-breaking plan as no better than doing nothing, so the search never spends its pick on one. The gate keeps its check as the backstop.

Running the fleet

"""Run every plant's swarm side by side, then roll the event logs up for the fleet."""
from collections import Counter
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path

from quorum import SwarmHalted, read_events

from fleet import build_plant_swarm
from plants import PLANTS


def run_site(site: str, episodes: int = 40) -> str:
    swarm = build_plant_swarm(site, seed=0)
    try:
        swarm.run(episodes)
        return f"{site}: ran {episodes} upsets"
    except SwarmHalted as stop:  # fleet kill switch or this site's circuit breaker
        return f"{site}: halted after {len(swarm.history)} upsets ({stop})"
    finally:
        swarm.bus.close()


def roll_up(runs: Path = Path("runs")) -> None:
    for site in PLANTS:
        events = read_events(runs / site / "quorum-0.jsonl")
        ends = [e["data"] for e in events if e["kind"] == "episode_end"]
        gates = Counter(e["data"]["decision"] for e in events if e["kind"] == "gate")
        used = Counter()
        for e in ends:
            used.update(e["arm_usage"])
        contained = sum(e["metrics"]["survived"] for e in ends) / len(ends)
        print(f"{site:>9}: contained {contained:.0%}, gate {dict(gates)}, "
              f"busiest scout {used.most_common(1)[0][0]}")


if __name__ == "__main__":
    with ThreadPoolExecutor(max_workers=len(PLANTS)) as pool:
        for line in pool.map(run_site, PLANTS):
            print(line)
    roll_up()

The open core runs each swarm's loop in sequence, so the fleet gives each site its own thread. With real model calls, those threads spend most of their time waiting on the network. On seed 0 it prints:

chemicals: ran 40 upsets
food: ran 40 upsets
metals: ran 40 upsets
chemicals: contained 100%, gate {'auto': 29, 'escalate': 11}, busiest scout utility_trace
     food: contained 100%, gate {'auto': 36, 'escalate': 4}, busiest scout field
   metals: contained 100%, gate {'auto': 40}, busiest scout field

The three sites learned different habits. The chemicals site, where so many process units hang off shared cooling water and steam, leaned on the utility-trace scout. The food and metals sites leaned on the field scout. The chemicals site also asked its shift lead 11 times in 40 upsets, because its PSM-covered units carry most of the risk, and the metals site never asked. Each site's event log is a JSON-lines file with every scout call, evaluation and gate decision, so the roll-up is a few lines of reading, and a plant historian or a data lake can take the same files.

What each part earns: the ablation

The ablation adds one part at a time, each row on top of the one above, on identical upset sequences. Each row is 10 seeds of 40 upsets at each of the three plants, so 1,200 upsets per row, and ± is the 95% interval across seeds. Compute is in abstract units, where one LLM call costs 1.0.

"""What each part earns across three plants: 10 seeds x 40 episodes per plant and row."""
import numpy as np
from fleet import build_plant_swarm
from plants import PLANTS

ROWS = [  # (label, mode, screen rules in the planner, permit-to-work feed)
    ("Fixed wiring, rules checked at the gate only", "static", False, False),
    ("+ learned routing", "quorum", False, False),
    ("+ rules screened in the planner", "quorum", True, False),
    ("+ permit-to-work feed as a hard rule", "quorum", True, True),
    ("Side check: fixed wiring with screening and permits", "static", True, True),
]
KEYS = ("contained", "compute", "interrupts", "misses", "blocked", "llm_share")


def run(site, mode, seed, screen, permits, episodes=40):
    sw = build_plant_swarm(site, mode, seed, screen=screen, permits=permits)
    sw.safety.breaker.max_consecutive_failures = 10**6  # measure, do not halt, in a benchmark
    hist = sw.run(episodes)
    blocked = sum(e.data["reason"].startswith("hard rule") for e in sw.bus.of("gate"))
    sw.bus.close()
    arms = sw.controller.summary()["scout"]
    pulls = sum(a["pulls"] for a in arms.values())
    m = lambda k: float(np.mean([h.metrics[k] for h in hist]))  # noqa: E731
    return {"contained": m("survived"), "compute": m("compute_cost"), "interrupts": m("interrupts"),
            "misses": m("misses"), "blocked": blocked / episodes,
            "llm_share": arms["llm"]["pulls"] / pulls if (mode == "quorum" and pulls) else 1.0}


if __name__ == "__main__":
    for label, mode, screen, permits in ROWS:
        per_seed = []
        for s in range(10):
            sites = [run(site, mode, s, screen, permits) for site in PLANTS]
            per_seed.append({k: np.mean([r[k] for r in sites]) for k in KEYS})
        mean = {k: np.mean([r[k] for r in per_seed]) for k in KEYS}
        ci = 1.96 * np.std([r["contained"] for r in per_seed], ddof=1) / np.sqrt(len(per_seed))
        print(f"{label:<52} contained {mean['contained']:.1%} ±{ci:.1%}  compute {mean['compute']:.2f}  "
              f"interrupts {mean['interrupts']:.3f}  bad auto-applies {mean['misses']:.3f}  "
              f"blocked at gate {mean['blocked']:.3f}  LLM share {mean['llm_share']:.0%}")
ConfigurationUpsets containedCompute per upsetInterrupts per upsetBad plans auto-applied per upsetBest plan blocked at the gate
Fixed wiring, rules checked at the gate only59.7% ± 2.94.350.0930.03339.7%
+ learned routing70.1% ± 3.21.950.0830.04329.6%
+ rules screened in the planner99.4% ± 0.53.090.1130.0550%
+ permit-to-work feed as a hard rule99.7% ± 0.43.290.11600%
Side check: fixed wiring with screening and permits94.4% ± 1.25.290.17300%

Fixed wiring is the setup most agent frameworks ship: every scout call goes to the strongest model. Here that model names the two loudest units, which is the wrong place in more than a third of upsets, and the swarm's best plan was blocked by a rule in 39.7% of them. Learned routing moved 88% of scout calls off the LLM scout, cut compute from 4.35 to 1.95 per upset (55% less) and lifted containment to 70.1%. Blocked plans were still the main way upsets got away.

Screening the rules in the planner is the largest single gain in the table: containment rose to 99.4% and blocked plans fell to zero. Compute went up, from 1.95 to 3.09, because the search no longer stops at the first shutdown that resolves the upset on paper and fails the rule. The extra 1.14 units per upset bought 29.3 points of containment.

The permit-to-work feed fixed a different failure. Before it, 0.055 plans per upset were applied automatically that the shift lead would have rejected, about one in 18 upsets, and each was a move on a unit under a hot-work permit. The gate could not see the permit, so it could not know to ask. Once the permit status became a feature and a hard rule, that number went to zero.

The side check answers the obvious question: does routing still matter once the rules are handled well? Fixed wiring with the same screening and permit feed contained 94.4%, against 99.7% for Quorum, and used 5.29 units of compute per upset against 3.29 (38% less) and asked the shift lead 0.173 times per upset against 0.116 (33% fewer). Run through the attention budget above, that difference is 11.6 against 17.3 upsets an hour on a console with two interrupts of headroom.

Rolling Quorum out to the next plant

A company that runs Quorum at two plants will want the third to start from what the first two learned. I tested that directly: run the chemicals and food sites for 40 upsets, pool their scout posteriors, shrink them halfway back to the uniform prior, and start the metals site from the result.

"""Rolling Quorum out to a new plant: start its router from what the fleet already learned."""
import numpy as np
from fleet import build_plant_swarm


def fleet_prior(swarms, weight=0.5):
    """Pool the scout posteriors of running plants, shrunk toward Beta(1, 1)."""
    names = swarms[0].controller.bandits["scout"].arms
    prior = {}
    for n in names:
        a = np.mean([s.controller.bandits["scout"].arms[n].alpha for s in swarms])
        b = np.mean([s.controller.bandits["scout"].arms[n].beta for s in swarms])
        prior[n] = (1 + weight * (a - 1), 1 + weight * (b - 1))
    return prior


def warm_start(swarm, prior):
    for n, (a, b) in prior.items():
        arm = swarm.controller.bandits["scout"].arms[n]
        arm.alpha, arm.beta = a, b


def first_weeks(warm: bool, seed: int, episodes: int = 10):
    if warm:
        donors = [build_plant_swarm(site, seed=100 + seed) for site in ("chemicals", "food")]
        for d in donors:
            d.run(40)
    new = build_plant_swarm("metals", seed=seed)
    if warm:
        warm_start(new, fleet_prior(donors))
    hist = new.run(episodes)
    arms = new.controller.summary()["scout"]
    return (np.mean([h.metrics["compute_cost"] for h in hist]), np.mean([h.metrics["survived"] for h in hist]),
            arms["llm"]["pulls"] / sum(a["pulls"] for a in arms.values()))


if __name__ == "__main__":
    for warm in (False, True):
        rows = np.array([first_weeks(warm, s) for s in range(30)])
        c, k, l = rows.mean(axis=0)
        ci = 1.96 * rows[:, 0].std(ddof=1) / np.sqrt(len(rows))
        print(f"{'warm' if warm else 'cold'} start: first 10 episodes at the new plant, "
              f"compute {c:.2f} ±{ci:.2f} per episode, contained {k:.1%}, LLM share {l:.0%}")

Over the new plant's first 10 upsets, across 30 runs, a cold start used 3.42 ± 0.24 compute units per upset and a warm start 3.31 ± 0.24. That is no measurable difference. The router does not need the fleet's history, because it learns fast: each upset makes up to 18 scout calls, and over its first 10 upsets the cold-started router already sent only 15% of them to the LLM scout, the same share the full benchmark settles at.

That settles what to centralize. Rules, gate thresholds, the kill switch and the event schema belong to the company, because they encode decisions people made and should be identical everywhere. Routing and field behavior belong to the plant, because they encode what works on that plant's equipment, and they learn it fast enough that sharing buys little.

From advisory to autonomy

No plant should meet a new agent at full autonomy. The rollout I would run has three phases, and Quorum's gate interface carries all of them.

In phase one the swarm proposes and nothing is applied. An always-ask gate sends every plan to an operator object that logs it for the morning meeting and approves none:

"""Phase one at a new plant: the swarm proposes, the shift lead reads, nothing is applied."""
import json
from pathlib import Path

from quorum import GateKeeper
from quorum.gates import AlwaysAskGate

from fleet import build_plant_swarm


class AdvisoryOperator:
    """Logs every plan for the morning meeting and approves none."""

    def __init__(self, path):
        self.path = Path(path)

    def review(self, proposal) -> bool:
        with self.path.open("a", encoding="utf-8") as fh:
            fh.write(json.dumps({"plan": proposal.summary, "risk": round(proposal.risk, 3),
                                 **proposal.features}) + "\n")
        return False


swarm = build_plant_swarm("chemicals", seed=0)
swarm.gatekeeper = GateKeeper(AlwaysAskGate(), AdvisoryOperator("runs/chemicals/advice.jsonl"))
swarm.safety.breaker.max_consecutive_failures = 10**9  # in phase one the crew owns outcomes, not the swarm
swarm.run(10)
print(Path("runs/chemicals/advice.jsonl").read_text().splitlines()[0])

The first line of the log reads:

{"plan": "setpoint at cooling_tower", "risk": 0.056, "psm_unit": 0.0, "ccp_unit": 0.0, "derate": 0.0, "shutdown": 0.0, "throughput_cut": 0.0, "residual": 0.18713783861569844, "under_permit": 0.0}

One detail from building it: in advisory mode the circuit breaker has to be relaxed, because the swarm applies nothing, so it fails every upset by its own count and would halt itself after three. The crew owns the outcomes in phase one, and the breaker should judge the swarm only once the swarm acts.

In phase two the threshold gate takes over, as in the fleet code above: low-risk plans go to the operator as recommendations to carry out, and anything touching a PSM-covered unit interrupts a person. In phase three, classes of plans with a clean record in the event log, such as setpoint trims on units outside process safety management, are applied without asking, and everything else stays gated. The attention budget decides how fast a plant moves through the phases.

Quorum's shadow twin, which replays the same upsets with current and proposed settings before any change to the swarm goes live, follows the same instinct as management of change. It does not replace it. A change to the plant's chemicals, technology, equipment or procedures still goes through the site's written MOC procedure. The twin governs changes to the swarm, not to the plant.

Where it breaks

The plants are hand-built graphs of 13 to 18 units, and each episode has one upset. A real plant has thousands of tags, overlapping upsets and alarms that chatter. The alarm model and the effects of each action are my assumptions, not fits to plant data, so these results show the mechanism and the relative size of each effect, not what a given site will see.

The LLM scout is an offline mock that names the two loudest units. A real model might trace the utilities on its own and earn more of the calls. The real-model path exists (quorum run --domain toy --llm anthropic meters calls, tokens and dollars), but none of these numbers use it, so compute here is in abstract units.

The shift lead is simulated with two rules. Real crews have more, many unwritten, and the size of the gap between what the gate sees and what the crew knows is exactly what the permit result measures. Screening works only for rules whose inputs the swarm can read. A rule that lives in someone's head can only be caught at the gate, by a person.

"Contained" means the residual upset fell below 0.4 of full severity, which is a modeling choice. The open-core runtime is synchronous within each swarm, which is why the fleet uses threads.

Open core and Quorum Pro

Every result in this article uses the open core, which is Apache 2.0 at Bodhi8/quorum-swarm. Quorum Pro adds a learned gate, self-tuning field physics and an energy domain pack, and none of the numbers here depend on them. The Quorum plant fleet demo runs on the results of this article's code, and the Quorum grid demo replays a recorded grid run tick by tick.

The path forward

Five questions are worth asking before any agent swarm goes near a plant this quarter. For each control room console, what are B and a today, and how many interrupts per upset can a swarm afford inside that headroom? Which of your plant rules can a planner read as data (permits, MOC status, PSM coverage, critical control points, spares out of service), and which exist only in people's heads? When the swarm's best plan is blocked, what does the plant get instead? Which settings must be identical at every site, and which should each plant learn for itself? And can you replay a month of upsets against a proposed change before that change touches a plant?

To run everything above, install the open core with pip install git+https://github.com/Bodhi8/quorum-swarm, save the eight files from this article in one folder, and run python run_fleet.py, then python ablation.py for the table and python transfer.py for the rollout test.

Sources

Related research