返回会话元数据、嵌入的智能体快照与资源列表。事件历史与消息内容通过事件 API 获取。
前提
已完成 Endpoint 与鉴权配置,详见API 总览与认证。
接口
GET /sessions/{session_id}
请求示例
响应示例
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 会话 ID,格式 sesn_<ULID> |
type | string | 固定为 session |
status | string | 会话状态:idle / running / terminated |
stop_reason | object / null | 会话回到 idle 的原因,判别联合。null(running,或 idle 刚创建尚未产生结束原因)/ {"type":"end_turn"}(模型主动结束)/ {"type":"retries_exhausted"}(重试耗尽)/ {"type":"requires_action","pending_batch_id":"...","pending_call_ids":[...]}(等待工具审批,pending_call_ids 为待裁决调用列表)。仅在 status=idle 时用于判断交互状态;running 时为 null;terminated 是终态,客户端不应依赖其 stop_reason |
agent | object | 智能体配置完整快照(创建时锁定),含 id / version / name / model / system / tools 等 |
environment_id | string | 绑定的运行环境 ID |
title / metadata | string / object | 会话标题与业务自定义元数据 |
archived_at | string / null | 归档时间,未归档时为 null |
created_at / updated_at | string | 创建 / 最近更新时间,ISO 8601 |
request_id | string | 本次请求的唯一标识 |
environment_variables | object | 会话运行时注入的环境变量,字符串键值对,沙箱代码中可直接按名读取 |