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

# Send a chat message and stream the response via SSE

> Send a chat message to a running chat agent workflow and stream the response as Server-Sent Events.



## OpenAPI

````yaml https://spec.speakeasy.com/meibel/console/meibel-gateway-service-with-code-samples post /{blueprint_instance_id}/chat/stream
openapi: 3.1.0
info:
  title: Meibel AI API
  summary: Meibel Gateway Service
  description: >-
    Our API allows you to interact with our services.  Read
    the[docs](https://docs.mistral.ai) to learn how to use it.
  version: 0.6.1
servers:
  - url: https://api.meibel.ai/v1
    description: Meibel API
  - url: https://api.dev.meibel.ai/v1
    description: Meibel API
  - url: http://localhost:8000
    description: Local Development Server
security: []
tags:
  - name: datasources
    description: Operations with datasources
  - name: datasources.dataelements
    description: Operations with data elements
  - name: datasources.tag
    description: Operations with tag
  - name: datasources.rag
    description: Operations with rag
  - name: datasources.content
    description: Operations with content upload and management
  - name: datasources.metadata_model_catalog
    description: Operations with metadata model catalog
  - name: blueprints
    description: Operations with blueprints
  - name: blueprints.instances
    description: Operations with blueprint_instances
  - name: blueprints.executions
    description: work with executions of blueprints
  - name: confidence_scoring
    description: Operations with confidence scoring jobs and summaries
paths:
  /{blueprint_instance_id}/chat/stream:
    post:
      tags:
        - blueprints.executions
      summary: Send a chat message and stream the response via SSE
      description: >-
        Send a chat message to a running chat agent workflow and stream the
        response as Server-Sent Events.
      operationId: sendChatMessageStream
      parameters:
        - name: blueprint_instance_id
          in: path
          required: true
          schema:
            type: string
            title: Blueprint Instance Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatMessageRequest'
      responses:
        '200':
          description: Successful Response
          content:
            text/event-stream:
              x-speakeasy-sse-sentinel: '[DONE]'
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ConnectedEvent'
                  - $ref: '#/components/schemas/StatusEvent'
                  - $ref: '#/components/schemas/ToolCallEvent'
                  - $ref: '#/components/schemas/ToolResultEvent'
                  - $ref: '#/components/schemas/PartialResponseEvent'
                  - $ref: '#/components/schemas/CompletionEvent'
                discriminator:
                  propertyName: event
                  mapping:
                    connected:
                      $ref: '#/components/schemas/ConnectedEvent'
                    status:
                      $ref: '#/components/schemas/StatusEvent'
                    tool_call:
                      $ref: '#/components/schemas/ToolCallEvent'
                    tool_result:
                      $ref: '#/components/schemas/ToolResultEvent'
                    partial_response:
                      $ref: '#/components/schemas/PartialResponseEvent'
                    completion:
                      $ref: '#/components/schemas/CompletionEvent'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
      x-codeSamples:
        - lang: python
          label: Python (SDK)
          source: |-
            from meibelai import Meibelai
            import os


            with Meibelai(
                api_key_header=os.getenv("MEIBELAI_API_KEY_HEADER", ""),
            ) as m_client:

                res = m_client.blueprints.executions.send_chat_message_stream(blueprint_instance_id="<id>", user_message="<value>", timeout_seconds=None, include_thinking=False, include_tool_activity=True)

                with res as event_stream:
                    for event in event_stream:
                        # handle event
                        print(event, flush=True)
components:
  schemas:
    ChatMessageRequest:
      properties:
        user_message:
          type: string
          title: User Message
          description: The user's chat message
        timeout_seconds:
          anyOf:
            - type: integer
            - type: 'null'
          title: Timeout Seconds
        include_thinking:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Include Thinking
        include_tool_activity:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Include Tool Activity
      type: object
      required:
        - user_message
      title: ChatMessageRequest
      description: Request body for chat message endpoints.
    ConnectedEvent:
      description: >-
        A server-sent event indicating the stream connection has been
        established
      type: object
      required:
        - event
        - data
      properties:
        event:
          type: string
          const: connected
        data:
          type: object
          required:
            - signal_id
          properties:
            signal_id:
              type: string
              description: Unique identifier for this stream connection
    StatusEvent:
      description: A server-sent event containing an agent status update
      type: object
      required:
        - event
        - data
      properties:
        event:
          type: string
          const: status
        data:
          type: object
          required:
            - type
            - disposition
            - sequence
            - timestamp
            - content
          properties:
            type:
              type: string
            disposition:
              type: string
            sequence:
              type: string
            timestamp:
              type: string
            content:
              type: string
    ToolCallEvent:
      description: A server-sent event indicating the agent is calling a tool
      type: object
      required:
        - event
        - data
      properties:
        event:
          type: string
          const: tool_call
        data:
          type: object
          required:
            - type
            - disposition
            - sequence
            - timestamp
            - tool_id
            - tool_name
            - arguments
          properties:
            type:
              type: string
            disposition:
              type: string
            sequence:
              type: string
            timestamp:
              type: string
            tool_id:
              type: string
            tool_name:
              type: string
            arguments:
              type: object
    ToolResultEvent:
      description: A server-sent event containing the result of a tool call
      type: object
      required:
        - event
        - data
      properties:
        event:
          type: string
          const: tool_result
        data:
          type: object
          required:
            - type
            - disposition
            - sequence
            - timestamp
            - tool_id
            - result
          properties:
            type:
              type: string
            disposition:
              type: string
            sequence:
              type: string
            timestamp:
              type: string
            tool_id:
              type: string
            result:
              type: object
    PartialResponseEvent:
      description: A server-sent event containing an incremental response from the agent
      type: object
      required:
        - event
        - data
      properties:
        event:
          type: string
          const: partial_response
        data:
          type: object
          required:
            - type
            - disposition
            - sequence
            - timestamp
            - data
          properties:
            type:
              type: string
            disposition:
              type: string
            sequence:
              type: string
            timestamp:
              type: string
            data:
              type: object
              required:
                - message
                - clean_message
              properties:
                message:
                  type: string
                clean_message:
                  type: string
                citations:
                  type: array
                  items:
                    type: object
                sources:
                  type: array
                  items:
                    type: object
                follow_up_questions:
                  items:
                    type: string
                  type: array
                call_to_actions:
                  type: array
                  items:
                    type: object
                artifacts:
                  type: array
                  items:
                    type: object
    CompletionEvent:
      description: >-
        A server-sent event containing the final complete response from the
        agent, sent once at the end of the stream
      type: object
      required:
        - event
        - data
      properties:
        event:
          type: string
          const: completion
        data:
          type: object
          required:
            - type
            - disposition
            - sequence
            - timestamp
            - data
          properties:
            type:
              type: string
            disposition:
              type: string
            sequence:
              type: string
            timestamp:
              type: string
            data:
              type: object
              required:
                - message
                - clean_message
              properties:
                message:
                  type: string
                clean_message:
                  type: string
                citations:
                  type: array
                  items:
                    type: object
                    properties:
                      position:
                        type: integer
                      source_ids:
                        type: array
                        items:
                          type: integer
                sources:
                  type: array
                  items:
                    type: object
                    properties:
                      source_id:
                        type: integer
                      data_element_id:
                        type: string
                      title:
                        type: string
                      url:
                        type: string
                        nullable: true
                      snippet:
                        type: string
                      relevance_score:
                        type: number
                      tool_name:
                        type: string
                follow_up_questions:
                  items:
                    type: string
                  type: array
                call_to_actions:
                  type: array
                  items:
                    type: object
                artifacts:
                  type: array
                  items:
                    type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: Meibel-API-Key

````