DEV Community

Rose
Rose

Posted on Edited on

Async work you can restart: who owes a reply, and how the runtime knows

Every async agent bug I've met is the same bug: the system forgot who owed whom what. Here is the smallest set of promises that fixes it — stated as mechanisms, so you can test them in your own runtime this week.

Post 7 was about what crosses the boundary when a lead hands a specialist a piece of work. Post 8 was about schedules you can trust to fire. There is a third thing, sitting between them and bigger than either, that almost nobody specifies: the asynchronous reply. A dispatch goes out, the parent keeps working, and at some point a result must come back. Whether that result arrives at all, whether the parent can answer without it, and what happens if the process dies in the gap — those are three separate properties, and most "multi-agent" systems quietly leave all three to the model's good manners.

I write for AgentParley, so read the product parts knowing that. The mechanism below is what I'd build into anything that dispatches work, including a system with no vendor in it. Everything I attribute to AgentParley is on a public docs page I've linked at the end.

The problem, in the words of the bug report

You have seen it as a symptom. The agent answered "all done" while two helpers were still running. Or it said "all done" and one helper had failed quietly. Or the machine restarted, the reply never went out, and the work did happen — so the retry ran it twice. Each of those is a missing promise, not a bad prompt:

  • Delivery. If a child forgets to report, does anyone notice? A child that finishes and says nothing should not be the same event as a child that reported.
  • Completion. Is a parent allowed to answer its human with work outstanding? If that rule lives in the prompt, it is a suggestion. A model under pressure will decide it has enough.
  • Durability. The gap between "the answer is composed" and "the answer is delivered" is where a restart turns one act into two. A restart that resends by re-running is a double charge wearing a recovery story.

The rest of this post is one mechanism per promise, and a test for each.

Promise 1: a dispatch is a message, and the report can come back to a different process

The first thing to get right is that the parent's call to dispatch must not block. If dispatch() waits for the child, you have a function call with extra latency, and you have lost the parallelism you were paying for.

At AgentParley the tool is start_subagent. In the docs' words, it returns immediately with the child's id; the lead keeps working; the child's result arrives later as a message that wakes the lead. Independent specialists run in parallel up to the plan's concurrent-run limit, and beyond that they queue rather than fail.

That gives you a shape you can draw: parent → dispatch (returns an id) → parent continues → result arrives as an inbound message. Two consequences fall out, and both matter.

The parent must have somewhere to put "still running." A parent that dispatched and immediately needs the answer is a parent that will poll. Polling is a model call that learns nothing, which is the most expensive sentence in agent engineering. The dispatch should be fire-and-note: the runtime records the outstanding child id, and the parent gets on with the next piece. If the runtime is doing this right, the wait itself is an event, not a loop.

The report must not arrive only as a tool result. A tool return is bound to the turn that called the tool. If the answer can only come back as a tool result, then a long child forces either a blocked turn or a timeout. A child's report has to travel as an ordinary message into the parent's conversation — which is why it can land in a later turn, after the parent has done other work. This is also the property that makes async work survive a restart, which we'll come to.

At AgentParley the report path has a name — report_to_caller — and the docs are explicit about what happens when a child forgets to use it: in the default reply mode, its final message is delivered anyway. You can tighten that: reply modes are implicit (only what the agent sends), auto (default — its final message to whoever is owed one), and all (every message, streamed). If it fails, the lead is told rather than left waiting forever.

Take a moment on how specific that is, because it's the kind of sentence that separates a specification from a hope. "If it forgets, we deliver its last message anyway" is a statement about a recovery path. You can test it: give a child a task and instructions to never call the report tool. Did the parent hear anything?

Promise 2: completion is a gate, not an instruction

The second promise is the one that decides whether your system's "done" means anything: a parent may not answer its human while a child it dispatched still owes a report.

Post 7 argued that this has to be enforced by the runtime, because a model asked politely to wait will, under pressure, decide it has enough and answer. The mechanism is worth stating precisely now, because it has more hooks than the sentence implies. In the docs: while any live subagent still owes it a report, or it has open to-dos, the lead's answer to its human is held back.

Three parts, and each is a different failure mode:

  • Live child outstanding. This is the obvious one. The gate exists specifically to stop "all done" arriving early.
  • Open to-dos. The same rule applies to the parent's own list. An agent that writes itself a to-do list and then declares victory with items still open has not finished; it has stopped. Because open to-dos are also how the platform keeps a long mission moving — the agent is re-woken turn after turn while any remain — the gate and the mission driver are the same machinery. That is the right economy: one record drives the work and blocks the premature answer.
  • New input just arrived. The gate also holds the answer while a new message has just landed, so a reply that would already be stale is not sent into a conversation that has moved on.

And the mechanisms come with their own honest edge, which the docs state rather than bury: a specialist-on-specialist message — message_agent — does not get an automatic reply in every case. Where the message lands matters. If the target answers the agent that messaged it this turn, the reply goes back there. If the target also talks to a person on a channel, the message may land in that channel chat, visible where the person reads it, and only the standing thread between two agents comes back automatically; in a channel chat the target answers with message_agent when it needs to. The docs draw the conclusion in as many words: a crew prompt must not count on an automatic answer. That is a real limit, and it means the gate protects the subagent-parent relationship, not an informal question between colleagues.

Promise 3: the report is a durable record before the answer goes out

Here is the promise that makes the other two survive a restart.

A restart is only a resume if the system knows, after the crash, who still owed what. That means the interesting state is not "the parent is running" — it's the set of outstanding obligations: which child sessions are live, which parent sessions have an unanswered report, which saved replies were composed but not delivered.

The mechanism at AgentParley, in the crews page's words: every piece of work is written down before an agent is woken. If a worker dies mid-step, another picks the work up. A sweep re-wakes anything left unfinished, including open to-do lists and replies still owed. And the line I'd put in neon: a reply that was saved but not delivered is re-sent without paying for another model call.

Make it concrete with the window that bites you. The lead has composed its answer. The reply is saved. The process dies before delivery. On restart there are two honest behaviours and one dishonest one:

  • Re-run the lead's turn → the model composes a different answer, and may take a different action with it. That is a resume in name only; post 5 was about why that's the expensive failure.
  • Re-send the saved text → the answer lands once, and no model was called to produce it again.
  • Drop it → the person never hears, and nothing records that they were owed.

Only the middle one is what "restart-safe" means, and notice that it requires the composed answer to be a durable artifact distinct from the turn that composed it. This is the same intent-before-effect rule as post 5, applied one layer up: the effect here is "the human is told", and the intent is "this reply exists and has not been delivered".

This is also where the restart interacts with cost in a way I want to be blunt about, because it's the easy place to imply something we don't claim. Re-delivering a saved reply saves a call because no call is made at all — not because anything was cached. Prompt caches live minutes, not days; a restart hours later is a cold start if it re-runs. The saving is zero calls versus one call, and that's the whole of it.

Promise 4: dispatch obeys the same rules as everything else

Two rules you can check in thirty seconds, because they tell you whether the async layer is a special case bolted on or part of the permission model.

Depth. By default at AgentParley a subagent cannot spawn subagents of its own — one level of hierarchy: lead → specialists. No crews of crews. That is a deliberate limit, and it matters for async work: an unbounded spawn tree is an unbounded set of outstanding obligations, and the completion gate has nothing to gate on if the tree has no shape.

Outcome as data, not an exception. The plugin-side call — host.session.subagent.spawn — returns { outcome: "created" | "forbidden" | "depthExceeded", sessionId } and never blocks. Forbidden reach and depth limits come back as values, in the same shape as success, so the calling code branches on a field instead of catching an error. The peer message call returns { isDelivered, isCanceled, cancelReason }, and "not delivered" is likewise data — including when a plugin vetoed it. If dispatch and delivery report their refusals as exceptions, the caller's error path is the part nobody tests.

And a fuse worth naming because it's exactly the kind of thing async systems get wrong: if plugin code reacts to a message by sending a message, each generation is a hop, and past 4 hops from one original event the platform-API members are withheld for that generation — so two agents ping-ponging die quietly instead of spending the night together.

The test sheet

Four tests, in the order I'd run them. Each one produces a specific observation, not an opinion.

  1. The forgetful child. Dispatch a subagent whose instructions forbid calling the report tool. Watch whether the parent receives its final message. Pass: the parent hears something. Fail: the parent waits for a report that was never going to come.
  2. The premature parent. Dispatch a slow child, then ask the parent a question that its current context can answer without the child. Pass: the parent's answer is held until the report lands, or until the child visibly fails. Fail: the parent answers around the work.
  3. The crash between compose and deliver. Kill the process after the reply is saved and before it is delivered. Pass: the saved text arrives on restart, and the usage ledger shows no second call for it. Fail: the model is called again, or the person never hears.
  4. The refused dispatch. Point a dispatch at something it isn't allowed to reach — a forbidden agent, or a depth that exceeds the limit. Pass: an outcome field says forbidden or depthExceeded and the parent carries on. Fail: an exception, and a parent that has already forgotten what it dispatched.

I'd add one manual check that isn't a test so much as a habit: after a long mission, read the parent's transcript and the children's. If you can't tell from the record alone who was owed what at every point, no test will save you, because the bug will be invisible until it's a double send.

The honest limit

None of this makes an asynchronous crew correct. Three things it cannot do, and I'd rather you know them:

  • The gate is about obligations, not quality. A parent held for a report will merge whatever came back, including a confidently wrong report. Post 7's honest limit applies here too: the runtime cannot enforce that the plan was good.
  • The report path can be vetoed, and the docs say so. A plugin sitting on interAgentMessage can rewrite or cancel a report. The docs are careful about the consequence, and it's the kind of detail I wish more specs had: a vetoed report leaves the sending child not told why, and its lead still waiting. Rewriting — appending "[unverified — ask for evidence]" — is kinder than cancelling, precisely because the gate will keep the parent waiting on a report that was destroyed in transit.
  • Peer questions are weaker than subagent reports. As above: only the standing thread comes back automatically. If you build on auto-reply between colleagues, you have built on a property the platform doesn't promise.

Everything above is about the mechanisms. Whether your specific mission needs the gate at all is a design question — a fire-and-forget fan-out has no obligations to gate, and isFireAndForget: true exists for exactly that. Not every dispatch deserves a report.

The checklist

For any runtime that dispatches work, ours included — five questions:

  1. Does dispatch return an id immediately, and does the result arrive as a message in a later turn?
  2. Is the parent's answer gated on live children and open to-dos, enforced by the runtime rather than requested in a prompt?
  3. If a child finishes without reporting, is its final message delivered anyway — and can you observe that in a test?
  4. Is a composed-but-undelivered reply a durable record that is re-sent without a second model call?
  5. Do refused dispatch and refused delivery come back as data rather than as exceptions?

Five yes answers do not make a good crew. They make a crew whose "done" you can trust, which is the part that has to be true before anything else about it matters.


Disclosure: I write for AgentParley, the hosted crew of specialist agents described in this post, so the product parts are not a neutral review. Every mechanism I attribute to it is on the public pages linked below, read 21 November 2026, including the limits I didn't paper over.

Notes on the primary sources: Agent crews (asynchronous delegation, report_to_caller, reply modes, the lead's answer held, reach and depth, hop-depth fuse), Host API (host.session.subagent.spawn, peer.send and their result shapes), Middleware hooks (interAgentMessage and the veto caveat) — all read 21 November 2026. The crews page's plain-language statements about reports and restart are at agentparley.ai/crews; the plan limits are at agentparley.ai/pricing.

The comparison, including where self-hosting is the better pick: agentparley.ai/openclaw-alternative. Plans and limits: agentparley.ai.

Dev.to tags: #agents #architecture #async #distributed


Notes for Rose (not for publication)

Topic, in a line. Async delegation and the report-back contract: dispatch returns an id and the result arrives as a message in a later turn; the parent is gated by the runtime from answering with work outstanding; a composed-but-undelivered reply is a durable record re-sent without a second model call. Not covered anywhere in posts 1–10: post 7 covered what crosses the boundary and the gate in one section; this one is about the obligation ledger and its four promises, plus the recoverable window at delivery, four tests and a checklist.

Why this angle rather than a fresh schedule post. Rose asked for async delegation/report-back or restart-safe scheduled work, without repeating 7–10. Restart-safe schedules is post 8's whole subject; a second one would collide. Async delegation is also the stronger of the two: the docs pages I read today (plugin-agent-crews, plugin-host-api) are the most precise mechanism documentation we have, and none of it has been used in a post yet.

Every product claim in the body, and where it came from — all fetched today, 21 Nov 2026:

Claim in the post Source
start_subagent returns immediately with the child's id; lead keeps working; the result arrives later as a message that wakes the lead; parallel up to the plan's concurrent-run limit; beyond it they queue /docs/plugin-agent-crews
Subagent reports with report_to_caller; if it forgets, its final message is delivered anyway (default auto mode); if it fails, the lead is told /docs/plugin-agent-crews
Reply modes implicit / auto / all and what each delivers /docs/plugin-agent-crews (also /docs/plugin-host-api)
Lead's answer held while any live subagent owes a report, or it has open todos /docs/plugin-agent-crews; /crews ("while its own to-do list has open items, or while a new message has just arrived")
Open todos keep the agent working turn after turn /docs/plugin-agent-crews, /docs/plugin-host-api
message_agent reply routing; only the standing thread replies automatically; "a crew prompt must not count on an automatic answer" /docs/plugin-agent-crews
Every piece of work written down before a wake; a sweep re-wakes unfinished work including open todos and replies still owed; a saved-but-undelivered reply is re-sent without a new model call /crews, /pricing ("No double charge after a restart") — both also in the claims register as "restart survival"
One level of hierarchy; a subagent cannot spawn subagents by default /docs/plugin-agent-crews
subagent.spawn never blocks; returns outcome: created / forbidden / depthExceeded with sessionId; same reach and depth rules as the tool /docs/plugin-agent-crews, /docs/plugin-host-api
peer.send returns { isDelivered, isCanceled, cancelReason }; not-delivering is data, not an error /docs/plugin-host-api
Hop-depth fuse: past 4 hops, platform-API members withheld for that generation /docs/plugin-host-api, /docs/plugin-agent-crews
interAgentMessage can rewrite or veto; a vetoed report leaves the sender not told why and its lead still waiting; rewriting is kinder than cancelling /docs/plugin-agent-crews (docs' own wording)
isFireAndForget: true = no report expected /docs/plugin-host-api
Token caching: caches live minutes, not days; saving is zero calls, not cached calls claims register, corrected entry — stated explicitly in Promise 3

Claims Rose must verify independently before publishing:

  1. The reply-mode names and semantics (implicit / auto / all). New today, on plugin-agent-crews and plugin-host-api, not in the claims register. Load-bearing for Promise 1's "forgets to report" paragraph.
  2. "A new message has just arrived" as a third gate condition. It's on /crews, not on the docs page; post 7 already used it, so it is precedented, but it is a /crews fact rather than a docs fact.
  3. The per-plan concurrent-run numbers (1 / 3 / 10) appear in plugin-agent-crews and match the register's "chats running at once", but I deliberately wrote the post without any plan figure — no numbers to check.
  4. The hop-depth fuse ceiling (4) is a doc fact I quote; it is consistent with the register's plugin-mechanism entry in spirit but not catalogued there. Add it to the register if you want it reusable.
  5. The exact quote attributed to the docs — "a crew prompt must not count on an automatic answer" — is verbatim from plugin-agent-crews. Everything else in quotation marks is my own phrasing of a doc sentence; nothing is presented as a verbatim quote that isn't one.

What I deliberately did not use:

  • No competitor is named. plugin-agent-crews mentions that OpenClaw and Hermes can spawn helpers, and /crews names them, but I kept this post to mechanisms. So no "where they are the better pick" section against a named product is required; the honest-limit section concedes against our own mechanism and against self-hosting in general, as posts 6, 9 and 10 did.
  • The Oh My OpenAgents code excerpts. Tempting (the reconcileCrew and report-contract code is concrete), but a long TS excerpt would make the post a docs walkthrough. The mechanism survives without it.
  • Any measured timing, cost or recovery figure. None exist and none are invented. Nothing about how long a sweep takes, how long a restart takes, or what a mission costs.
  • The host.fetch limits, plugin-wakes figures, log retention. Not relevant here and not in the register.
  • Word "unlimited", "enterprise-grade", "secure by default", "assistant", "companion". None used. The product is a crew of specialists throughout.

Tags, and why these four. #agents and #architecture continue the series' spine (used in 6–10). Slot 3: #async — accurate and searchable, the post is about async work specifically; it repeats nothing from posts 6–10 (#security, #devops, #javascript, #llm). Slot 4: #distributed — the durable-record/at-least-once territory, and the readership that cares about an obligation ledger. Alternatives I considered: #devops (repeats 6 and 8), #programming (accurate, unhelpfully broad), #typescript (the post has no TS code), #llm (repeats 7). Dev.to editor caveat stands from devto-launch.md: type-and-select one tag at a time or use the API.

Length — a caveat first. I have no way to count words accurately in this workspace (no shell), and a model-estimate I ran on the body gave a figure under 1,500 that I don't trust enough to publish, so treat the length as unmeasured and count it yourself before you decide on cuts. My read from drafting is that it runs over the 900–1,200 brief, in the same band as posts 7, 9 and 10. Cuts if you want it inside, cheapest first: "Promise 4" as a whole — the depth limit and outcome-as-data are true, but the first three promises carry the argument; then the "new input just arrived" third bullet of Promise 2. I kept Promise 4 because the forbidden / depthExceeded-as-data point is the one a builder writing their own dispatcher gets wrong, and it is not made anywhere else in the series.

Continuity note. Post 7's "Notes for Rose" flagged that the completion gate needed checking against /crews. This post cites plugin-agent-crews, whose opening paragraph restates the same gate as platform-enforced: "Delegation, reporting back, reach control and 'don't answer the human until your crew has reported' are enforced by the platform, not by prompt tricks." That is the confirmation post 7 asked for, and I've used it as the basis for Promise 2.

Top comments (0)