> ## Documentation Index
> Fetch the complete documentation index at: https://docs.automate.ax/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Select and time signals

> Select by declaration order or completion time, and add durable delays and deadlines.

These operators select among one-shot signals or introduce durable time into an automation.

## `fallback()`

`fallback([preferred, backup])` selects by declaration order. A pending earlier input blocks later inputs. Closure advances to the next input; emission or failure is selected.

```ts theme={null}
import { fallback } from "automate.ax"

const recipient = fallback([preferredRecipient, defaultRecipient])
```

TypeScript requires at least two inputs. Use `race` when completion order should decide instead.

## `race()`

`race([first, second])` selects the first causally related input to emit or fail. Closed inputs leave the race, and the race closes only when every input closes.

```ts theme={null}
import { delay, race } from "automate.ax"

const elapsed = race([delay("3d"), delay("1d")]) // emits after one day
```

Continuation contexts with the same causal roots compete in one durable race. Independent trigger contexts race separately. TypeScript requires at least two inputs.

## `delay()`

`delay(duration)` emits `null` in a child continuation after a durable relative delay:

```ts theme={null}
import { delay } from "automate.ax"

const elapsed = delay("24h")
```

`delay(duration, signal)` starts when the signal emits and re-emits its value later. It preserves the signal's keyed or global partition.

```ts theme={null}
const followUp = delay("3d", request)
```

Pass a synchronous section as shorthand for scoping work under the elapsed signal:

```ts theme={null}
delay("3d", () => {
  sendEmail({ subject: "Follow up", text: "Three days have elapsed." })
})
```

Durations accept type-checked compact strings such as `"3d"`, millisecond numbers, or compatible signals.

## `timeout()`

`timeout(signal, duration)` mirrors the source if it emits or fails before the deadline. If the deadline wins, the result fails with `TimeoutError`. Source closure leaves the deadline active, so the result fails when the deadline arrives.

```ts theme={null}
import { timeout } from "automate.ax"

const result = timeout(providerResult, "1d")
```

The deadline can span execution jobs, including a timeout around a multi-day delay. It does not interrupt an action handler already running. `timeout` preserves the source's keyed or global partition.

See [burst control](/reference/signals/control-bursts) when timing should coordinate repeated occurrences instead of one continuation.
