# Fan out to subagents with child runs

To run subagents in parallel and rejoin their results durably, use `run.fanout()`. Each branch becomes a child run with its own checkpoints, joined results are stored in a normal checkpointed step, and a resumed parent reuses its existing children instead of spawning duplicates.

```typescript
const results = await run.fanout('research-options', [
  { name: 'flights', workflow: researchFlights, input: { destination } },
  { name: 'hotels',  workflow: researchHotels,  input: { destination } },
  { name: 'food',    workflow: researchFood,    input: { destination } }
])
```

Tidebase is an open-source checkpoint layer for AI agents: wrap your steps, and failed runs resume from the last safe point — in your own Postgres, without moving execution into a new runtime.

## Semantics

- **Idempotent by edge name.** Child run creation is keyed by parent run + edge name (`flights`, `hotels`, `food`). If the parent crashes and resumes, Tidebase returns the existing child runs — no duplicate subagents, no double work, no double spend.
- **Independent checkpointing.** Each child is a full run: its own steps, state, events, and gates, visible in Studio as a parent/child tree.
- **Durable join.** The joined result is stored in a checkpointed step named `join:<fanout-name>`, so a parent resuming after the join doesn't re-gather children's results.

## Why this matters for agent architectures

Multi-agent systems fail partially: two subagents finish, one dies. Without durable fanout you either rerun everything (slow, expensive, duplicate side effects) or hand-roll per-branch bookkeeping. With parent/child run edges the partial failure is queryable — `GET /runs/:runId` returns `childRuns` with per-child status — and resuming the parent re-invokes only the unfinished branch.

See also: [Fork and time travel](fork-and-time-travel-agent-runs.md) · [How to resume a failed run](how-to-resume-a-failed-ai-agent-run.md)