---
title: "获取代理任务"
method: GET
path: "/v2/agent/{projectId}/job/{id}"
language: "zh-Hans"
---

# 获取代理任务

`GET /v2/agent/{projectId}/job/{id}`

## Request

- Base URL: `https://api.mintlify.com`
- URL: `https://api.mintlify.com/v2/agent/{projectId}/job/{id}`
- Auth: HTTP bearer

检索代理作业的当前状态和详细信息。轮询此端点以跟踪作业进度。

使用管理员 API 密钥进行身份验证。

## Path parameters

- `projectId` string, required
- `id` string, required

## Response `200`

代理任务详情

- AgentJob
  - `id` string: 代理任务的唯一标识符。
  - `status` 'active' | 'completed' | 'archived' | 'failed': 作业的当前状态。`active`——代理当前正在处理提示词。`completed`——代理已成功完成，并且可能已创建 PR（请检查 `prLink`）。`archived`——作业已归档。`failed`——代理遇到了不可恢复的错误。请持续轮询，直到状态变为 `completed`、`archived` 或 `failed`。
  - `source` object: 源存储库信息。
    - `repository` string: GitHub 存储库的完整 URL。
    - `ref` string, nullable: 代理正在处理的 Git branch。
  - `model` string: 此作业使用的 AI 模型。
  - `prLink` string, uri, nullable: 由代理创建的 GitHub 拉取请求（PR；亦称“合并请求”/Merge Request）URL。作业仍处于 `active` 状态或没有文件变更时，该值为 `null`。代理成功创建 PR 后，此字段会被填充。
  - `createdAt` string, date-time: 作业创建时的时间戳。
  - `archivedAt` string, date-time, nullable: 作业归档时的时间戳。

## Other responses

- `400`: 项目 ID 格式无效。
- `401`: API 密钥缺失或无效，或者你的套餐不包含 API 访问权限或代理功能。
- `403`: 你的请求来自不在 API 密钥允许列表中的 IP 地址。
- `404`: 此项目中不存在具有该 ID 的代理任务，或者项目不存在或不属于你的组织。

## Changes

> 25 revisions in range; 2 not diffed.

- **2026-10-30** `8f632fe27713`: 3 info
  - added the non-success response with the status `400`
  - added the non-success response with the status `401`
  - added the non-success response with the status `403`
- **2026-03-12** `b4e58059b285`: 1 warning
  - added the new `archived` enum value to the `status` response property for the response status `200`

[Operation history](https://skmtc.dev/mintlify/apis/mintlify-admin-api/zh/changes/v2/agent/:projectId/job/:id/get.md)

---

[API](https://skmtc.dev/mintlify/apis/mintlify-admin-api/zh.md) - [All operations](https://skmtc.dev/mintlify/apis/mintlify-admin-api/zh/llms.txt) - [OpenAPI document](https://skmtc.dev/mintlify/apis/mintlify-admin-api/zh/revisions/16b7a7e40d59?raw)
