Repository navigation
Description
Summary
On 2026-10-08 the owner asked for a faster automation engine with parallelism: steps that do not need each other running side by side, a forEach working on several items at once, and a failed step trying again after a wait that survives a restart. The first slice has landed (cheaper template evaluation, a pool of runners, per-organization queueing). Everything that changes how a run walks its graph has not. This epic tracks that part and the pieces that were designed to wait for it.
Anchors are at main da3b98b730 (2026-10-13).
What is on main
- perf(platform): evaluate automations faster — template fast path, scope views, runner pool #4693:
{{ }}paths resolved in the host without a runner round trip, scope views instead of a clone per expression, a pool of runner processes (AUTOMATION_RUNNER_PROCESSES,services/platform/backend/env.ts:87). - perf(platform): queue an API request's automation code as its organization's #4695: code evaluated for an API request is queued as its organization's.
AUTOMATION_ORG_CONCURRENCYis the per-organization step limit (env.ts:75). - The benchmark harness:
services/platform/lib/engine/core/execute/perf.bench.ts. - Foundations the rest builds on: leases, fenced writes and cooperative shutdown (fix(platform): keep automation runs safe across restarts and redeploys #4516); the per-unit run record that already allows overlapping spans (feat(platform): keep, read and replay a step-by-step record of every automation run #4647); a live agent step receives its node's
input(fix(platform): hand a live agent step its node's input #4684).
What a run still does
One node after another in topological order (services/platform/backend/core/automations/stepper.ts:1036-1047), forEach items one after another (:1472-1486), no retry of a model call (services/platform/backend/core/automations/llm_call.ts), and no concurrency, retry or wait on a node (services/platform/lib/engine/core/types.ts:54-135). Two walkers decide this separately, the durable one and the in-process one. Details and anchors are in the three issues below.
The issues
- Improvement: walk live and in-process automation runs with one walker #4927: put the walk in one place, as a pure move. The foundation for the rest.
- Improvement: run independent steps and a forEach's items at the same time, and try a failed step again after a wait #4928: steps side by side, items at a time, retries after a wait, with the five forks that are the owner's to answer.
- Improvement: durable test runs with stand-ins, preview mode, a wait step and the approval line in the run record #4929: test stand-ins in durable runs and the protocol they need, preview mode (the owner said yes), a wait step, and the "allowed without approval" line in the run record.
Order the design pass assumed: the walker first, then steps, items and retries, then the screens, docs and packs, and a benchmark run before the default for steps flips. Each step is its own pull request with its own gate.
What it could be worth
Modelled in the design pass (arithmetic on assumed latencies, not a measurement on a deployment; the table is in #4928): a forEach of 20 model calls takes about 50 s today and, at most, about 9 s with 8 items at a time; the shipped triage and review packs go from 50 to 69 seconds to 8 to 12 seconds; a fan-out document of independent reads and model calls from 9.2 s to 3.4 s.
Risks the design pass listed
- The unification moves a large, invariant-heavy part of the durable walker (lease, ledger, in-doubt handling, shutdown hand-off, pins, record).
- Concurrency inside one walker can checkpoint wrongly if a drain is missed before a park or a commit overwrites another step's cursor.
- A wrong failure class on a retried write could send a write twice.
- Parallel model calls raise provider rate-limit pressure, and each concurrent call reserves its budget maximum.
- Old API replicas refuse documents with the new node fields during a rolling deploy.
Left out on purpose by the design pass
Several iterating nodes at once (needs a new cursor shape and a protocol change), parallel steps inside a called automation, an explicit after: ordering field, pipelining items across nodes, organization-level limits on concurrent model calls, sizing budget reservations from a step's history, and a simulated "fail once, then succeed" stand-in for tests.
Activity
yannickmonney commentedon Nov 14, 2026
Decision
This epic stays open as the tracker and is never worked as one change. All of its work lives on the 0.6 line: branch off feature-train, land on release/0.6. main (0.5.x) gets none of it. Each unit below is its own pull request with its own gate.
Order:
Answers: the five forks in #4928
AUTOMATION_PARALLEL_STEPSships with default 1, max 8.retry: retry.retry: falseopts out.concurrency: 5.concurrency: 10.Answers: the open questions in #4929
type: waitwithfororuntil, from 1 s up to 30 days.allowedBy.The design pass's other proposals are taken as written:
concurrencyis refused on repeatUntil and on steps that wait for a person.Rationale
The barrier keeps external writes in exactly today's order and costs at most about 0.5 s. Almost all of the modelled gain for the shipped packs comes from item concurrency, which the barrier does not limit.
Shipping steps-at-once at 1 and flipping it after a benchmark follows this epic's own order. It also contains the risk of a missed drain or a cursor overwrite.
Model calls are already made again on resume, so retrying the transient classes is safe. Retry is also what lets parallel model calls survive provider rate limits, so the packs get concurrency only after retry has landed. The cap of 10 bounds the budget reserved at once while there is no per-organization model-call limit.
Splitting the protocol uses the existing "defer a run stamped above your own" mechanism, with no queue rename and no writer-guard change. A new run row is written at protocol 2 today, so the stamp has to be set when the run is created. A stamp written only at the claim would leave a window for an old worker to run a test or preview with real calls.
A wait inside a forEach is an error because warnings never block (AUTO-R24). Because a called automation can change after the caller is saved, the rule is checked at run time too. Preview holds back unknown actions for the same reason the barrier treats them as writes.
Implementation units
concurrency1-10). Depends on 1.AUTOMATION_PARALLEL_STEPS, default 1). Depends on 1 and 3.allowedBywhen an allowance let a write through. Independent; can start now.concurrency: 5on model and read items. Depends on 3 and 4.AUTOMATION_PARALLEL_STEPSto 4 after the benchmark and canary, in the next release. Depends on 5 and 6.Cross-issue amendments (decisions taken together with #4928, #4929, #4929):