Skip to main content
Session & Event

Get Session

Retrieve details for a specified session

GET
/api/v1/agentstudio/sessions/{session_id}
cURL
curl --request GET \
  --url 'https://{workspace_id}.{region}.maas.aliyuncs.com/api/v1/agentstudio/sessions/{session_id}' \
  --header 'Authorization: Bearer <YOUR_API_KEY>'
{
  "id": "sesn_xxx",
  "type": "session",
  "status": "idle",
  "stop_reason": {
    "type": "requires_action",
    "pending_batch_id": "response_xxx:9f2c...",
    "pending_call_ids": [
      "call_xxx"
    ]
  },
  "agent": {
    "id": "agent_xxx",
    "type": "agent",
    "version": 1,
    "name": "data-analyst",
    "description": null,
    "model": {
      "id": "qwen3-max"
    },
    "system": "你是数据分析专家,使用 pandas 处理 CSV 文件。",
    "tools": []
  },
  "environment_id": "env_xxx",
  "title": "Q3 销售数据分析",
  "metadata": {
    "biz_ticket_id": "1234"
  },
  "archived_at": null,
  "created_at": "2026-05-28T08:23:11Z",
  "updated_at": "2026-05-28T08:23:25Z",
  "request_id": "xxx"
}

Authorizations

string
header
required

DashScope API Key

Path Parameters

string
required

Response

200-application/json
string

会话 ID,格式 sesn_<ULID>

string

固定为 session

enum<string>

会话状态:idle / running / terminated

idle,running,terminated
end_turn / retries_exhausted

会话回到 idle 的原因,是一个判别联合:null(running,或 idle 刚创建、尚未产生结束原因)| end_turn(模型主动结束)| retries_exhausted(重试耗尽)| requires_action(等待工具审批)。stop_reason 仅在会话状态为 idle 时用于判断交互状态:running 时为 null;terminated 是终态,接口可能保留此前值,客户端不应依赖或解释。仅 requires_action 分支携带 pending_batch_id 与非空 pending_call_ids;客户端据此还原审批卡片:用 pending_batch_id + pending_call_ids 定位当前待裁决调用,再通过事件 API 拉取对应的 tool_approval_request。畸形对象应校验失败,例如 {}、{"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 字段)均非法。全部审批批次/调用 ID 均非空(minLength: 1)

object

智能体配置完整快照(创建时锁定),含 id/version/name/model/system/tools 等

string

绑定的运行环境 ID

string

会话标题

object

业务自定义元数据

string | null

归档时间,未归档时为 null

string

创建时间,ISO 8601

string

最近更新时间,ISO 8601

string

本次请求的唯一标识

Overview
Sandbox API
Memory API
Flow Agent API
RAG API
Connector API
Framework Integration
Assistant API (Deprecating)
  • Overview