Skip to content

Epic: a faster, parallel automation engine — what is left after the first slice #4936

Open
1 of 3 issues completed

Description

@yannickmonney

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

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

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.

Related

#4693, #4695, #4516, #4647, #4684

Sub-issues

Sub-issues

1 of 3 Issues completed
Loading 3 sub-issues

Activity

  1. added
    perf
    improvement
    service: platform
    epic
    on Oct 13, 2026
  2. yannickmonney commented on Nov 14, 2026

    @yannickmonney
    ContributorAuthor

    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:

    1. Finish the walker (refactor(platform): step live runs as a host on the shared walker #5258).
    2. Split the protocol constant, and stamp runs when they are created.
    3. Item concurrency, steps side by side and retries.
    4. The wait step, durable test runs and preview.
    5. Screens, docs and packs.
    6. Benchmark and canary, then flip the default.

    Answers: the five forks in #4928

    1. Writes next to reads: Barrier. These wait for every step above them and hold every step below them:
      • a write;
      • an unknown connector action;
      • an agent;
      • a subautomation.
    2. Steps at once in the first release: 1.
      • AUTOMATION_PARALLEL_STEPS ships with default 1, max 8.
      • It flips to 4 in the next release, after a benchmark and a canary on one deployment.
    3. A model step without retry: retry.
      • It retries on rate_limited and provider_unreachable: 3 tries, waiting 5 s then 10 s.
      • A larger provider Retry-After is honoured up to maxDelay (default 60 s). Above that, the step fails without retrying.
      • retry: false opts out.
      • Credit, auth, invalid-output and other failures are never retried.
    4. Shipped packs: yes.
      • Their model and read forEach steps get concurrency: 5.
      • Writes stay at 1.
      • This lands only after item concurrency, model retry and the benchmark.
    5. Largest concurrency: 10.

    Answers: the open questions in #4929

    • Protocol: split the constant.
      • The read format goes to 3.
      • Queue names, the writer marker and the image build's writer-protocol check stay 2, under their own constant.
      • A run is stamped 3 only when it carries stand-ins, preview mode, a wait node or a timed retry park.
      • The stamp is written when the run is created, or in the write that parks it, never first at the claim. That way an old worker can never pick up a test run or preview during a rolling deploy and make real calls.
      • Ordinary runs stay 2, so mixed fleets keep sharing them.
    • Durable test runs.
      • Test runs that a person starts (UI and REST) run on the durable walker with stand-ins and appear in the Runs list.
      • The deploy gate's check and the bench stay in-process.
    • Preview is a third mode, built on the durable stand-ins.
      • Real reads and real model calls, billed, with budgets applied.
      • Every action not known to be a read is held back as "would have sent": writes and unknown connector actions, including inside called automations.
      • Agents are simulated.
      • It never starts from a trigger.
      • Only owners, admins and developers can start one.
      • It may name any saved version, as a new exception to AUTO-R5.
    • Wait step.
      • type: wait with for or until, from 1 s up to 30 days.
      • These are refused at save, as errors and not warnings: a wait node with forEach, and a subautomation that contains a wait called with concurrency above 1.
      • A called automation is resolved at run time, so the run checks the second case again and fails the step with a named error.
    • Approval line.
      • The gate returns who allowed the step, and the step record carries allowedBy.
      • The Steps view marks only steps an allowance let through ("Ran without approval").
      • The step detail names the grant and who made it. So does the approval record's metadata.

    The design pass's other proposals are taken as written:

    • When a step fails, nothing new starts, steps already running finish, and the reported failure is the first failing step in document order.
    • One commit lane per run.
    • A forEach's output and effects stay in item order.
    • concurrency is refused on repeatUntil and on steps that wait for a person.
    • A write that is not idempotent is retried only on a rate limit.
    • A wait of 15 s or less happens inside the turn; a longer one parks the run.
    • An old API replica refuses the new fields during a rolling deploy; this is accepted and gets a release note.

    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

    1. refactor: step live runs as a host on the shared walker (refactor(platform): step live runs as a host on the shared walker #5258).
    2. refactor: split the protocol into a read format and a step/queue marker, with the stamp written at run creation. Depends on 1.
    3. feat: run a forEach's items several at a time (concurrency 1-10). Depends on 1.
    4. feat: retry a failed model or connector step, with a durable park for waits over 15 s. Depends on 2.
    5. feat: run independent steps side by side under the barrier rule (AUTOMATION_PARALLEL_STEPS, default 1). Depends on 1 and 3.
    6. feat: show overlap and attempts in the canvas and Steps view, with docs, locales and manual boxes. Depends on 3, 4 and 5.
    7. feat: record allowedBy when an allowance let a write through. Independent; can start now.
    8. feat: the wait step, with the save-time and run-time refusals. Depends on 4.
    9. feat: durable test runs with stand-ins. Depends on 2.
    10. feat: preview mode. Depends on 9.
    11. feat: packs at concurrency: 5 on model and read items. Depends on 3 and 4.
    12. chore: flip AUTOMATION_PARALLEL_STEPS to 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):

  3. added
    agent-ready
    on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyepicimprovementperfservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions