Part of a short series on the features in the Delivery Desk demo, a parcel delivery desk run by agents on one durable log, built on Laser SDK. The first post, Killing agents in a delivery desk demo, covers crash and resume. This one covers quarantine.
The situation
Say one copy of an agent starts giving bad results. You want it to stop getting new work, now, without killing the process and without editing or redeploying whatever sends it work.
In the desk, each agent in the Agent registry panel has a Quarantine button for that.
Why it needs no change to dispatch
Dispatch never sends work to an agent by name. Each workflow step names a skill (assess, replan, assign, notify, invoice-check), and the agent registry resolves which agents serve it. Each agent advertises its skills on its card when it starts.
Two routing agents, routing and routing-2, serve the same skills. Dispatch's route policy picks the one it has sent the fewest steps, so work spreads across both, and each exception card shows which one took each step.
Quarantine is a fact appended to the registry. Every registry folds it, so when dispatch next resolves a skill, the quarantined agent is not in the answer. Dispatch routes new steps around it with no change to its code.
The code behind the button
async def quarantine(self, name: str) -> dict:
if self.registry.is_quarantined(name):
await self.laser.unquarantine(C.APPROVER, name)
return {"ok": True, "quarantined": False}
for skill in C.SKILLS[name]:
others = [c.agent for c in self.registry.resolve(skill) if c.agent != name]
if not others:
return {"ok": False, "error": f"{name} is the only agent serving {skill}"}
await self.laser.quarantine(C.APPROVER, name)
return {"ok": True, "quarantined": True}
Three things to note:
-
laser.quarantine(...)takes the agent out of routing.laser.unquarantine(...)(the Reinstate button) puts it back. - The desk refuses to quarantine the last agent serving a skill, because those steps would then have no agent to run them.
- The process keeps running. Quarantine is about routing, not about stopping the agent.
Both actions are written to the log as events, so the desk's timeline shows who was quarantined and when.
Limits
Quarantine only changes routing. A step already sent to the agent before it was quarantined is still done by that agent.
Why this matters
When agents pick their peers through a registry, operational controls become data. Taking an agent out of service is one fact on a log that every router reads, not a config change in every caller.
Try it
You need Python 3.11+ and Docker.
git clone https://github.com/laserdata/laser-delivery-desk
cd laser-delivery-desk
docker compose up -d
python3 -m venv .venv && . .venv/bin/activate
pip install -e .
python -m fleet.server
The code is at laserdata/laser-delivery-desk, Laser SDK is at laserdata/laser-sdk, and the docs are at docs.laserdata.com/laser-sdk.
Top comments (0)