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

# Send agent message (SSE stream)

> Same body shape as the sync endpoint. Returns a Server-Sent Events stream. Inspect the `conversation-id` event for the conversation public ID, accumulate `text-delta` events for the reply text, and the `debug-info` event surfaces tokens, model and cost. Pre-flight failures (insufficient ops, agent not published, etc.) are emitted as a single `error` event with HTTP 200 — SSE clients should parse the body.



## OpenAPI

````yaml /api-reference/openapi.json post /public/api/v1/agents/{agentPublicId}/messages/stream
openapi: 3.1.0
info:
  contact:
    email: support@gennia.ai
    name: Gennia Support
    url: https://gennia.ai
  description: >-
    Workspace-scoped API authenticated via workspace API key (header `X-Api-Key:
    gsk_...` or `Authorization: Bearer gsk_...`).
  title: Gennia Public API
  version: v1
servers:
  - description: Production
    url: https://api.gennia.ai
security:
  - workspaceApiKey: []
tags:
  - description: Slash commands available inside the agent chat.
    name: Agent Commands
  - description: Link skills to an agent.
    name: Agent Skills
  - description: Read/rename/delete workspace knowledge sources.
    name: Knowledge Sources
  - description: Link knowledge sources to an agent.
    name: Agent Knowledge Sources
  - description: Workspace CRUD for HTTP/DB/Custom tools.
    name: HTTP Tools
  - description: Read/write the agent's model selection + capabilities.
    name: Agent Model
  - description: Discover trigger types available for Native MCP toolkits.
    name: Native MCP Triggers
  - description: Discover and toggle capability features.
    name: Agent Features
  - description: Hub access settings.
    name: Hub Access
  - description: Read conversation history and delete conversations.
    name: Conversations
  - description: Send messages to a published agent.
    name: Messages
  - description: Workspace CRUD for External MCP servers.
    name: External MCPs
  - description: Hub billing — plans, coupons, credit packages.
    name: Billing
  - description: External links shown in the hub menu.
    name: Hub External Links
  - description: Link Native MCP (Composio) instances to an agent.
    name: Agent Native MCPs
  - description: Manage AI agents in the workspace bound to the API key.
    name: Agents
  - description: Read published version snapshots and restore.
    name: Agent Versions
  - description: Read/rename/delete workspace skills.
    name: Skills
  - description: Manage hub end-customers (client workspaces).
    name: Clients
  - description: Hub domain (subdomain) management.
    name: Hub Domain
  - description: Read/write the agent's prompt context.
    name: Agent Prompt
  - description: Scheduled / trigger-based runs of an agent.
    name: Agent Automations
  - description: Link HTTP/DB/Custom tools to an agent.
    name: Agent HTTP Tools
  - description: Hub identity, branding, logos and overall configuration.
    name: Hub
  - description: Discover AI models available to this workspace.
    name: AI Models
  - description: Discover channel types and their config schemas.
    name: Channel Types
  - description: Connect agents to messaging surfaces.
    name: Agent Channels
  - description: Link workspace-registered External MCP servers to an agent.
    name: Agent External MCPs
  - description: Workspace-scoped public API (API key authentication)
    name: Public API
  - description: Dynamic-prompt variable definitions.
    name: Agent Variables
  - description: Link sub-agents as delegation targets.
    name: Agent Sub-agents
paths:
  /public/api/v1/agents/{agentPublicId}/messages/stream:
    post:
      tags:
        - Messages
      summary: Send agent message (SSE stream)
      description: >-
        Same body shape as the sync endpoint. Returns a Server-Sent Events
        stream. Inspect the `conversation-id` event for the conversation public
        ID, accumulate `text-delta` events for the reply text, and the
        `debug-info` event surfaces tokens, model and cost. Pre-flight failures
        (insufficient ops, agent not published, etc.) are emitted as a single
        `error` event with HTTP 200 — SSE clients should parse the body.
      operationId: streamMessage
      parameters:
        - description: Agent public ID
          in: path
          name: agentPublicId
          required: true
          schema:
            format: uuid
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendPublicAgentMessageDTO'
        required: true
      responses:
        '200':
          content:
            text/event-stream:
              schema:
                items:
                  $ref: '#/components/schemas/ServerSentEventString'
                type: array
          description: SSE stream begins
        '400':
          content:
            text/event-stream:
              schema:
                items:
                  $ref: '#/components/schemas/ServerSentEventString'
                type: array
          description: Validation failed
        '401':
          content:
            text/event-stream:
              schema:
                items:
                  $ref: '#/components/schemas/ServerSentEventString'
                type: array
          description: Missing or invalid API key
        '404':
          content:
            text/event-stream:
              schema:
                items:
                  $ref: '#/components/schemas/ServerSentEventString'
                type: array
          description: Agent or conversation not found
      security:
        - workspaceApiKey: []
components:
  schemas:
    SendPublicAgentMessageDTO:
      description: Body for sending a message to an agent (sync or streaming).
      properties:
        attachments:
          description: Optional attachments to include with this message (max 10).
          items:
            $ref: '#/components/schemas/PublicAttachmentDTO'
          maxItems: 10
          minItems: 0
          type: array
        content:
          description: Message text. May be empty when at least one attachment is provided.
          example: Hi, can you summarize my latest invoices?
          maxLength: 32000
          minLength: 0
          type: string
        conversationId:
          description: >-
            Continue this conversation. Omit to create a new conversation or
            reuse one for the externalUserId.
          example: 9c3a4d22-1a8d-4b3f-9b1e-7a0f0c4f3e21
          format: uuid
          type: string
        externalUserId:
          description: >-
            Stable end-user identifier. Auto-generated UUID if omitted on a new
            conversation.
          example: user_42
          maxLength: 255
          minLength: 0
          type: string
        isTest:
          description: >-
            Only honored when CREATING a new conversation. true excludes the
            conversation from the Studio inbox. Ignored when continuing an
            existing conversation.
          example: false
          type: boolean
        metadata:
          additionalProperties:
            type: object
          description: >-
            Arbitrary JSON metadata; stored on the conversation (first message
            only).
          type: object
        timeoutSeconds:
          description: >-
            Sync-only: max wall-clock seconds to block before returning 408.
            Ignored by the stream endpoint.
          example: 60
          format: int32
          maximum: 300
          minimum: 1
          type: integer
      type: object
    ServerSentEventString:
      type: object
    PublicAttachmentDTO:
      properties:
        base64:
          type: string
        filename:
          maxLength: 512
          minLength: 0
          type: string
        mediaType:
          maxLength: 255
          minLength: 0
          type: string
        url:
          maxLength: 2048
          minLength: 0
          type: string
      type: object
  securitySchemes:
    workspaceApiKey:
      in: header
      name: X-Api-Key
      type: apiKey

````