cURL
stop_reason 取值
会话回到 idle 的原因,是一个判别联合。stop_reason 仅在 idle 时用于判断交互状态;running 时为 null;terminated 是终态,接口可能保留此前值,不应依赖或解释。
| type | 说明 | 附加字段 |
|---|---|---|
null | running,或 idle 刚创建、尚未产生结束原因 | — |
end_turn | 模型主动结束 | — |
retries_exhausted | 重试耗尽 | — |
requires_action | 等待工具审批 | pending_batch_id、pending_call_ids(均非空) |
requires_action 时用 pending_batch_id + pending_call_ids 定位当前待裁决调用,再经事件 API 拉取对应的 tool_approval_request。全部审批批次/调用 ID 均非空。
畸形对象校验失败,以下均非法:
| 示例 | 原因 |
|---|---|
{} | 缺 type |
{"type":"requires_action"} | 缺 pending_batch_id / pending_call_ids |
{"type":"requires_action","pending_call_ids":[]} | pending_call_ids 为空 |
{"type":"requires_action","pending_batch_id":"","pending_call_ids":["call_xxx"]} | 空批次 ID |
{"type":"requires_action","pending_batch_id":"b","pending_call_ids":[""]} | pending_call_ids 含空 item |
{"type":"end_turn","pending_batch_id":"b","pending_call_ids":["c"]} | 终态夹带 pending 字段 |
requires_action 必须同时含非空 pending_batch_id 与非空 pending_call_ids;其余 type 不夹带 pending 字段。鉴权
string
header
必填
DashScope API Key
路径参数
string
必填
响应
200-application/json
string
会话 ID,格式 sesn_<ULID>
string
固定为 session
enum<string>
会话状态:idle / running / terminated
idle,running,terminated
end_turn / retries_exhausted
会话回到 idle 的原因(判别联合)。详见 stop_reason 取值。仅 requires_action 携带 pending_batch_id 与非空 pending_call_ids
object
智能体配置完整快照(创建时锁定),含 id/version/name/model/system/tools 等
string
绑定的运行环境 ID
string
会话标题
object
业务自定义元数据
string | null
归档时间,未归档时为 null
string
创建时间,ISO 8601
string
最近更新时间,ISO 8601
string
本次请求的唯一标识
object
会话运行时注入的环境变量