文档

API 参考

列出消息

按顺序列出任务的消息,最早的在前。

你的消息 role: "user",智能体的为 role: "assistant"。每条智能体回复是一条消息,其 content[] 保存完整回复:文本、工具调用与结果。如果 BioAgent 的安全机制重定向或停止了智能体,回复中还会包含说明该情况的 system_notice 块。仍在进行的回复 status: "running",并带有目前的内容。

limit(默认 200,最大 500)限制读取的底层事件数,而不是返回的消息数,因此返回的消息可能少于 limit。第一页是对话最近的一段。

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}/messages:
    get:
      tags:
        - messages
      summary: List messages
      description: List a task's messages in order, oldest first.
      operationId: list_messages_experimental_tasks__task_id__messages_get
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
            title: Task Id
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 500
            minimum: 1
            default: 200
            title: Limit
        - name: before_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Before Id
        - name: after_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: After Id
      responses:
        '200':
          description: Page of messages, oldest first.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageList'
              example:
                type: list
                data:
                  - id: msg_a4f9b5cc30d8
                    type: message
                    task_id: tsk_017ilCeuDpMWTSH9Ah1syUGJ
                    created_at: '2026-08-12T21:21:03.412000Z'
                    role: user
                    content:
                      - type: text
                        text: >-
                          I'm a clinical genomics analyst working up Patient001.
                          There are 3 BRCA1 pathogenic-flagged variants in the
                          attached VCF. For each variant: describe ClinVar
                          significance, flag PARP inhibitor eligibility, note
                          any conflicts in the literature. Cite ClinVar VCV/RCV
                          IDs and PMIDs.
                    platform: api
                  - id: msg_1a0ef0fa8e26
                    type: message
                    task_id: tsk_017ilCeuDpMWTSH9Ah1syUGJ
                    created_at: '2026-08-12T21:21:08.735000Z'
                    role: assistant
                    status: completed
                    completed_at: '2026-08-12T21:31:37.204000Z'
                    content:
                      - type: text
                        text: >-
                          Loaded the genetic-variant-annotation skill. For these
                          3 BRCA1 variants I'll (1) query ClinVar's REST API
                          directly for each rsID to get current assertions,
                          review status, star ratings, and conditions, and (2)
                          cross-reference NCBI's ClinVar records for conflicting
                          submissions and literature PMIDs.
                      - type: tool_use
                        id: toolu_01RkjLRcNtbVHBBwWDDk7gmF
                        name: Skill
                        input:
                          action: load
                          name: genetic-variant-annotation
                      - type: tool_result
                        tool_use_id: toolu_01RkjLRcNtbVHBBwWDDk7gmF
                        content: >-
                          # Skill: genetic-variant-annotation

                          **Category**: genomics_genetics

                          **Description**: Annotate genomic variants in VCF
                          files with functional effects, clinical significance,
                          and pathogenicity predictions. … (truncated)
                      - type: text
                        text: >-
                          Here is the full structured report. Two deliverables
                          are saved: `report_Patient001_BRCA1_variants.md` and
                          `Patient001_BRCA1_variant_report.json`. All three
                          variants are confirmed pathogenic by ClinVar (3-star
                          review); PARP inhibitor eligibility applies for HBOC
                          and ovarian indications.
                    platform: api
                    input:
                      user_message_id: msg_a4f9b5cc30d8
                      file_ids: []
                has_more: false
                first_id: msg_a4f9b5cc30d8
                last_id: msg_1a0ef0fa8e26
      security:
        - bearerAuth: []
components:
  schemas:
    MessageList:
      properties:
        type:
          type: string
          const: list
          title: Type
          default: list
        data:
          items:
            $ref: '#/components/schemas/Message'
          type: array
          title: Data
        has_more:
          type: boolean
          title: Has More
          default: false
        first_id:
          anyOf:
            - type: string
            - type: 'null'
          title: First Id
        last_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Id
      type: object
      required:
        - data
      title: MessageList
    Message:
      properties:
        id:
          type: string
          title: Id
        type:
          type: string
          const: message
          title: Type
          default: message
        task_id:
          type: string
          title: Task Id
        created_at:
          type: string
          format: date-time
          title: Created At
        role:
          type: string
          enum:
            - user
            - assistant
            - system
          title: Role
        content:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Content
        finish_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Finish Reason
        status:
          anyOf:
            - type: string
              enum:
                - pending
                - running
                - completed
                - cancelling
                - cancelled
                - failed
            - type: 'null'
          title: Status
        stop_reason:
          anyOf:
            - type: string
              enum:
                - stop
                - length
                - cancelled
                - error
            - type: 'null'
          title: Stop Reason
        started_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Started At
        completed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Completed At
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        platform:
          type: string
          enum:
            - api
            - mcp
            - web
            - desktop
            - mobile
          title: Platform
          default: api
        input:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Input
        output:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Output
        ai_disclosure:
          anyOf:
            - $ref: '#/components/schemas/AiDisclosure'
            - type: 'null'
      type: object
      required:
        - id
        - task_id
        - created_at
        - role
        - content
      title: Message
    AiDisclosure:
      properties:
        is_ai_generated:
          type: boolean
          const: true
          title: Is Ai Generated
          default: true
        generator:
          type: string
          title: Generator
          default: bioagent
        model_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Model Ids
        task_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Task Id
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
      type: object
      title: AiDisclosure
      description: >-
        Present only on deployments with EU AI Act transparency controls
        enabled.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Requires an API key. See the Authentication guide.