> ## 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.

# Handle signal outcomes

> Inspect success, failure, or closure and declare work for one terminal state.

A signal terminates once by emitting a value, failing, or closing without a value.

| Source | [`outcome`](/reference/runtime/signal-operators#outcome) | [`succeeded`](/reference/runtime/signal-operators#succeeded) | [`failed`](/reference/runtime/signal-operators#failed) | [`closed`](/reference/runtime/signal-operators#closed) | [`onSuccess`](/reference/runtime/signal-operators#onsuccess) | [`onFailure`](/reference/runtime/signal-operators#onfailure) | [`onClose`](/reference/runtime/signal-operators#onclose) |
| ------ | -------------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -------------------------------------------------------- |
| Emits  | Tagged value                                             | `true`                                                       | `false`                                                | `false`                                                | Source value                                                 | Closes                                                       | Closes                                                   |
| Fails  | Tagged failure                                           | `false`                                                      | `true`                                                 | `false`                                                | Closes                                                       | Error value                                                  | Closes                                                   |
| Closes | Tagged closure                                           | `false`                                                      | `false`                                                | `true`                                                 | Closes                                                       | Closes                                                       | `null`                                                   |

Use `outcome` when later work needs one value for every terminal state:

```ts automations/report-selection.automation.ts theme={null}
import { automation, onHttpRequest, respondToHttpRequest } from "automate.ax"

export default automation("Report request selection", () => {
  const request = onHttpRequest()
  const selected = request.path.filter((path) => path.startsWith("/api/"))

  respondToHttpRequest({
    body: selected.outcome().transform((value) => JSON.stringify(value) ?? ""),
    requestId: request.requestId,
  })
})
```

Use `succeeded`, `failed`, or `closed` when another signal needs a boolean. Use `onSuccess`, `onFailure`, or `onClose` when an entire synchronous section should run for one state. Failure and closure are different: failure carries an `AutomationError`; closure means a route produced no value.

To use a backup only when another signal closes, branch on `closed(preferred)`. Failure remains distinct and doesn't select the backup unless you route it explicitly.
