Parallel-DAG: concurrent node execution with idempotent resume after ApprovalGate rejection
Problem
AgentGraph today executes nodes sequentially. When independent branches exist in the graph, they run one after the other — wasting wall-clock time and making human-approval interruptions block unrelated work.
Goal
Independent nodes in a graph should run concurrently. When an ApprovalGate rejects a node, only the gated sub-graph is paused — the rest of the execution continues.
Crucially, on resume, nodes that already completed must not re-execute — even if they have side effects (tool calls, DB writes). Idempotence must be enforced by the runtime, not by the application code.
Design constraints
- Fan-out is detected automatically from the graph topology (nodes with no data dependency can run in parallel)
- Max concurrency is configurable:
.parallelism(4) - Checkpoint written after each node regardless of branch
- On resume, the runtime replays only the incomplete branch from the last checkpoint
AgentGraph.builder()API must not change — parallel execution is opt-in at the graph level
Acceptance criteria
- Independent nodes execute concurrently (verified by wall-clock timing in tests)
- Approval rejection pauses only the gated node's branch
- Resume skips already-completed nodes (verified by execution log)
ParallelAgentGraphTestcovers: happy path, approval pause+resume, node failure in one branch- Docs: new section in
docs/two-api-levels.md
References
Discussed in the v1.0 RFC. This is the most complex v1.0 pillar — the hardest part is rerun-after-rejection without double-executing side-effecting nodes.