跳转到内容
EN

提交运行反馈

先调用「创建会话」,用返回的会话 ID 替换示例 ID。

POST/agent/v1/sessions/{session_id}/runs/{run_id}/feedback● 支持

请求参数

  • session_idstring必填

    path: Session id from session creation or listing.

  • run_idstring必填

    path: Existing run_id from this session's events.

  • ratingstring必填

    positive means thumbs up; negative means thumbs down for this run.

    取值 positivenegative
  • commentstring可选

    可选备注,最多 2000 个 Unicode 字符。省略或传 null 清除之前的备注。

返回

200

自有扩展。会话须可读,run_id 来自该会话的事件。每次提交覆盖此前评分和评论;省略评论或传 null 会清空评论,创建时间保持不变。评论最多 2000 个 Unicode 字符。终端用户仅能提交自己会话的反馈。反馈不进入模型上下文,不触发运行。

错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码

请求示例

curl
# 先调用「创建会话」,用返回的会话 ID 替换示例 ID。
curl https://api.deepraxis.com/agent/v1/sessions/sesn_123/runs/run_123/feedback \
  -H "Authorization: Bearer $PRAXIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"rating":"positive"}'
Python
# 先调用「创建会话」,用返回的会话 ID 替换示例 ID。
import requests

opts = dict(
    base_url="https://api.deepraxis.com/agent",
    api_key="$PRAXIS_API_KEY",
)

# /agent 是我们自己的 Managed Agents 形状,直接发 HTTP 请求(Bearer 认证)
resp = requests.post(
    f"{opts['base_url']}/v1/sessions/sesn_123/runs/run_123/feedback",
    headers={"Authorization": f"Bearer {opts['api_key']}"},
    json={"rating":"positive"},
)
print(resp.status_code, resp.json())
TypeScript
// 先调用「创建会话」,用返回的会话 ID 替换示例 ID。
const opts = {
  baseURL: "https://api.deepraxis.com/agent",
  apiKey: "$PRAXIS_API_KEY",
};

// /agent 是我们自己的 Managed Agents 形状,直接发 HTTP 请求(Bearer 认证)
const resp = await fetch(`${opts.baseURL}/v1/sessions/sesn_123/runs/run_123/feedback`, {
  method: "POST",
  headers: { Authorization: `Bearer ${opts.apiKey}`, "Content-Type": "application/json" },
  body: JSON.stringify({"rating":"positive"}),
});
console.log(resp.status, await resp.json());

响应示例 200

{
  "type": "run_feedback",
  "session_id": "sesn_f35fc2a9d8bc4d4a94a69b117f5280ff",
  "run_id": "run_56733f9e-cf5f-45a4-93cb-54ce00721853",
  "rating": "positive",
  "comment": null,
  "created_at": "2026-10-22T15:30:32.127Z",
  "updated_at": "2026-10-22T15:30:32.127Z"
}

响应

HTTP 200

Current feedback after replacing any previous submission.

application/json

名称 类型 说明
type string Identifies a run feedback resource.
session_id string Public session identifier from session creation or listing.
run_id string Run identifier from a session event's run_id.
rating string positive is thumbs up; negative is thumbs down.
comment string | null Submitted comment, or null when cleared.
created_at string First feedback creation time in RFC 3339 format; unchanged on replacement.
updated_at string Latest feedback submission time in RFC 3339 format.

运行示例前

先创建会话并发送一条消息。从该会话事件的 run_id 取得真实运行 ID,替换 run_123;不得使用部署运行的 drun_ ID。示例会话与运行必须属于同一会话。