# Outcomes

A run's conversation is not its result. Files the agent was asked to produce, workspace changes, and links such as a pull request are collected into an immutable outcome with a `wbo_...` ID. `wb outcome` inspects, exports, applies, and recovers it, without another model turn, harness login, runtime key, or live sandbox.

The contract itself is on [Outcomes contract](/docs/standard/outcomes).

## What a run returns

- **Changesets**: workspace edits, grouped by workspace.
- **Artifacts**: files the agent wrote to its outbox: reports, screenshots, images, datasets, archives.
- **Links**: HTTP or HTTPS links, typed `pull_request`, `preview`, or `external`.

Local and Docker runs edit your directories in place, so their changes are already `present`. E2B and Daytona runs work on copies, and their changes stay `pending` until you apply them.

## Inspect

```sh
wb outcome wb_...          # by run ID: the run's latest outcome
wb outcome wbo_...         # by outcome ID
wb outcome wbo_... --json  # the outcome and its application receipt
```

The human view shows the outcome's identity, receipt state, completeness, changeset counts, warnings, and the commands to inspect, apply, or export it. Artifact names point to local files with their original bytes. Images are not rendered inline.

`wait --json` includes `outcome_id` when a run has one.

## Export

```sh
wb outcome wbo_... --export ./review-bundle
```

Export writes a self-contained bundle: `outcome.json`, the artifact files under `artifacts/` in their original layout, and a directory per changeset with its after-files and optional `changes.diff`. The destination must not exist. Export never runs returned HTML, scripts, or binaries.

## Apply

```sh
wb outcome wbo_... --apply
wb outcome wbo_... --apply --workspace ./another-checkout
```

`--apply` writes a pending changeset into the run's original workspace bindings. `--workspace` overrides only the primary workspace; named changesets need their recorded named bindings.

Before changing any file, apply checks every target path against the fingerprint it had before the run. A conflict rejects the whole operation and leaves host files untouched. Paths already matching the result are recognized, so a retry is safe and never overwrites later unrelated edits.

Applying a local or Docker outcome has nothing to do: those changes are already present.

## Recover

```sh
wb outcome wb_... --recover
wb outcome wb_... --discard-recovery
```

When collection fails on E2B, the engine keeps a private checkpoint and pauses the original sandbox when it can. `--recover` reconnects to that sandbox only, collects what it can, and returns a partial outcome with a recovery warning. Review it before applying. `--discard-recovery` abandons the uncollected work and releases the sandbox. Both need the host's E2B key and create no new sandbox or model work. `--recover` can exit 3 when the key is missing.

Daytona keeps no recovery checkpoint. Its sandbox is deleted at cleanup even if collection failed, so `--recover` has nothing to reconnect to.

## Options

| Option               | Effect                                                |
| -------------------- | ----------------------------------------------------- |
| `--json`             | Print the outcome and its application receipt.        |
| `--export <dir>`     | Write a self-contained bundle to a new directory.     |
| `--apply`            | Apply a pending changeset to its original workspace.  |
| `--workspace <dir>`  | Override the primary workspace for `--apply`.         |
| `--recover`          | Collect partial work from a retained E2B sandbox.     |
| `--discard-recovery` | Discard uncollected E2B work and release its sandbox. |

## Asking for files

You ask for results in plain language. The agent knows where to put them: the engine gives every run an outbox, `WORKBENCH_OUTPUT_DIR`, and tells the agent that requested reports, documents, images, screenshots, datasets, archives, exports, and downloadable files go there. Project source, configuration, and tests stay in the workspace unless you also ask for a copy.

An optional `outcome.json` in the outbox adds a summary, artifact names and descriptions, and links. A pull request link is returned data. It is not permission for the engine to push or open a pull request.

## Multi-turn sessions

After each completed turn, finished outbox files and links are snapshotted while the session stays open. A revised file produces a new snapshot; earlier snapshots keep the earlier bytes. The final outcome, with workspace changes, is collected after execution stops and before the runtime is destroyed. A resumed session gets a new outbox seeded with the latest retained copy of each file.

## Limits

Defaults: 256 MiB per file, 512 MiB of unique content per outcome, 16 MiB per outcome manifest, and 5 GiB of result storage in total. Transfers to and from E2B and Daytona sandboxes are limited to 512 MiB each way. A quota failure never silently removes retained outcomes; use `wb clean` to remove old history.
