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

# 发送事件

> 向指定 Session 追加事件并触发后续处理。一次可发送 1 至 10 个受支持事件；已归档 Session 不接受新事件。点击 **Try it** 按钮可快速试用。



## OpenAPI

````yaml /openapi/openapi-managed-agents.json post /agent/managed/v1/sessions/{sessionId}/events
openapi: 3.0.1
info:
  title: 智谱 AI Managed Agents API
  version: 1.0.0
  description: Agent、Environment、Session、File、Memory、Vault、Skill、Deployment 接口。
  contact:
    name: Z.AI 开发者
    url: https://chat.z.ai/legal-agreement/privacy-policy
    email: user_feedback@z.ai
servers:
  - url: https://open.bigmodel.cn/api/
    description: 开放平台服务
security:
  - bearerAuth: []
tags:
  - name: Managed Agents - Agent
    description: Agent 与版本管理。
    x-group: Agent
  - name: Managed Agents - Environment
    description: 声明式执行环境管理。
    x-group: Environment
  - name: Managed Agents - Session
    description: Session、Resource 与事件流。
    x-group: Session
  - name: Managed Agents - File
    description: Managed Files 上传、读取与删除。
    x-group: File
  - name: Managed Agents - Memory
    description: Memory Store、Memory 与版本管理。
    x-group: Memory
  - name: Managed Agents - Vault
    description: Vault 与 Credential 管理。
    x-group: Vault
  - name: Managed Agents - Skill
    description: 自定义 Skill 与版本管理。
    x-group: Skill
  - name: Managed Agents - Deployment
    description: 定时或手动 Deployment 与运行记录。
    x-group: Deployment
paths:
  /agent/managed/v1/sessions/{sessionId}/events:
    servers:
      - url: https://agent-api.bigmodel.cn/api
        description: 智谱 Managed Agents 服务
    post:
      tags:
        - Managed Agents - Session
      summary: 发送事件
      description: >-
        向指定 Session 追加事件并触发后续处理。一次可发送 1 至 10 个受支持事件；已归档 Session 不接受新事件。点击 **Try
        it** 按钮可快速试用。
      operationId: managedPostSessionsBySessionIdEvents
      parameters:
        - $ref: '#/components/parameters/ManagedZaiVersion'
        - $ref: '#/components/parameters/ManagedZaiBeta'
        - name: sessionId
          in: path
          required: true
          description: sessionId 资源标识。
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ManagedSendEventsRequest'
      responses:
        '200':
          description: 请求成功。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManagedSendEventsResponse'
        default:
          description: 请求失败。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManagedAgentsErrorResponse'
components:
  parameters:
    ManagedZaiVersion:
      name: zai-version
      in: header
      required: true
      description: Managed Agents API 协议版本，固定为 2026-05-26。
      schema:
        type: string
        enum:
          - '2026-05-26'
        default: '2026-05-26'
        example: '2026-05-26'
    ManagedZaiBeta:
      name: zai-beta
      in: header
      required: true
      description: 必须包含 managed-agents-2026-05-26；可与其他 beta 标识用逗号分隔。
      schema:
        type: string
        default: managed-agents-2026-05-26
        example: managed-agents-2026-05-26
  schemas:
    ManagedSendEventsRequest:
      type: object
      properties:
        events:
          type: array
          minItems: 1
          maxItems: 10
          description: 一次提交 1–10 个事件，按数组顺序处理。
          items:
            $ref: '#/components/schemas/ManagedEventInput'
      required:
        - events
    ManagedSendEventsResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/ManagedPersistedEvent'
      required:
        - data
      additionalProperties: false
    ManagedAgentsErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - error
        error:
          type: object
          properties:
            type:
              type: string
              enum:
                - invalid_request_error
                - authentication_error
                - permission_error
                - not_found_error
                - request_too_large
                - rate_limit_error
                - api_error
                - timeout_error
                - overloaded_error
            message:
              type: string
            details:
              type: object
              additionalProperties: true
          required:
            - type
            - message
          additionalProperties: false
        request_id:
          type: string
          example: req_01J...
      required:
        - type
        - error
        - request_id
      additionalProperties: false
    ManagedEventInput:
      oneOf:
        - title: user.message
          allOf:
            - $ref: '#/components/schemas/ManagedUserMessageEventInput'
        - title: user.interrupt
          type: object
          properties:
            type:
              type: string
              enum:
                - user.interrupt
          required:
            - type
        - title: user.tool_confirmation
          type: object
          properties:
            type:
              type: string
              enum:
                - user.tool_confirmation
            tool_use_id:
              type: string
              minLength: 1
            result:
              type: string
              enum:
                - allow
                - deny
            deny_message:
              type: string
              nullable: true
              description: 仅 result=deny 时可提供拒绝原因。
          required:
            - type
            - tool_use_id
            - result
          additionalProperties: false
        - title: user.custom_tool_result
          type: object
          properties:
            type:
              type: string
              enum:
                - user.custom_tool_result
            custom_tool_use_id:
              type: string
              minLength: 1
            content:
              type: array
              maxItems: 20
              items:
                $ref: '#/components/schemas/ManagedContentBlock'
            is_error:
              type: boolean
              nullable: true
          required:
            - type
            - custom_tool_use_id
          additionalProperties: false
    ManagedPersistedEvent:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - agent.custom_tool_use
            - agent.mcp_tool_result
            - agent.mcp_tool_use
            - agent.message
            - agent.thinking
            - agent.thread_context_compacted
            - agent.thread_message_received
            - agent.thread_message_sent
            - agent.tool_result
            - agent.tool_use
            - session.deleted
            - session.error
            - session.status_idle
            - session.status_rescheduled
            - session.status_running
            - session.status_terminated
            - session.thread_created
            - session.thread_status_idle
            - session.thread_status_rescheduled
            - session.thread_status_running
            - session.thread_status_terminated
            - session.updated
            - session.usage
            - span.model_request_end
            - span.model_request_start
            - span.outcome_evaluation_end
            - span.outcome_evaluation_ongoing
            - span.outcome_evaluation_start
            - system.message
            - user.custom_tool_result
            - user.define_outcome
            - user.interrupt
            - user.message
            - user.tool_confirmation
            - user.tool_result
        processed_at:
          type: string
          format: date-time
          nullable: true
          description: 排队中的输入事件可能省略；部分确认/中断事件会返回 null。
      required:
        - id
        - type
      additionalProperties: true
      description: 持久化事件。不同 type 的其余字段由对应事件载荷决定；此枚举直接来自 master 的 ManagedSessionEventTypes。
    ManagedUserMessageEventInput:
      type: object
      properties:
        type:
          type: string
          enum:
            - user.message
          description: 固定为 user.message。
        content:
          type: array
          minItems: 1
          maxItems: 20
          description: 消息内容，1–20 个 block；普通事件允许文本、base64 图片或文档。
          items:
            $ref: '#/components/schemas/ManagedContentBlock'
      required:
        - type
        - content
    ManagedContentBlock:
      oneOf:
        - title: text
          allOf:
            - $ref: '#/components/schemas/ManagedTextBlock'
        - title: image
          allOf:
            - $ref: '#/components/schemas/ManagedImageBlock'
        - title: document
          allOf:
            - $ref: '#/components/schemas/ManagedDocumentBlock'
    ManagedTextBlock:
      type: object
      properties:
        type:
          type: string
          enum:
            - text
          description: 固定为 text。
        text:
          type: string
          minLength: 1
          description: 非空文本内容。
      required:
        - type
        - text
    ManagedImageBlock:
      type: object
      properties:
        type:
          type: string
          enum:
            - image
          description: 固定为 image。
        source:
          allOf:
            - $ref: '#/components/schemas/ManagedImageSource'
          description: base64 图片来源。
      required:
        - type
        - source
      additionalProperties: false
    ManagedDocumentBlock:
      type: object
      properties:
        type:
          type: string
          enum:
            - document
          description: 固定为 document；Deployment 与 Session 创建时的 initial_events 不允许该 block。
        source:
          oneOf:
            - title: text
              allOf:
                - $ref: '#/components/schemas/ManagedTextDocumentSource'
            - title: file
              allOf:
                - $ref: '#/components/schemas/ManagedFileDocumentSource'
          description: 内联纯文本或已上传的 File。
        title:
          type: string
          nullable: true
          description: 可选文档标题。
        context:
          type: string
          nullable: true
          description: 当前实现接受该字段，但持久化事件会将其规范化为 null。
      required:
        - type
        - source
      additionalProperties: false
    ManagedImageSource:
      type: object
      properties:
        type:
          type: string
          enum:
            - base64
          description: 当前只接受 base64。
        media_type:
          type: string
          enum:
            - image/jpeg
            - image/png
            - image/gif
            - image/webp
          description: 图片 MIME 类型。
        data:
          type: string
          description: Base64 字符串；默认每张图片解码后不超过 5 MiB。
      required:
        - type
        - media_type
        - data
      additionalProperties: false
    ManagedTextDocumentSource:
      type: object
      properties:
        type:
          type: string
          enum:
            - text
          description: 固定为 text。
        media_type:
          type: string
          enum:
            - text/plain
          description: 当前仅支持 text/plain。
        data:
          type: string
          description: 内联纯文本内容。
      required:
        - type
        - media_type
        - data
      additionalProperties: false
    ManagedFileDocumentSource:
      type: object
      properties:
        type:
          type: string
          enum:
            - file
          description: 固定为 file。
        file_id:
          type: string
          minLength: 1
          description: 当前身份可访问的 File ID。
      required:
        - type
        - file_id
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        标准的 HTTP Bearer 认证方式，在 [API
        Keys](https://bigmodel.cn/usercenter/proj-mgmt/apikeys) 页面获取密钥。

````