Skip to main content
An outcome is a session’s definition of done: an objective and a rubric. Each time the agent finishes its work, an independent grader checks it against every criterion in the rubric and either accepts it or sends the agent back with the failed criteria and the reasons. Use outcomes when “the agent stopped” is not proof enough that the work is right. A session with an outcome only reports execution_state completed after the grader accepts the work. The TypeScript samples assume the rl client from Client setup.

Before you begin

  • You need the organization developer or admin role to start a session or add an outcome to one. The organization user role can read outcomes and grading results. See Organizations and roles and API keys.
  • You need an agent and an environment. See Agents and Environments.
  • Decide what the agent must produce. If it is a file, pick its name now (for example release-notes.md). You will use that name in the task and in the rubric.

How grading works

  1. The agent works until it ends a turn with nothing queued. That is its claim that the work is done. A turn you stop with an interrupt or a cancel is not graded.
  2. Deliverables the agent saved are kept, then the grader starts a grading pass. The grader is a separate model run on the session’s model, with its own context. It sees the objective and the rubric, never the agent’s reasoning. It works in the same sandbox with the same tools and credentials, so it can open files, run the project’s tests, and check external systems the agent changed.
  3. The grader gives each criterion exactly one verdict. The result of the pass is computed from those verdicts, not chosen by the grader: one fail is enough to send the work back.
  4. On needs_revision, the agent receives the full scorecard, with a reason for every failed criterion, and starts another turn. Then step 1 repeats.
What success means: the outcome’s status is terminal with terminal_result satisfied, and the session’s execution_state is completed with stop_reason outcome_satisfied. Nothing else marks a graded session as completed.

Write a rubric

A rubric is Markdown. The grader owes a verdict on every list item and on nothing else. Write each criterion on one line. A wrapped second line is read as a paragraph, so the criterion loses that text.
This rubric has five criteria in three sections. The two paragraphs tell the grader how to find the range and who reads the notes. All criteria count the same. You cannot set weights (every criterion reports weight: 1), and a strong result on one criterion never offsets a failure on another. not_applicable does not count as a failure.

Name the deliverable

Only files the agent saves under /workspace/.managed-agents/outputs are kept as deliverables. Files anywhere else, including paths you invent in a prompt, are not kept. Agents already know where to save deliverables, so you do not need to give a path. Name the file in the task and in the rubric, for example “Save the notes as release-notes.md” and ”- The notes are saved as a deliverable named release-notes.md.” Deliverables are saved before every grading pass, so the grader checks the version the agent just finished. See Deliverables and artifacts.
  • Make each criterion checkable on its own. “The CSV has a numeric price column” can be checked. “The data looks good” cannot, and a criterion like that causes revision loops that do not end.
  • Give one requirement to each list item. When one item holds two requirements, a failure does not say which one the work missed.
  • Put facts the agent needs where it can see them. The agent sees the objective and the criteria, not the paragraphs. Put background in the task message.
  • Start from a good example. Ask a model what makes a known-good result good, and turn the answer into criteria.
  • Cap a new rubric. Set max_iterations until you know the rubric can be met. A criterion that can never pass keeps an uncapped session revising.
  • Keep the text stable. Criterion ids stay the same only while the rubric text is identical. See Follow a criterion across sessions.

Outcome fields

These fields go in outcome on startSession, or in the body of defineSessionOutcome. To keep a long or shared rubric in one place, upload it as a text or YAML file of up to 256 KiB and send rubric_ref instead of rubric. Its text is read once, when the outcome is defined, and returned as the outcome’s rubric, so later edits to the file don’t change a running session. An unknown or expired file returns 404; a file that isn’t UTF-8 text, is too large, or holds no criterion returns 400.

Start a session with an outcome

Send outcome in the start request. Grading is on from the first turn.
  1. Open the agent and click Start session, or click Launch session on the Sessions tab.
  2. In Launch a session, choose the Agent and Environment.
  3. Under Task, select Grade this session against a rubric.
  4. Write the criteria in Rubric.
  5. Write the task in Opening message. The console sends it as the objective.
  6. Click Launch session.
The console never sets a cap, so the session revises until the rubric is satisfied.
The API answers 202 Accepted. The session is accepted, not finished. Keep session_id to read the grading.
With max_iterations: 4, the grader runs at most four passes, so the agent gets up to three revisions.

Choose the message and the objective

message and outcome.description are separate. The agent starts from the message. The grader measures against the objective and never sees the message. Use the message for facts the agent needs that are not part of the bar, such as where the repository is. Keep the two consistent. If they disagree, the agent works toward one target and is graded against another. The agent can see the objective and the criteria for the whole session, not just in its first turn.

Grade every session of an agent

Store a rubric on the agent as default_rubric to grade every session started from it. In the console, the field is Default rubric in the Outcome section of the agent’s Configuration tab. Through the API, send default_rubric on createAgent or createAgentVersion. It must have 1 to 200 criteria. See Agents. In Launch a session, an agent with a default rubric has Grade this session against a rubric selected and shows the stored rubric. Clear the box to run ungraded. An edit in the form applies to that session only and gives its criteria new ids.

Add an outcome to a running session

Call defineSessionOutcome to grade a session that started without an outcome, or to set the next objective after an outcome ended. The body has the same fields as outcome. There is no console action for this. A session runs one outcome at a time. While an outcome is not terminal, a second one is rejected.
The response is the stored outcome. Some fields are omitted.
The new objective and criteria join the agent’s instructions, and a message naming the objective appears in the transcript. Defining an outcome does not start a turn by itself. If the session is idle, send a message so the agent starts working toward it. See Session operations.

Read the grading

listSessionOutcomes returns every outcome of a session, oldest first, each with all of its grading passes.
  1. On the Sessions tab, open the session.
  2. Read the Outcome line above the transcript: the current result, the number of unmet criteria, and the start of the objective.
  3. Click Details to see the objective, the cap (revises until satisfied, or at most N revisions where N is max_iterations), the Rubric, and one block per pass, newest first (Pass 1 is the first pass). Each pass shows its result, how many criteria were met, its cost and tokens, and every criterion with its verdict. A failed criterion also shows the grader’s reason.
In this response, the first pass sent the work back and the second accepted it. Some fields are omitted.
When a session has no outcome, outcomes is null. Each pass also writes an outcome_evaluation event to the session, so you can follow the loop live on the event stream.

Results and statuses

Every result except needs_revision is final, and becomes the outcome’s terminal_result. If the grader cannot produce a usable verdict, the session goes idle with stop_reason grader_failed. The work is not marked as failed and the outcome stays open. Send a message to continue; the next time the agent finishes, grading runs again. After a final result, the session still accepts follow-up messages. Those turns are not graded. To grade more work, add a new outcome.

Follow a criterion across sessions

A criterion id looks like r3fa91c07b2de.c001. The first part identifies the rubric and the last part is the criterion’s position in it. The ids are stable: the same rubric text gives the same ids in every session, so you can track how one criterion fares across runs and agent versions. Any edit to the rubric, even a typo fix, gives every criterion a new id. A default rubric stored on the agent keeps its ids for as long as you do not change it.

Cost of grading

Each grading pass is a model run with its own tokens, and its cost is counted like the agent’s own work. Every pass reports its cost_micros and token counts. Grading passes are child sessions of the graded session, so their cost appears in the subtree and tree scopes of the model-cost reads, not in self. See Usage and cost. To keep grading costs down, write criteria the grader can check quickly, and set max_iterations on rubrics you have not tested yet. An uncapped outcome whose rubric can never pass keeps revising and grading.

What can go wrong

The full list of codes is in Errors.

Limits

Other limits are on Limits.

Next steps

Deliverables and artifacts

Ask for named deliverables the grader can check.

Events

Follow each grading pass live and read what the grader did.

Agents

Store a default rubric so every session is graded.

Usage and cost

See what the agent and the grader cost.