> ## Documentation Index
> Fetch the complete documentation index at: https://docs.veadk.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# 读取执行结果

> 读取指定执行的当前状态或已完成结果

需要使用 AgentKit CLI 0.54.0 部署并[启用定时任务](/productions/api-reference/preview/zh/harness-runtime/cronjobs/overview)的 Harness Runtime

响应可以是排队、运行中或终态记录，并非只有完成后才可读取。`output` 保存最终文本；失败时读取 `error`。超时与失败不会自动重试该次执行


## OpenAPI

````yaml productions/api-reference/openapi/zh/harness-runtime.json GET /harness/cronjobs/{job_id}/runs/{run_id}
openapi: 3.1.0
info:
  title: Harness Runtime
  version: agentkit-cli 0.54.0 / SDK 0.8.0 / ADK 2.2.0
  description: >-
    AgentKit CLI 0.54.0 部署的 Harness Runtime，基于 VeADK 1.0.8、AgentKit SDK 0.8.0 与
    Google ADK 2.2.0 核验；定时任务另需启用配置
servers:
  - url: http://localhost:8000
    description: 本地服务
security:
  - {}
  - RuntimeBearer: []
tags:
  - name: 服务与应用
  - name: 会话
  - name: 智能体运行
  - name: 制品
  - name: 记忆
  - name: 评测 · 开发服务
  - name: 调试 · 开发服务
  - name: 兼容接口
  - name: Harness 定时任务
paths:
  /harness/cronjobs/{job_id}/runs/{run_id}:
    get:
      tags:
        - Harness Runtime cronjobs
      summary: 读取执行结果
      description: 读取指定执行的当前状态或已完成结果
      operationId: harness_cronjob_result
      parameters:
        - name: job_id
          in: path
          required: true
          schema:
            type: string
            pattern: ^[a-f0-9]{32}$
            title: Job Id
          description: 任务 ID，32 位小写十六进制字符
        - name: run_id
          in: path
          required: true
          schema:
            type: string
            pattern: ^[0-9]{13}-[a-f0-9]{20}$
            title: Run Id
          description: 执行 ID，使用任务状态或执行历史返回的值
      responses:
        '200':
          description: 成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CronjobRun'
              example:
                cronjob_id: 0e58ff7f7dcbf348c252fc70e7fdb587
                run_id: 8210479599999-677bde100cec511735b2
                revision: 1
                scheduled_at: '2026-09-16T01:00:00Z'
                created_at: '2026-09-16T01:00:00Z'
                prompt: Summarize recent activity
                harness: null
                timeout_seconds: 1800
                state: succeeded
                owner: replica-1
                started_at: '2026-09-16T01:00:00+00:00'
                completed_at: '2026-09-16T01:00:10+00:00'
                lease_until: '2026-09-16T01:01:00+00:00'
                cancel_requested: false
                output: Daily report
                error: ''
        '401':
          description: 部署网关要求的服务访问凭证缺失或无效，具体响应由网关决定
        '404':
          description: 任务或执行不存在
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CronjobError'
              example:
                detail: Cronjob or execution not found
        '422':
          description: 请求参数、调度配置或幂等键校验失败
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CronjobRequestError'
              examples:
                field:
                  value:
                    detail:
                      - loc:
                          - path
                          - job_id
                        msg: String should match pattern
                        type: string_pattern_mismatch
                value:
                  value:
                    detail: Invalid request
      security:
        - HarnessServiceAuth: []
      x-codeSamples:
        - lang: cURL
          source: >-
            curl --request GET
            "${HARNESS_URL}/harness/cronjobs/${CRONJOB_ID}/runs/${RUN_ID}" \
              --header "Authorization: Bearer ${HARNESS_TOKEN}"
        - lang: Python
          source: >-
            import json

            import os

            from urllib.request import Request, urlopen


            base_url = os.environ["HARNESS_URL"]

            headers = {"Authorization": "Bearer " + os.environ["HARNESS_TOKEN"]}

            job_id = os.environ["CRONJOB_ID"]

            run_id = os.environ["RUN_ID"]

            request = Request(base_url +
            f"/harness/cronjobs/{job_id}/runs/{run_id}", headers=headers,
            method="GET")

            with urlopen(request) as response:
                print(json.load(response))
        - lang: JavaScript
          source: >-
            const baseUrl = process.env.HARNESS_URL;

            const headers = { Authorization: `Bearer
            ${process.env.HARNESS_TOKEN}` };

            const response = await
            fetch(`${baseUrl}/harness/cronjobs/${process.env.CRONJOB_ID}/runs/${process.env.RUN_ID}`,
            {
              method: "GET",
              headers,
            });

            if (!response.ok) throw new Error(await response.text());

            console.log(await response.json());
components:
  schemas:
    CronjobRun:
      type: object
      properties:
        cronjob_id:
          type: string
          description: 所属任务 ID
          pattern: ^[a-f0-9]{32}$
        run_id:
          type: string
          description: 执行 ID，用于读取或取消该次执行
          pattern: ^[0-9]{13}-[a-f0-9]{20}$
        revision:
          type: integer
          description: 本次执行使用的任务修订号
        scheduled_at:
          type: string
          description: 计划触发时间，UTC
          format: date-time
        created_at:
          type: string
          description: 执行记录创建时间，UTC
          format: date-time
        prompt:
          type: string
          description: 本次执行的消息
        harness:
          anyOf:
            - $ref: '#/components/schemas/CronjobHarnessPublicOverrides'
            - type: 'null'
        timeout_seconds:
          type: integer
          description: 本次执行的超时秒数
        state:
          type: string
          description: 执行状态
          enum:
            - queued
            - running
            - succeeded
            - failed
            - cancelled
            - skipped
            - interrupted
        owner:
          anyOf:
            - type: string
              description: 执行本次任务的副本标识；尚未开始时为 null
            - type: 'null'
        started_at:
          anyOf:
            - type: string
              description: 执行开始时间，UTC；尚未开始时为 null
              format: date-time
            - type: 'null'
        completed_at:
          anyOf:
            - type: string
              description: 执行结束时间，UTC；尚未结束时为 null
              format: date-time
            - type: 'null'
        lease_until:
          anyOf:
            - type: string
              description: 当前执行有效期截止时间，UTC；尚未开始时为 null
              format: date-time
            - type: 'null'
        cancel_requested:
          type: boolean
          description: 是否已请求取消本次执行
        output:
          type: string
          description: 执行输出；失败时为空。成功输出最大 1 MiB
        error:
          type: string
          description: 失败、取消、跳过或中断的说明；无错误时为空字符串
        coalesced_from:
          type: string
          description: 补跑合并涉及的最早错过时间，UTC；仅发生触发合并时提供
          format: date-time
      required:
        - cronjob_id
        - run_id
        - revision
        - scheduled_at
        - created_at
        - prompt
        - harness
        - timeout_seconds
        - state
        - owner
        - started_at
        - completed_at
        - lease_until
        - cancel_requested
        - output
        - error
    CronjobError:
      type: object
      properties:
        detail:
          type: string
          description: 错误说明
      required:
        - detail
    CronjobRequestError:
      type: object
      properties:
        detail:
          anyOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/CronjobValidationError'
          description: 业务校验错误说明或字段校验错误列表
      required:
        - detail
    CronjobHarnessPublicOverrides:
      properties:
        model_name:
          type: string
          title: Model Name
          description: 本次任务使用的推理模型名称
        tools:
          type: string
          title: Tools
          description: >-
            逗号分隔的内置工具名称；CLI 0.54.0 默认部署支持的 13
            个名称、用途与依赖见[内置工具](/productions/api-reference/preview/zh/harness-runtime/tools)
        mcp_servers:
          type: array
          items:
            $ref: '#/components/schemas/CronjobMcpServerPublic'
          description: 任务使用的 MCP 服务，凭证已脱敏
        skills:
          type: string
          title: Skills
          description: 逗号分隔的 SkillHub slug、技能空间 ID 或空间:技能引用
        system_prompt:
          type: string
          title: System Prompt
          description: 任务执行时使用的智能体指令
        runtime:
          type: string
          enum:
            - adk
            - codex
          title: Runtime
          description: 智能体运行后端
        registry_space_id:
          type: string
          title: Registry Space Id
          description: A2A 智能体注册空间 ID
        registry_endpoint:
          type: string
          title: Registry Endpoint
          description: A2A 智能体注册服务地址
        registry_region:
          type: string
          title: Registry Region
          description: A2A 智能体注册服务区域
        registry_top_k:
          type: integer
          minimum: 1
          title: Registry Top K
          description: 检索的候选智能体数量，至少为 1
        max_llm_calls:
          anyOf:
            - type: integer
              minimum: 1
            - type: 'null'
          title: Max Llm Calls
          description: 单次执行最大模型调用次数，至少为 1
      additionalProperties: false
      type: object
      title: CronjobHarnessPublicOverrides
      description: 该任务每次执行时应用的配置，仅应用显式提供的字段，未提供字段继承已部署智能体
    CronjobValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
          description: 校验失败字段的位置
        msg:
          type: string
          title: Message
          description: 校验失败原因
        type:
          type: string
          title: Error Type
          description: 校验错误代码
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    CronjobMcpServerPublic:
      properties:
        protocol:
          type: string
          enum:
            - streamable-http
            - sse
          title: Protocol
          description: MCP 传输协议
        endpoint:
          type: string
          title: Endpoint
          description: HTTP(S) 地址，不允许用户名、密码、URL 片段或控制字符
        api_key:
          anyOf:
            - type: string
            - type: 'null'
          description: 已配置的非空凭证返回 ********；未提供凭证时可省略或为 null
      additionalProperties: false
      type: object
      required:
        - endpoint
      title: CronjobMcpServerPublic
      description: 该任务可连接的远程 MCP 服务
  securitySchemes:
    RuntimeBearer:
      type: http
      scheme: bearer
      description: 本地未配置网关时可不提供；云部署使用 Runtime API Key 或部署要求的用户池 JWT，不能使用模型 API Key
    HarnessServiceAuth:
      type: http
      scheme: bearer
      description: 服务鉴权 Harness 的 Runtime 访问凭证，例如 Runtime API Key；共享 OAuth 部署不支持后台定时任务

````