获取 /api/v1/projects/{id}/sessions

列出项目中每个工作区的持久性对话会话,最近活跃的会话排在前面。这些会话包含消息和执行运行。它们与运行时会话分开,后者追踪保留的沙箱容量。要获取下一页,请将响应中的 next_cursor 作为游标传递。

路径参数

  • id 字符串 必需

    项目 ID

查询参数

  • limit 整型

    最大结果数(默认50,最大 200)

  • Workspace_id 字符串

    限制为单个工作区

  • 状态 字符串

    按会话的最新执行状态筛选

  • since 字符串

    仅限在此 RFC3339 时间或之后有活动的会话

  • 直到 字符串

    仅此 RFC3339 时间之前有活动的会话

  • cursor 字符串

    来自上一个响应的 next_cursor 的不透明分页令牌

响应

  • 不支持或格式不正确的API版本、所选已发布合约中不可用的操作或不可接受的表示形式(包括不支持的媒体类型参数或排除的 SSE)。现有的身份验证、授权和速率限制失败优先。

    隐藏响应属性 显示响应属性 对象
    • badRequestDetail 对象

      标准错误模式定义的可选验证详细信息; API协商错误不会发出此字段。

      隐藏 BadRequestDetail 属性 显示 BadRequestDetail 属性 对象
      • 字段 大量[对象]

        验证失败的字段。

        隐藏字段属性 显示字段属性 对象

        字段及其验证失败。

        • 描述 字符串 必需

          人类可读的验证失败。

        • 字段 字符串 必需

          无效请求字段的名称或路径。

    • 详细信息 字符串 必需

      人类可读的错误详细信息。

    • 错误 整型 必需

      HTTP status code.

    • 错误代码 字符串 必需

      机器可读的错误代码。

    • 参数 array[string]

      与错误相关的请求参数名称;不应用时省略。

    • 原因 字符串 必需

      HTTP状态原因短语。

    隐藏响应属性 显示响应属性 对象
    • badRequestDetail 对象

      标准错误模式定义的可选验证详细信息; API协商错误不会发出此字段。

      隐藏 BadRequestDetail 属性 显示 BadRequestDetail 属性 对象
      • 字段 大量[对象]

        验证失败的字段。

        隐藏字段属性 显示字段属性 对象

        字段及其验证失败。

        • 描述 字符串 必需

          人类可读的验证失败。

        • 字段 字符串 必需

          无效请求字段的名称或路径。

    • 详细信息 字符串 必需

      人类可读的错误详细信息。

    • 错误 整型 必需

      HTTP status code.

    • 错误代码 字符串 必需

      机器可读的错误代码。

    • 参数 array[string]

      与错误相关的请求参数名称;不应用时省略。

    • 原因 字符串 必需

      HTTP状态原因短语。

  • 200

    正常

    隐藏响应属性 显示响应属性 对象
    • has_more 布尔
    • limit 整型
    • next_cursor 字符串

      NextCursor 是一个不透明的词元,作为 cursor查询参数传回;如果此页面是最后一页,则为 nil。不透明,因此分页位置可以在不中断客户端的情况下改变形状,与此网关上其他被分页端点已使用的约定相匹配。

    • 会话 大量[对象]
      隐藏会话属性 显示会话属性 对象
      • active_duration_ms 整型

        ActiveDurationMS 会对每次运行自身经过的时间求和,因此它与会话的运行端点报告的每次运行持续时间一致,但不包括轮次之间的间隔。来自早于它的编排引擎的零。

      • created_at 字符串
      • first_message_preview 字符串
      • last_action 字符串
      • latest_status 字符串

        LastStatus 是会话最近执行的状态。

      • PROJECT_ID 字符串
      • session_id 字符串
      • total_duration_ms 整型

        TotalDurationMS 是从会话首次执行到最后一次活动之间的挂钟经过的时间,因此它包括轮次之间的空闲时间。

      • total_tokens 整型

        TotalTokens 是一个下限:它对通过 OE 路由的 LLM 调用记录的每次调用计数求和,不包括内存提取令牌。

      • 原来 整型
      • user_id 字符串
      • 可见性 字符串
      • wait_ms 整型

        WaitMS 计算会话运行中已解决的人工审核等待时间的总和,以及当前暂停的窗口迄今为止打开的窗口。来自早于它的编排引擎的零。

      • Workspace_id 字符串
    • total_count 整型

      TotalCount 是与过滤匹配的会话数。仅出现在第一页上:计算它意味着获取每个匹配项,这正是游标机制要避免的,并且它不能在中途更改。

    • truncated 布尔
    隐藏响应属性 显示响应属性 对象
    • has_more 布尔
    • limit 整型
    • next_cursor 字符串

      NextCursor 是一个不透明的词元,作为 cursor查询参数传回;如果此页面是最后一页,则为 nil。不透明,因此分页位置可以在不中断客户端的情况下改变形状,与此网关上其他被分页端点已使用的约定相匹配。

    • 会话 大量[对象]
      隐藏会话属性 显示会话属性 对象
      • active_duration_ms 整型

        ActiveDurationMS 会对每次运行自身经过的时间求和,因此它与会话的运行端点报告的每次运行持续时间一致,但不包括轮次之间的间隔。来自早于它的编排引擎的零。

      • created_at 字符串
      • first_message_preview 字符串
      • last_action 字符串
      • latest_status 字符串

        LastStatus 是会话最近执行的状态。

      • PROJECT_ID 字符串
      • session_id 字符串
      • total_duration_ms 整型

        TotalDurationMS 是从会话首次执行到最后一次活动之间的挂钟经过的时间,因此它包括轮次之间的空闲时间。

      • total_tokens 整型

        TotalTokens 是一个下限:它对通过 OE 路由的 LLM 调用记录的每次调用计数求和,不包括内存提取令牌。

      • 原来 整型
      • user_id 字符串
      • 可见性 字符串
      • wait_ms 整型

        WaitMS 计算会话运行中已解决的人工审核等待时间的总和,以及当前暂停的窗口迄今为止打开的窗口。来自早于它的编排引擎的零。

      • Workspace_id 字符串
    • total_count 整型

      TotalCount 是与过滤匹配的会话数。仅出现在第一页上:计算它意味着获取每个匹配项,这正是游标机制要避免的,并且它不能在中途更改。

    • truncated 布尔
  • Bad Request

    隐藏响应属性 显示响应属性 对象
    • 代码 字符串
    • 错误 字符串
    • Success 布尔
    隐藏响应属性 显示响应属性 对象
    • 代码 字符串
    • 错误 字符串
    • Success 布尔
  • Unauthorized

    隐藏响应属性 显示响应属性 对象
    • 代码 字符串
    • 错误 字符串
    • Success 布尔
    隐藏响应属性 显示响应属性 对象
    • 代码 字符串
    • 错误 字符串
    • Success 布尔
  • 内部服务器错误

    隐藏响应属性 显示响应属性 对象
    • 代码 字符串
    • 错误 字符串
    • Success 布尔
    隐藏响应属性 显示响应属性 对象
    • 代码 字符串
    • 错误 字符串
    • Success 布尔
  • 错误网关

    隐藏响应属性 显示响应属性 对象
    • 代码 字符串
    • 错误 字符串
    • Success 布尔
    隐藏响应属性 显示响应属性 对象
    • 代码 字符串
    • 错误 字符串
    • Success 布尔
GET /api/v1/projects/{id}/sessions
curl \
 --request GET 'https://agentengine.mongodb.com/api/v1/projects/{id}/sessions' \
 --header "Authorization: $API_KEY"
响应示例 (406)
{
  "detail": "This operation is not available in API version 2026-09-20-preview.",
  "error": 406,
  "errorCode": "OPERATION_NOT_IN_API_VERSION",
  "parameters": [
    "Accept"
  ],
  "reason": "Not Acceptable"
}
{
  "detail": "This operation supports text/event-stream, which the Accept header excludes. Remove unsupported media-type parameters or accept this type with a positive q value.",
  "error": 406,
  "errorCode": "UNACCEPTABLE_MEDIA_TYPE",
  "parameters": [
    "Accept"
  ],
  "reason": "Not Acceptable"
}
{
  "detail": "The requested API version is not supported. Supported versions: 2026-09-20-preview.",
  "error": 406,
  "errorCode": "UNSUPPORTED_API_VERSION",
  "parameters": [
    "Accept"
  ],
  "reason": "Not Acceptable"
}
响应示例 (406)
{
  "detail": "This operation is not available in API version 2026-09-20-preview.",
  "error": 406,
  "errorCode": "OPERATION_NOT_IN_API_VERSION",
  "parameters": [
    "Accept"
  ],
  "reason": "Not Acceptable"
}
响应示例 (200)
{
  "has_more": true,
  "limit": 42,
  "next_cursor": "string",
  "sessions": [
    {
      "active_duration_ms": 42,
      "created_at": "string",
      "first_message_preview": "string",
      "last_activity": "string",
      "latest_status": "string",
      "project_id": "string",
      "session_id": "string",
      "total_duration_ms": 42,
      "total_tokens": 42,
      "turns": 42,
      "user_id": "string",
      "visibility": "string",
      "wait_ms": 42,
      "workspace_id": "string"
    }
  ],
  "total_count": 42,
  "truncated": true
}
响应示例 (200)
{
  "has_more": true,
  "limit": 42,
  "next_cursor": "string",
  "sessions": [
    {
      "active_duration_ms": 42,
      "created_at": "string",
      "first_message_preview": "string",
      "last_activity": "string",
      "latest_status": "string",
      "project_id": "string",
      "session_id": "string",
      "total_duration_ms": 42,
      "total_tokens": 42,
      "turns": 42,
      "user_id": "string",
      "visibility": "string",
      "wait_ms": 42,
      "workspace_id": "string"
    }
  ],
  "total_count": 42,
  "truncated": true
}
响应示例 (400)
{
  "code": "string",
  "error": "string",
  "success": true
}
响应示例 (400)
{
  "code": "string",
  "error": "string",
  "success": true
}
响应示例 (401)
{
  "code": "string",
  "error": "string",
  "success": true
}
响应示例 (401)
{
  "code": "string",
  "error": "string",
  "success": true
}
响应示例 (500)
{
  "code": "string",
  "error": "string",
  "success": true
}
响应示例 (500)
{
  "code": "string",
  "error": "string",
  "success": true
}
响应示例 (502)
{
  "code": "string",
  "error": "string",
  "success": true
}
响应示例 (502)
{
  "code": "string",
  "error": "string",
  "success": true
}