> ## Documentation Index
> Fetch the complete documentation index at: https://wiki.another-horizon.eu/llms.txt
> Use this file to discover all available pages before exploring further.

# 通过 ID 获取代理任务

> 根据其 ID 获取指定代理任务的详细信息和状态。

<div id="usage">
  ## 用法
</div>

此端点通过代理任务的唯一标识符获取该任务的详细信息和状态。可用于查看先前创建的代理任务的进度、状态和结果。

<div id="job-details">
  ## 作业详情
</div>

响应包含以下信息：

* 作业执行状态与完成情况
* branch 信息和拉取请求（PR；亦称“合并请求”/Merge Request）详情
* 会话 metadata 与时间戳


## OpenAPI

````yaml zh/admin-openapi.json get /agent/{projectId}/job/{id}
openapi: 3.0.1
info:
  title: Mintlify Admin API
  description: 用于管理操作的 API，包括文档更新和代理管理。
  version: 1.0.0
servers:
  - url: https://api.mintlify.com/v1
security:
  - bearerAuth: []
paths:
  /agent/{projectId}/job/{id}:
    get:
      summary: 通过 ID 获取代理任务
      description: 根据其 ID 获取指定代理任务的详细信息和状态。
      parameters:
        - name: projectId
          in: path
          required: true
          schema:
            type: string
          description: >-
            项目 ID。可在控制台的 [API
            keys](https://dashboard.mintlify.com/settings/organization/api-keys)
            页面中复制。
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: 要检索的代理作业的唯一标识符。
      responses:
        '200':
          description: 成功获取代理任务详情
          content:
            application/json:
              schema:
                type: object
                properties:
                  sessionId:
                    type: string
                    description: 本次会话所属的子域。
                  subdomain:
                    type: string
                    description: 该会话所属的子域。
                  branch:
                    type: string
                    description: 包含这些更改的 Git branch 名称。
                    nullable: true
                  haulted:
                    type: boolean
                    description: 会话执行是否已被中止。
                  haultReason:
                    type: string
                    enum:
                      - completed
                      - github_missconfigured
                      - error
                    description: 会话终止原因。
                  pullRequestLink:
                    type: string
                    description: 指向已创建拉取请求（PR，亦称“合并请求”/Merge Request）的链接。
                  messageToUser:
                    type: string
                    description: 用于告知用户会话结果的消息。
                  todos:
                    type: array
                    description: 本次会话的待办事项清单。
                    items:
                      type: object
                      properties:
                        content:
                          type: string
                          description: 任务的简要说明。
                        status:
                          type: string
                          enum:
                            - pending
                            - in_progress
                            - completed
                            - cancelled
                          description: 当前任务状态。
                        priority:
                          type: string
                          enum:
                            - high
                            - medium
                            - low
                          description: 任务的优先级。
                        id:
                          type: string
                          description: 待办事项的唯一标识。
                  createdAt:
                    type: string
                    format: date-time
                    description: 会话创建时间的时间戳。
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Authorization 请求头需要使用 Bearer token。请在此处创建一个 [Admin API Key（管理员 API
        密钥）](https://dashboard.mintlify.com/settings/organization/api-keys)。

````