文档

API 参考

启动任务

在项目中创建空闲任务,或用初始消息立即启动。

BioAgent 部分可用:disable_fallbacks 与 auto_mode 已生效。plan_mode 会先出一份计划草案再谈执行:草案由模型在一次只写计划、不调工具、不执行的调用里撰写,步骤用与 Biomni 内核相同的编号 [ ] 复选清单(内核提示原文:make a plan first … Format your plan as a checklist with empty checkboxes),存成普通助手消息(GET /messages/{id} 直接读得到,契约不新增字段),闸门记下它的 id,批准前不跑任何轮次;下一条消息视为批准,且该轮把草案正文当作任务输入。与内核的差异:内核是「先写计划、再在同一次自主运行里逐步勾选执行」,这里是「计划停下等批准」;没有配置模型时草案降级为目录派生,并在消息里明确标注是派生的。disable_fallbacks 打开时,模型没有给出计划就拒答,不降级。

任务共享项目文件,并以 idle 开始。它会保持空闲,直到你用 POST /tasks/{id}/messages 发送第一条消息,使其变为 running。用 GET /tasks/{id} 读取状态,用 POST /tasks/{id}/cancel 停止。

model 选择智能体运行的档位。它在任务创建时固定,之后无法更改,因此要换档位请新建任务。省略则使用默认值。

传入 initial_messages 可跳过第二次调用:消息会按你列出的顺序投递给任务,智能体从最后一条开始工作,并把之前的消息读作此前的对话。任务会以 running 状态返回。

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:
    post:
      tags:
        - tasks
      summary: Start a task
      description: >-
        Create an idle task inside a project, or start it immediately with
        initial messages.
      operationId: create_task_experimental_tasks_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTaskRequest'
            examples:
              minimal:
                summary: 'Minimal: just project_id + title'
                value:
                  project_id: prj_0126xxQZB9MmSUaTs1MtRAgU
                  title: Quick variant lookup
              with_model:
                summary: On the highest-capability model
                value:
                  project_id: prj_0126xxQZB9MmSUaTs1MtRAgU
                  title: BRCA1 variant clinical report
                  model: max
              with_plan_mode:
                summary: With plan mode
                value:
                  project_id: prj_0126xxQZB9MmSUaTs1MtRAgU
                  title: BRCA1 variant clinical report
                  plan_mode: true
              with_initial_messages:
                summary: Start the agent right away
                value:
                  project_id: prj_0126xxQZB9MmSUaTs1MtRAgU
                  title: BRCA1 variant clinical report
                  initial_messages:
                    - role: user
                      content: Here are 3 BRCA1 variants to work up.
                    - role: user
                      content: Check ClinVar status for each.
      responses:
        '201':
          description: Task created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Task'
              example:
                id: tsk_013ulkKbtuwHmE0ZlTLlnFU3
                type: task
                created_at: '2026-08-12T22:54:00.425353Z'
                status: running
                project_id: prj_0126xxQZB9MmSUaTs1MtRAgU
                title: BRCA1 variant clinical report
                platform: api
      security:
        - bearerAuth: []
components:
  schemas:
    CreateTaskRequest:
      properties:
        project_id:
          type: string
          title: Project Id
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: Title
        initial_messages:
          items:
            $ref: '#/components/schemas/InitialMessage'
          type: array
          maxItems: 20
          title: Initial Messages
        model:
          anyOf:
            - type: string
              enum:
                - standard
                - fast
                - max
            - type: 'null'
          title: Model
          description: >-
            Model tier for this task: `standard` (the default balance of speed
            and capability), `fast` (lower latency on a lighter model), or `max`
            (the highest-capability model).
        disable_fallbacks:
          type: boolean
          title: Disable Fallbacks
          description: Fail the task instead of switching to a fallback model or provider.
          default: false
        plan_mode:
          type: boolean
          title: Plan Mode
          default: false
        auto_mode:
          type: boolean
          title: Auto Mode
          default: false
      additionalProperties: false
      type: object
      required:
        - project_id
      title: CreateTaskRequest
    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
    InitialMessage:
      properties:
        role:
          type: string
          const: user
          title: Role
          default: user
        content:
          type: string
          minLength: 1
          title: Content
      additionalProperties: false
      type: object
      required:
        - content
      title: InitialMessage
      description: One message seeded into a new Task. Only `user` messages are accepted.
    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.