智能体

列出会话

列出会话。使用当前 API Key 所属工作区的资源。

GET /agent/v1/sessions◐ 部分支持

Claude 官方文档 ↗

请求参数

  • agent_idstring可选

    query: Return only sessions created with this agent id (from agents.list or agents.create). This is one of the three filters sessions.list supports.

  • agent_versionnumber可选

    query: 按智能体版本过滤;仅在同时设置 agent_id 时生效。

  • created_at[gt]string可选

    query: Exclusive created-at lower bound for sessions. Declared by the Managed Agents shape but not supported here; sending it returns 400.

  • created_at[gte]string可选

    query: Created-at lower bound for sessions. Declared by the Managed Agents shape but not supported here: sessions.list honors only limit, page and agent_id, and other filters return 400.

  • created_at[lt]string可选

    query: Exclusive created-at upper bound for sessions. Declared by the Managed Agents shape but not supported here; sending it returns 400.

  • created_at[lte]string可选

    query: Created-at upper bound for sessions. Declared by the Managed Agents shape but not supported here: sessions.list honors only limit, page and agent_id, and other filters return 400.

  • deployment_idstring可选

    query: Declared by the Managed Agents shape but not supported by sessions.list; sending it returns 400.

  • include_archivedboolean可选

    query: Declared by the Managed Agents shape but not supported by sessions.list; sending it returns 400. Archived sessions are retrievable by id.

  • memory_store_idstring可选

    query: Declared by the Managed Agents shape but not supported by sessions.list; sending it returns 400.

  • orderstring可选

    query: 按创建时间排序:asc 从旧到新,desc 从新到旧(默认)。

  • ▸ 更多参数(3)
    • statusesarray可选

      query: 按会话状态过滤,可重复该参数匹配多种状态。

    • limitnumber可选

      query: Number of items per page.

    • pagestring可选

      query: Opaque pagination cursor: pass the next_page value of the previous response unchanged. Omit it for the first page. A cursor from a different query or a malformed one returns 400.

返回

200

支持 limit、page 与 agent_id;agent_version、时间范围、deployment_id、memory_store_id、include_archived、order、statuses 尚不支持,传入返回 400。

错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>Items of this page, in the order requested by the call.
data[].idstringSession id (sesn_...). Pass it as session_id in every session call.
data[].agentobjectResolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.
data[].archived_atnull | stringA timestamp in RFC 3339 format
data[].budgetnull | objectA hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.
data[].created_atstringA timestamp in RFC 3339 format
data[].environment_idstringId of the environment recipe the session's sandbox was created from. Omitted when no recipe was selected, that is, for a light machine or the Computer chosen by computer_id.
data[].metadataobjectFree-form string key/value pairs stored with the session, changed through sessions.update patch semantics.
data[].outcome_evaluationsarray<object>Per-outcome evaluation state. One entry per `define_outcome` event sent to the session.
data[].resourcesarray<object>Resources attached to the session, at most 500; each is a file reference mounted into the session's machine.
data[].statsobjectTiming statistics for a session.
data[].statusstringSessionStatus enum - `rescheduling` - Transient error occurred, retrying automatically. - `running` - Agent is actively executing. - `idle` - Agent is waiting for input, including user messages or tool confirmations. Sessions start in idle. - `terminated` - Session has ended, either due to an error or completion.
data[].titlenull | stringTitle of the session, set on create or through sessions.update; null when none was set.
data[].typestringAlways `session`. A session, one conversation of an agent on a machine.
data[].updated_atstringA timestamp in RFC 3339 format
data[].usageobjectCumulative token usage for a session across all turns.
data[].vault_idsarray<string>Vault IDs attached to the session at creation. Empty when no vaults were supplied.
data[].deployment_idnull | stringDeployment ID when the session was created from a deployment reference. Null otherwise.
data[].cwdstringNormalized session working directory; defaults to /home/user/workspace. Forks inherit this directory.
data[].computer_idstringPraxis extension: MA only has session-scoped temporary containers and memory_stores, not durable browsable computers. computer_id selects a tenant-owned active computer. Session selection overrides the agent default; a sandbox environment_id and computer_id cannot be combined. Omitted when no computer is selected.
data[].modelobject扩展 / Praxis extension: the currently selected session model.
data[].thinkingobject | nullPraxis extension: explicit session thinking effort; null inherits the pinned agent default, then the model default. none disables thinking only when model.thinking.can_disable is true. Unsupported efforts return 400 invalid_request_error.
data[].forked_fromobject | nullPraxis extension: source of a forked session; null for other sessions. Available only on /agent/v1.
next_pagestring | nullOpaque cursor for the next page: pass it unchanged as page to continue. Null when this is the last page.