# Results and proof

Every run ends with a record you can check: the answer, the branch and pull request, the files it saved, its transcript and what it used.

A run is finished when there is something to show for it. For code that is usually a branch and
a pull request whose checks passed. For other work it is an answer, a report or a set of files.
Rush keeps all of it on the session record, so the caller who asked can verify the work without
trusting the agent's own summary.

Read the record with [`GET /o/{org}/sessions/{session}`](/docs/api/get-session). A field appears
only when it has a value.

_Figure: proof assembles, on the page at /docs/concepts/results-and-proof._
## The answer

`result` is the agent's final answer for the last finished turn, in full. A follow-up replaces
it with the next turn's answer; [`GET …/messages`](/docs/api/get-session-messages) keeps every
turn.

The stream's `done` event carries the same answer as an object: `text`, plus `structured` and
`schema_valid`, which stay `null` for a run started with an API key. If the turn could not
finish, `error` holds a typed `code` and a `message` instead.

## Branch and pull request

A run on a repository works on its own branch. When it opens a pull request, the record names
it:

| Field | What it holds |
| --- | --- |
| `repo_owner`, `repo_name` | The repository the run cloned. |
| `branch` | The branch the agent pushed. |
| `pr_url` | The pull request it opened. |

The pull request is where the checks run. A run whose checks did not pass is not reported as
`completed`.

## Artifacts

Anything the agent saves to `/workspace/.rush/artifacts/` becomes an artifact: a report, a CSV,
a screenshot, a patch. Each entry in `artifacts` carries `name`, `mime_type`, a `url` and
`url_expires_at`.

The `url` is a signed link on `api.prix.dev` that downloads that one file with no credential for
an hour. Read the session again for a fresh one. A wrong, expired or altered link answers `404`.
With your key you can also download by name:

```bash
curl -L https://api.prix.dev/o/$ORG/sessions/$SESSION/artifacts/report.md \
  -H "Authorization: Bearer $RUSH_API_KEY" -o report.md
```

See [download one artifact](/docs/api/get-session-artifact). The files the session was given
are listed the same way in `attachments`, each with an `id`.

## The transcript

[`GET …/messages`](/docs/api/get-session-messages) returns `{execution_id, events}`: every
`message`, `tool_use`, `tool_result`, `thinking`, `error` and `result` the run produced, in order.
A `tool_use`'s command or file path is in its `args`, and its `call_id` links it to the
matching `tool_result`. In the console, a run's page also shows its tool calls, the files it
changed and the raw trajectory the harness wrote.

_Figure: console capture, on the page at /docs/concepts/results-and-proof._
## The needs_review rule

A run never reports `completed` without the proof it was asked for. When a turn ends with the
proof missing or incomplete, for example a pull request whose checks failed, its status is
`needs_review`. Treat it as "look at this before you merge", not as a failure: the work, the
branch and the transcript are all there.

A webhook reports a `needs_review` turn as `run.completed` with `data.status` set to
`needs_review`, so check `status`, not only the event type. See
[Webhooks](/docs/concepts/webhooks).

## Usage on the record

Each session carries what it used:

- `input_tokens`, `output_tokens`, `cache_read_tokens`, `cache_write_tokens`, `reasoning_tokens`
- `total_tokens`: uncached input plus cache writes plus output
- `total_cost_usd`: the model cost of the run
- `tool_calls_count` and `turns_count`
- `created_at` and `completed_at`

The counts sum across every turn. [Usage and billing](/docs/concepts/usage-and-billing) explains
how this relates to what your plan charges.
