返回会话元数据、嵌入的智能体快照与资源列表。事件历史与消息内容通过事件 API 获取。
前提
已完成 Endpoint 与鉴权配置,详见API 总览与认证。
接口
GET /sessions/{session_id}
请求示例
响应字段响应为 Session 对象。字段如下:idstring会话 ID,格式 sesn_<ULID>type string固定为 sessionstatus string会话状态:idle / running / terminatedstop_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_reasonagent object智能体配置完整快照,含 id / version / name / model / system / tools 等;会话级覆盖(若已设置)已并入快照environment_id string绑定的运行环境 IDsandbox object沙箱快照持久化配置与当前快照状态;未配置时省略
属性 enable_snapshot boolean当前 Session 是否开启快照持久化snapshot_persistent_seconds integer单份快照配置的保留时间,单位秒;未配置时不返回is_persisting boolean当前 Session 是否正在保留可用快照;尚未取得统计时可能不返回predict_release_time string / null当前快照预计释放时间,ISO 8601 UTC;没有当前快照时为 nullobject沙箱快照时长统计。创建响应中可能省略;已开启快照但尚未生成快照时,内部时长字段为 null。
属性 session_total_persisted_hours integer / null历史快照累计保留小时数;尚无统计时为 nulllatest_snapshot_persisted_hours integer / null当前最新快照已保留小时数;没有当前快照时为 nullstring / object会话标题与业务自定义元数据archived_at string / null归档时间,未归档时为 nullcreated_at / updated_at string创建 / 最近更新时间,ISO 8601request_id string本次请求的唯一标识environment_variables object会话运行时注入的环境变量,字符串键值对,沙箱代码中可直接按名读取vault_ids array of string绑定的 Vault ID 列表mcp_configs array of object会话级 MCP 请求头,每项含 mcp_server_name 与 headers;未配置时为空数组 | 响应示例 |