Concepts

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.

View .md

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}. A field appears only when it has a value.

05One fails instead: needs_review

branchrush/fix-flaky-testpr_urlgithub.com/acme/web/pull/412checksbuildpassedunit testsfailedlintpassedstatusneeds_reviewwhyunit tests failed: the proof is incomplete
Scene. A run is completed only with its proof. When a check fails, it ends needs_review, never a false completed.

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 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:

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. The files the session was given are listed the same way in attachments, each with an id.

The transcript

GET …/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.

cloud.getrush.ai · run-af7b2434
A finished cloud run in the Rush console: a review agent ran the code of pull request #2500. Status completed, its model, turns, tool calls, tokens and cost, and the repository and pull request in the side panel.
A real run in the console: a review agent ran the code of pull request #2500, then reported back. Status, cost, tool calls and the PR sit beside the transcript.

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.

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 explains how this relates to what your plan charges.