Outcomes

更新时间:
复制 MD 格式

Outcomes let you define explicit success criteria (a Rubric) for an Agent. The Agent iterates on its work until the Rubric is satisfied.

Core Concepts

Term

Description

Outcome

The expected final result of a task

Rubric

The success-criteria text the Agent uses to judge its own output

To set a quality bar for Agent output, send the Rubric to the Session via a user.define_outcome event. The Agent references these criteria throughout its work.

Event Format

{
  "events": [
    {
      "type": "user.define_outcome",
      "rubric": "The generated report must include: 1) an executive summary under 200 words, 2) at least 3 actionable recommendations, 3) sources cited."
    }
  ]
}

Field Reference

Field

Type

Required

Description

type

string

Yes

Fixed value user.define_outcome

rubric

string

Yes

Success criteria text

Typical Usage

  1. Create a Session and send the initial message.

  2. Send user.define_outcome with the Rubric to define success.

  3. The Agent iterates against the Rubric.

  4. Inspect the output once you receive session.status_idle.

Make Rubrics specific and measurable. Avoid vague language like "make it better"; use criteria like "code coverage no less than 80%".

curl Example

# Send an Outcome definition to an existing Session
curl -X POST https://api.qoder.com.cn/api/v1/cloud/sessions/sess_019e392c0d1e74e095d21ea4c6b41def/events \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Content-Type: application/json" \
  -d '{
    "events": [
      {
        "type": "user.define_outcome",
        "rubric": "Refactored function: 1) all unit tests pass, 2) cyclomatic complexity <= 10, 3) no lint warnings."
      }
    ]
  }'

Successful Response (202 Accepted)

{
  "data": [
    {
      "id": "evt_019e4a1b2c3d4e5f6a7b8c9d0e1f2a3b",
      "type": "user.define_outcome",
      "rubric": "Refactored function: 1) all unit tests pass, 2) cyclomatic complexity <= 10, 3) no lint warnings.",
      "session_id": "sess_019e392c0d1e74e095d21ea4c6b41def",
      "schema_version": "1.0",
      "created_at": "2026-05-18T16:00:00.000Z",
      "processed_at": "2026-05-18T16:00:00.000Z"
    }
  ]
}

Outcomes vs. Regular Messages

Dimension

user.message

user.define_outcome

Purpose

Send a conversational message

Define success criteria

Triggered behavior

The Agent replies

The Agent iterates against the criteria

Key field

content

rubric

Timing

Any time

Typically before or alongside the initial task

Best Practices

  • Send the Outcome before or alongside the task instructions (user.message).

  • Use a numbered list in the Rubric so the Agent can verify items individually.

  • For complex tasks, break the Rubric into multiple measurable acceptance criteria.

  • Keep the Rubric under 500 words.