> ## Documentation Index
> Fetch the complete documentation index at: https://firecrawl-capy-docs-factual-copy-fixes.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 获取 Agent 状态

> 如果你是需要 Firecrawl API 密钥的 AI 代理，请参阅 [firecrawl.dev/agent-onboarding/SKILL.md](https://www.firecrawl.dev/agent-onboarding/SKILL.md) 获取自动化入门说明。


## OpenAPI

````yaml zh/api-reference/v2-openapi.json GET /agent/{jobId}
openapi: 3.0.0
info:
  contact:
    email: support@firecrawl.dev
    name: Firecrawl Support
    url: https://firecrawl.dev/support
  description: 用于与 Firecrawl 服务交互，执行网页抓取和爬取任务的 API。
  title: Firecrawl API
  version: v2
servers:
  - url: https://api.firecrawl.dev/v2
security:
  - bearerAuth: []
paths:
  /agent/{jobId}:
    parameters:
      - description: Agent 任务的 ID
        in: path
        name: jobId
        required: true
        schema:
          format: uuid
          type: string
    get:
      tags:
        - Agent
      summary: 获取智能体任务状态
      operationId: getAgentStatus
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  creditsUsed:
                    type: number
                  data:
                    description: 提取的数据（仅在状态为 completed 时可用）。运行失败时不会设置此字段，包括因达到额度上限而停止的运行。
                    type: object
                  effort:
                    description: 代理运行使用的推理预算（仅存在于设置了 effort 的运行中）
                    enum:
                      - low
                      - medium
                      - high
                    type: string
                  error:
                    description: 错误信息（仅当状态为失败时出现）
                    type: string
                  exchange:
                    $ref: '#/components/schemas/AgentExchangeSummary'
                  expiresAt:
                    format: date-time
                    type: string
                  message:
                    description: >-
                      代理对结果的说明。在 `chat` 模式下，不请求新数据的后续请求会在此处获得回复，而不是在 `data`
                      中。如果运行因达到额度上限而停止并失败，此说明可能会指出哪些内容尚未完成。
                    type: string
                  mode:
                    enum:
                      - extract
                      - chat
                    type: string
                  model:
                    default: spark-2
                    description: 本次代理运行所使用的模型预设。每次新运行均在 spark-2 上执行；Spark 1 名称仅会出现在旧版运行中。
                    enum:
                      - spark-2
                      - spark-1-pro
                      - spark-1-mini
                    type: string
                  partial:
                    description: >-
                      从未完成的运行中尽力恢复的 JSON。仅在部分失败的运行中提供，例如达到 `maxCredits`
                      上限的运行；运行仍在处理时不会提供。其中可能缺少行或字段，因此请勿将其视为完整结果。
                  partialSchemaValid:
                    description: >-
                      `partial` 是否通过请求中指定的 JSON 模式验证。仅当 `partial` 存在且请求包含
                      `schema` 时提供。
                    type: boolean
                  pendingApproval:
                    $ref: '#/components/schemas/AgentPendingApproval'
                  status:
                    enum:
                      - processing
                      - completed
                      - failed
                    type: string
                  stopReason:
                    description: >-
                      运行失败并提前停止的原因。`credit_limit_reached` 表示运行已达到 `maxCredits`
                      上限。仅在状态为 failed 时提供。
                    enum:
                      - credit_limit_reached
                    type: string
                  success:
                    type: boolean
                  suggestions:
                    description: 代理为会话下一轮提供的后续请求建议。
                    items:
                      properties:
                        label:
                          type: string
                        prompt:
                          type: string
                      type: object
                    type: array
                  threadId:
                    description: 本次运行所属的会话。
                    format: uuid
                    type: string
                  threadTurn:
                    description: 本次运行在会话中的轮次，从 1 开始。
                    type: integer
                type: object
          description: 成功的响应
        '400':
          content:
            application/json:
              schema:
                properties:
                  error:
                    example: Invalid job ID format. Job ID must be a valid UUID.
                    type: string
                type: object
          description: 请求错误 — 任务 ID 不是有效的 UUID。
        '404':
          content:
            application/json:
              schema:
                properties:
                  error:
                    example: Agent job not found
                    type: string
                type: object
          description: 未找到代理任务
      security:
        - bearerAuth: []
components:
  schemas:
    AgentExchangeSummary:
      description: >-
        此次运行通过 Alexandria 执行的操作。`toolkits` 和 `requireApproval`
        是此次运行继承会话设置后最终确定的值。
      properties:
        creditsUsed:
          description: 提供商调用消耗的额度，未知时为 null。
          nullable: true
          type: number
        enabled:
          type: boolean
        onTermsRequired:
          enum:
            - skip
            - ask
          type: string
        paidCalls:
          description: 此次运行执行的付费提供商调用。
          type: integer
        requireApproval:
          type: boolean
        requiresAction:
          description: >-
            仅适用于 `onTermsRequired:
            "ask"`，且本轮因请求接受条款而结束的情况：用于查看和接受各提供商条款的调用。此处的调用不会自动执行，必须在您的用户明确同意后才能调用
            `terms/accept`。
          properties:
            approvalId:
              description: 接受条款后需要回应的 `terms` 类型 `pendingApproval`。
              type: string
            providers:
              items:
                properties:
                  accept:
                    description: >-
                      `terms/accept` 调用，以 `{ provider, capability, options }`
                      的形式提供，用于 `/v2/scrape` 的 `alexandria`。
                    type: object
                  adds:
                    type: string
                  capability:
                    type: string
                  digest:
                    description: 目录未发布摘要时为 Null；`terms/show` 会返回该摘要。
                    nullable: true
                    type: string
                  name:
                    type: string
                  provider:
                    type: string
                  show:
                    description: >-
                      `terms/show` 调用，以 `{ provider, capability, options }`
                      的形式提供，用于 `/v2/scrape` 的 `alexandria`。
                    type: object
                  url:
                    type: string
                  version:
                    type: string
                type: object
              type: array
            type:
              enum:
                - accept_terms
              type: string
          type: object
        skippedProviders:
          description: 本可提供帮助，但因团队尚未接受其数据条款而无法使用的提供商。适用于所有 `onTermsRequired` 模式。
          items:
            properties:
              adds:
                description: 该提供商本可补充的内容。
                type: string
              capability:
                type: string
              name:
                type: string
              provider:
                type: string
              reason:
                enum:
                  - terms_required
                type: string
              termsUrl:
                description: 用户在 Dashboard 中接受条款的位置。
                type: string
              version:
                description: 条款版本。
                type: string
            type: object
          type: array
        toolkits:
          description: 指定使用的提供商。为空或不存在时，表示团队可使用的所有提供商。
          items:
            type: string
          type: array
      type: object
    AgentPendingApproval:
      description: 本轮暂停以请求确认的事项。在会话的下一轮中使用 `exchange.approve` 或 `exchange.decline` 回应。
      properties:
        calls:
          description: 等待批准的付费调用。在 `terms` 审批请求中为空。
          items:
            properties:
              capability:
                type: string
              creditsEstimate:
                description: 预估消耗的额度，未知时为 null。
                nullable: true
                type: number
              id:
                description: 通过 `exchange.approve.callIds` 传入调用 ID，以仅批准部分调用。
                type: string
              input:
                description: 该调用将使用的选项。
                type: object
              more:
                description: 同一调用将使用的其他输入参数。
                items:
                  type: object
                type: array
              provider:
                type: string
            type: object
          type: array
        id:
          description: 将此值作为 `approvalId` 发送。
          type: string
        kind:
          description: >-
            `calls`：因 `requireApproval`
            而暂缓执行的付费提供商调用。`terms`：需要接受其数据条款的提供商（`onTermsRequired:
            "ask"`）。在条款接受请求功能推出前写入的条目不含此字段，均属于 `calls` 类型。
          enum:
            - calls
            - terms
          type: string
        reason:
          description: 代理希望执行这些调用的原因。
          type: string
        resolution:
          description: 在后续轮次回应此批准请求之前为 Null。
          nullable: true
          properties:
            always:
              type: boolean
            approved:
              type: boolean
            byRunId:
              type: string
            callIds:
              items:
                type: string
              type: array
          type: object
        terms:
          description: 在 `terms` 审批请求中，列出需要接受其条款的提供商。
          items:
            properties:
              adds:
                description: 该提供商可补充的内容。
                type: string
              capability:
                type: string
              digest:
                description: 目录未发布摘要时为 Null；`terms/show` 会返回该摘要。
                nullable: true
                type: string
              name:
                type: string
              provider:
                type: string
              url:
                description: 用户在 Dashboard 中接受条款的位置。
                type: string
              version:
                description: 条款版本。
                type: string
            type: object
          type: array
      type: object
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.