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

# Send Instance Message

> Stream a message to a specific agent instance.

Resolves the agent instance's runner URL and streams the SSE response
back to the client. This is the second hop in the two-hop routing pattern.

Agent instances, agent types, and agent resources all live in the
tenant SurrealDB namespace; the dependency on ``get_surrealdb_client``
resolves the right namespace through the auth chain, and the
namespace itself is the organization boundary.

Returns:
    SSE stream of the agent's response.

Raises:
    NotFoundError: If instance not found in this namespace.
    AgentInvokerError: If runner resolution or streaming fails.



## OpenAPI

````yaml https://api.pragmatiks.io/openapi.json post /agents/instances/{instance_id}/messages
openapi: 3.1.0
info:
  title: Pragma API
  version: 0.1.0
servers: []
security: []
paths:
  /agents/instances/{instance_id}/messages:
    post:
      tags:
        - conversation-routing
      summary: Send Instance Message
      description: >-
        Stream a message to a specific agent instance.


        Resolves the agent instance's runner URL and streams the SSE response

        back to the client. This is the second hop in the two-hop routing
        pattern.


        Agent instances, agent types, and agent resources all live in the

        tenant SurrealDB namespace; the dependency on ``get_surrealdb_client``

        resolves the right namespace through the auth chain, and the

        namespace itself is the organization boundary.


        Returns:
            SSE stream of the agent's response.

        Raises:
            NotFoundError: If instance not found in this namespace.
            AgentInvokerError: If runner resolution or streaming fails.
      operationId: conversation-routing-send_instance_message
      parameters:
        - name: instance_id
          in: path
          required: true
          schema:
            type: string
            title: Instance Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InstanceMessage'
      responses:
        '200':
          description: Successful Response
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    InstanceMessage:
      properties:
        message:
          type: string
          title: Message
        session_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Session Id
      type: object
      required:
        - message
      title: InstanceMessage
      description: |-
        Request body for sending a message to a specific agent instance.

        Attributes:
            message: The user message to send.
            session_id: Session ID for conversation continuity. New session if None.
    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
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````