跳转到内容
EN

列出会话

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

Claude 官方文档 ↗

请求参数

  • agent_idstring可选

    query: 仅返回由此智能体 ID 创建的会话(ID 取自 agents.list 或 agents.create)。同时传 deployment_id 可进一步限定来源部署。

  • agent_versionnumber可选

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

  • created_at[gt]string可选

    query: 会话创建时间下界(不含边界)。Managed Agents 形状声明了此字段,但此处不支持;发送返回 400。

  • created_at[gte]string可选

    query: 会话创建时间下界。Managed Agents 形状声明了此字段,但此处不支持:sessions.list 仅接受 limit、page、agent_id、deployment_id 和 include_archived,其他筛选返回 400。

  • created_at[lt]string可选

    query: 会话创建时间上界(不含边界)。Managed Agents 形状声明了此字段,但此处不支持;发送返回 400。

  • created_at[lte]string可选

    query: 会话创建时间上界。Managed Agents 形状声明了此字段,但此处不支持:sessions.list 仅接受 limit、page、agent_id、deployment_id 和 include_archived,其他筛选返回 400。

  • deployment_idstring可选

    query: 仅返回由此部署 ID(depl_...)创建的会话,ID 由 deployments.create 或 deployments.list 返回。

  • include_archivedboolean可选

    query: 是否列出已归档会话:true 包含,false(默认)隐藏。其他值返回 400。无论取值如何,已归档会话仍可按 ID 读取。

  • memory_store_idstring可选

    query: Managed Agents 形状声明了此字段,但 sessions.list 不支持;发送返回 400。

  • orderstring可选

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

  • 更多参数 (5)
    • statusesarray可选

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

    • limitnumber可选

      query: Number of items per page.

    • pagestring可选

      query: 不透明分页游标:原样传入上一响应的 next_page 值。第一页省略。来自不同查询或格式错误的游标返回 400。

    • external_user_idstring可选

      query: 按终端用户标识精确筛选(1–128 个字符:A-Z、a-z、0-9、下划线、点、冒号、@ 或连字符)。跟随 page 分页时保持此筛选不变。

    • sourcestring可选

      query: 按会话来源筛选:kit、iframe、hosted、api 或 automation。跟随 page 分页时保持此筛选不变。

      取值 kitiframehostedapiautomation

返回

200

支持 limit、page、agent_id、deployment_id 与 include_archived(默认 false:已归档会话不出现在列表中,传 true 才包含);agent_version、时间范围、memory_store_id、order、statuses 尚不支持,传入返回 400。

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

请求示例

curl
curl https://api.deepraxis.com/agent/v1/sessions \
  -H "Authorization: Bearer $PRAXIS_API_KEY"
Python
import requests

opts = dict(
    base_url="https://api.deepraxis.com/agent",
    api_key="$PRAXIS_API_KEY",
)

# /agent 是我们自己的 Managed Agents 形状,直接发 HTTP 请求(Bearer 认证)
resp = requests.get(
    f"{opts['base_url']}/v1/sessions",
    headers={"Authorization": f"Bearer {opts['api_key']}"},
)
print(resp.status_code, resp.json())
TypeScript
const opts = {
  baseURL: "https://api.deepraxis.com/agent",
  apiKey: "$PRAXIS_API_KEY",
};

// /agent 是我们自己的 Managed Agents 形状,直接发 HTTP 请求(Bearer 认证)
const resp = await fetch(`${opts.baseURL}/v1/sessions`, {
  headers: { Authorization: `Bearer ${opts.apiKey}` },
});
console.log(resp.status, await resp.json());

响应示例 200

{
  "data": [
    {
      "id": "sesn_c9b6077486644badbfc0694a2d224abc",
      "type": "session",
      "agent": {
        "id": "agent_7838e080-8ac6-471d-887c-a7595de1afcb",
        "type": "agent",
        "name": "文档助手(已更新)",
        "description": null,
        "system": "用一句话简短回答。",
        "model": {
          "id": "deepseek-flash"
        },
        "version": 2,
        "tools": [],
        "skills": [],
        "mcp_servers": [],
        "multiagent": null
      },
      "environment_id": "env_deepraxis_text_v1",
      "time_zone": "UTC",
      "title": "文档测试",
      "metadata": {},
      "created_at": "2026-09-29T08:30:16.285Z",
      "updated_at": "2026-09-29T08:30:18.412Z",
      "archived_at": null,
      "status": "idle",
      "usage": {
        "input_tokens": 0,
        "output_tokens": 0,
        "cache_read_input_tokens": 0,
        "list_cost": null
      },
      "stats": {},
      "budget": null,
      "resources": [],
      "vault_ids": [],
      "outcome_evaluations": [],
      "deployment_id": null
    }
  ],
  "next_page": null,
  "prev_page": null
}

响应

HTTP 200

Successful response

application/json

名称 类型 说明
data array<object> Items of this page, in the order requested by the call.
data[].id string Session id (sesn_...). Pass it as session_id in every session call.
data[].agent object Resolved agent definition for a session. Snapshot of the agent at session creation time.
data[].archived_at null | string A timestamp in RFC 3339 format
data[].budget null | object A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches max_list_cost.
data[].created_at string A timestamp in RFC 3339 format
data[].environment_id string Execution environment of this session. A service session created without environment_id uses the default environment saved in the agent version (light for a new agent); null means it was created without a machine; Computer sessions may omit this field.
data[].metadata object Free-form string key/value pairs stored with the session, changed through sessions.update patch semantics.
data[].outcome_evaluations array<object> Per-outcome evaluation state. One entry per define_outcome event sent to the session.
data[].resources array<object> Resources attached to the session, at most 500; each is a file reference mounted into the session's machine.
data[].stats object Timing statistics for a session.
data[].status string SessionStatus 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[].title null | string Title of the session, set on create or through sessions.update; null when none was set.
data[].type string Always session. A session, one conversation of an agent on a machine.
data[].updated_at string A timestamp in RFC 3339 format
data[].usage object Cumulative token usage for a session across all turns.
data[].vault_ids array<string> Vault IDs attached to the session at creation. Empty when no vaults were supplied.
data[].deployment_id null | string Deployment ID when the session was created from a deployment reference. Null otherwise.
data[].cwd string Normalized session working directory; defaults to /home/user/workspace. Forks inherit this directory.
data[].workspace object Praxis extension: where this session's work happens. shared and isolated are the two kinds; an isolated session also names its path and branch.
data[].computer_id string Praxis 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[].model object Praxis extension: the currently selected session model.
data[].thinking object | null Praxis 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_from object | null Praxis extension: source of a forked session; null for other sessions. Available only on /agent/v1.
data[].external_user_id string | null End-user identifier associated with the session, or null when none is recorded. Own-face extension; use external_user_id on sessions.list to find this user's sessions.
data[].source string | null Origin of the session: kit, iframe, hosted, api or automation; null when unavailable. Own-face extension; use source on sessions.list to filter by origin.
next_page string | null Opaque cursor for the next page: pass it unchanged as page to continue. Null when this is the last page.