文档

API 参考

获取任务

获取任务、其状态以及它的科学复核。

任务的终态是 completed、failed 或 cancelled。再次读取此端点可获得当前状态。

status含义
idle尚未发送任何消息
running智能体正在工作
completed智能体完成了这一轮,且没有后台工作正在运行
failed最新的智能体消息带有 error,或任务因工作区预付额度耗尽而停止
cancelled你停止了任务

当任务因工作区预付额度耗尽而停止时,status 为 failed,error 说明原因,code 为 payment_required。充值后发送新消息即可继续任务。

reviews 保存该任务的科学复核,每项包含 status、保存发现的 message_id,失败时的 error_message。复核在写出发现后出现。

OpenAPI

openapi: 3.1.0
info:
  title: BioAgent API — V1
  description: Public API for BioAgent, the biomedical AI agent platform.
  version: 0.1.0
servers:
  - url: https://bioagent.cloud/api/v1
    description: >-
      BioAgent public API base URL. Every endpoint on this page is served from
      this host.
security: []
paths:
  /experimental/tasks/{task_id}:
    get:
      tags:
        - tasks
      summary: Get a task
      description: Get a task, its status, and any scientific reviews of it.
      operationId: get_task_experimental_tasks__task_id__get
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
            title: Task Id
      responses:
        '200':
          description: Task record.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Task'
              examples:
                completed:
                  summary: A completed task (real BRCA1 demo from May 18)
                  value:
                    id: tsk_017ilCeuDpMWTSH9Ah1syUGJ
                    type: task
                    created_at: '2026-08-12T21:21:02.815000Z'
                    status: completed
                    project_id: prj_014OwAG97UY0UfcHlLHQRnKO
                    title: BRCA1 variant workup
                    platform: api
                    reviews: []
                running:
                  summary: A task with the agent currently processing
                  value:
                    id: tsk_014ztPoW8a1jnkHm9jMZ1KML
                    type: task
                    created_at: '2026-08-12T21:02:18.900000Z'
                    status: running
                    project_id: prj_014OwAG97UY0UfcHlLHQRnKO
                    title: BRCA1 variant exploration
                    platform: api
                    reviews: []
                reviewed:
                  summary: A task with a finished Scientific Review
                  value:
                    id: tsk_017ilCeuDpMWTSH9Ah1syUGJ
                    type: task
                    created_at: '2026-08-12T21:21:02.815000Z'
                    status: completed
                    project_id: prj_014OwAG97UY0UfcHlLHQRnKO
                    title: BRCA1 variant workup
                    platform: api
                    reviews:
                      - type: scientific_review
                        status: done
                        created_at: '2026-08-12T21:41:02Z'
                        message_id: msg_f6872d1e0fb242fd
      security:
        - bearerAuth: []
components:
  schemas:
    Task:
      properties:
        id:
          type: string
          title: Id
        type:
          type: string
          const: task
          title: Type
          default: task
        created_at:
          type: string
          format: date-time
          title: Created At
        status:
          type: string
          enum:
            - idle
            - running
            - completed
            - cancelled
            - failed
          title: Status
        error:
          anyOf:
            - $ref: '#/components/schemas/TaskError'
            - type: 'null'
          description: >-
            Why the task failed, when the reason is known. Set only when
            `status` is `failed`.
        project_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Project Id
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: Title
        platform:
          type: string
          enum:
            - api
            - mcp
            - web
            - desktop
            - mobile
          title: Platform
          default: api
        reviews:
          anyOf:
            - items:
                $ref: '#/components/schemas/TaskScientificReview'
              type: array
            - type: 'null'
          title: Reviews
      type: object
      required:
        - id
        - created_at
        - status
      title: Task
    TaskError:
      properties:
        type:
          type: string
          const: invalid_request_error
          title: Type
        code:
          type: string
          const: payment_required
          title: Code
        message:
          type: string
          title: Message
      type: object
      required:
        - type
        - code
        - message
      title: TaskError
      description: >-
        Why a task failed, in the same shape as an error response's `error`
        object.
    TaskScientificReview:
      properties:
        type:
          type: string
          const: scientific_review
          title: Type
          default: scientific_review
        status:
          type: string
          enum:
            - running
            - done
            - failed
          title: Status
        created_at:
          type: string
          format: date-time
          title: Created At
        message_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Message Id
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Message
      type: object
      required:
        - status
        - created_at
      title: TaskScientificReview
      description: A scientific review recorded on a task.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Requires an API key. See the Authentication guide.