# Managing worker agents with service state instead of prompt rules

Author: Chris Chabot
Canonical URL: https://chabot.dev/blog/managing-worker-agents-with-service-state-instead-of-prompt-rules/
Published: 2026-10-19

Why a coordinator agent's duties to its workers belong in service state: stored waits with clocks for worker questions, a computed capacity line, and workers that own whole areas.

A coding agent blocked on a question to its orchestrator can sit idle for most of an hour while nothing in the system knows an answer is owed. In our logs, one worker waited 41 minutes until the project's owner noticed. Most multi-agent frameworks give an orchestrating model a spawn tool, a message bus, and prompt rules: answer your workers, use free capacity, restart what stalls. That holds for short fan-outs where the parent stays live until every call returns. Over a multi-hour project, an obligation written only in a prompt has no owner and no clock, so it drops as events interleave across turns.

On the cloud platform I build, a person runs a project through a coordinator agent that talks with them and directs worker agents writing to one shared file tree. The coordinator proposes actions, and a deterministic project service validates and applies each one through the same idempotent path a human client uses. Rather than expanding the prompt, I moved each recurring management obligation into the service: durable records with an owner and deadlines, settled only by evidence from the party that acted, and computed facts instead of reminders.

## Whole-area workers, not sub-agents

Durable obligations require an owner that outlives a single call. Splitting a backlog into ephemeral sub-agent calls leaves no persistent thread to answer or park, and every follow-up starts cold.

Workers here are complete agent threads rather than sub-agents, each with every tool, its own memory, and helpers it spawns itself: the same as opening Claude Code or Codex, clicking New thread, and handing it a large job. Projects allow 16 workers by default and 64 at most. Each worker owns a related area through delivery, sized by codebase overlap rather than backlog length: a poster and new database fields go to two workers because their edits are disjoint, whereas a new field and a bounded ring buffer in the same source go to one. Follow-ups return to the thread holding the context, giving the service a stable owner and concurrency slot to track.

## Tracked waits for worker questions

A question on a generic message bus looks like any other event, so once the coordinator wakes and ends its turn without replying, nothing records the unanswered question. When a worker blocks on a question to its coordinator, the service stores a wait with three clocks. At 5 minutes, it wakes the coordinator with that worker's question first. At 12 minutes, an idle worker is parked, freeing its slot while keeping its report and unlanded work. At 30 minutes, if the worker's turn has ended, the wait expires and a new turn tells the worker so, with no answer inferred. Only time spent waiting counts; work the worker continues after asking does not advance those clocks.

Only the coordinator can answer; any reply from a worker is rejected by the service. When a worker's turn has ended, queuing its next turn and closing the wait execute in one transaction that re-reads the wait to confirm it is still open. For a running worker, sending a reply does not clear the wait; it settles only when that worker's execution loop reports taking the reply as input.

## Capacity as a computed fact

Idle capacity fails the same way under prompt rules. In another incident, a coordinator answered three wakes with no actions while six slots sat free, dispatching work only after the owner stepped in. Give a model one notice urging it to keep slots busy and another warning against busywork, and on a quiet wake it reliably follows the one that spends fewer tokens.

One rule replaces both notices once the service computes the state behind it: fill a slot only with real work. Every wake carries a computed capacity line reporting free slots, queued items, and startable work, counting tasks with met prerequisites, open work from the coordinator's notes, unstarted planned phases, and owed follow-ups like unresolved review findings, plus a digest so an unchanged count over different work still registers. If a wake ends with a free slot, startable work open, and nothing dispatched, the service allows at most one extra model round, and refused or indeterminate requests do not count as started. Capping the retry at one round catches a missed start without turning a stalled model or an intentional pass into a loop.

## Stopping stuck workers and doing small jobs directly

When a worker stalls, a coordinator limited to spawning and messaging must wait for the owner. Giving it a stop primitive lets it halt a stuck run without conflating automated recovery with an owner-initiated stop. Likewise, nobody writes a brief and starts a worker to bump a version number or fix a typo; exposing the workers' file, shell, and web tools lets the coordinator handle two-minute edits and quick lookups itself.

The service withholds the tools that copy the shared file tree or bypass review, so both invariants hold at the capability boundary rather than depending on another line in the prompt.
