文档

API 参考

获取消息

按 id 查询单条消息。

适用于你发送的消息、智能体回复,或已完成科学复核返回的 message_id。进行中的回复 status: "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/{task_id}/messages/{message_id}:
    get:
      tags:
        - messages
      summary: Get a message
      description: Look up a single message by id.
      operationId: get_message_experimental_tasks__task_id__messages__message_id__get
      parameters:
        - name: message_id
          in: path
          required: true
          schema:
            type: string
            title: Message Id
        - name: task_id
          in: path
          required: true
          schema:
            type: string
            title: Task Id
      responses:
        '200':
          description: A single message.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message'
              examples:
                user_message:
                  summary: A user message
                  value:
                    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
                completed_assistant:
                  summary: Assistant message (completed turn)
                  value:
                    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: []
                running_assistant:
                  summary: Assistant message (still running)
                  value:
                    id: msg_c07b9e1f5a34
                    type: message
                    task_id: tsk_014ztPoW8a1jnkHm9jMZ1KML
                    created_at: '2026-08-12T21:02:24.318000Z'
                    role: assistant
                    status: running
                    content:
                      - type: text
                        text: Looking up ClinVar records for rs80357065.
                      - type: tool_use
                        id: toolu_015XmqBt8kPvVjLd3nRcW9Hy
                        name: Bash
                        input:
                          command: python3 clinvar_lookup.py rs80357065
                          description: >-
                            Querying ClinVar for the variant's current
                            assertions
                    platform: api
                    input:
                      user_message_id: msg_5b2d84f10c67
                      file_ids: []
      security:
        - bearerAuth: []
components:
  schemas:
    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.