Skip to main content
Session & Event

Create Session

Start a new session

POST
/api/v1/agentstudio/sessions
cURL
curl --request POST \
  --url 'https://{workspace_id}.{region}.maas.aliyuncs.com/api/v1/agentstudio/sessions' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "agent": "agent_xxx",
  "environment_id": "env_xxx",
  "title": "Q3 销售数据分析",
  "resources": [
    {
      "type": "file",
      "file_id": "file_xxx",
      "mount_path": "/uploads/workspace/data.csv"
    }
  ],
  "vault_ids": [
    "vlt_xxx"
  ],
  "metadata": {
    "biz_ticket_id": "1234"
  }
}
'
{
  "id": "sesn_xxx",
  "type": "session",
  "status": "idle",
  "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 销售数据分析",
  "resources": [
    {
      "id": "sesrsc_xxx",
      "type": "file",
      "file_id": "file_xxx",
      "mount_path": "/mnt/session/uploads/workspace/data.csv",
      "created_at": "2026-05-28T08:23:11Z",
      "updated_at": "2026-05-28T08:23:11Z"
    }
  ],
  "metadata": {
    "biz_ticket_id": "1234"
  },
  "archived_at": null,
  "created_at": "2026-05-28T08:23:11Z",
  "updated_at": "2026-05-28T08:23:11Z",
  "request_id": "xxx"
}

Authorizations

string
header
required

DashScope API Key

Body

application/json
string
required

绑定的智能体 ID。会话锁定智能体当前最新版本的快照

string
required

绑定的运行环境 ID

string

会话标题,便于在列表中辨识

object[]

创建时挂载的文件列表。每项含 type(固定为 file)、file_id(已上传的文件 ID)、mount_path(挂载路径,必须以 /uploads/ 开头,实际路径会加上 /mnt/session 前缀)

string[]

Vault ID 列表。将指定 Vault 中的 Credential 注入会话运行环境,使智能体可访问对应密钥

object

业务自定义键值,不影响模型行为

Response

200-application/json
string

会话 ID,格式 sesn_<ULID>

string

固定为 session

enum<string>

会话状态:idle / running / terminated。新建会话为 idle

idle,running,terminated
object

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

string

绑定的运行环境 ID

string

会话标题

object[]

挂载的文件列表

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