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

# Send Session Message

> Send a message within a persistent session. The agent receives full conversation history.



## OpenAPI

````yaml POST /v1/sessions/{session_id}/messages
openapi: 3.1.0
info:
  title: Stewrd API
  description: >-
    Managed AI agent infrastructure. Bring your own LLM key, send a message, get
    finished work back.
  version: 1.0.0
  contact:
    name: Stewrd Support
    email: team@stewrd.dev
    url: https://stewrd.dev
servers:
  - url: https://api.stewrd.dev
    description: Production
security:
  - bearerAuth: []
paths:
  /v1/sessions/{session_id}/messages:
    post:
      tags:
        - Sessions
      summary: Send a session message
      description: >-
        Send a message within a persistent session. The agent receives the full
        conversation history automatically.
      operationId: sendSessionMessage
      parameters:
        - name: session_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: The session ID returned from Create Session.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentRequest'
            examples:
              simple:
                summary: Send a message
                value:
                  message: Research the top 5 project management tools
              follow-up:
                summary: Follow-up message
                value:
                  message: Create a comparison table of those tools as a CSV
      responses:
        '200':
          description: Successful session message response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionMessageResponse'
            text/event-stream:
              schema:
                type: string
                description: Server-Sent Events stream. Same events as the agent endpoint.
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Session not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '410':
          description: Session expired
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: session_expired
                  message: Session expired due to inactivity.
        '429':
          description: Quota exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: Compute service error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    AgentRequest:
      type: object
      required:
        - message
      properties:
        message:
          type: string
          description: The task or question for the agent.
          example: What is the capital of France?
        capabilities:
          type: array
          items:
            type: string
            enum:
              - chat
              - research
              - documents
              - code
              - data
              - files
          description: >-
            Filter which capabilities to use for this request. Omit to use all
            capabilities enabled on the project.
        files:
          type: array
          items:
            $ref: '#/components/schemas/InputFile'
          description: Files to include with the request.
        stream:
          type: boolean
          default: false
          description: >-
            Set to `true` to receive a Server-Sent Events stream instead of a
            JSON response. Not supported when `tools` is provided.
        tools:
          type: array
          items:
            $ref: '#/components/schemas/ToolDefinition'
          description: >-
            Custom tool definitions for function calling. When provided, only
            the `chat` capability is used and streaming is disabled. Max 20
            tools per request.
          maxItems: 20
    SessionMessageResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique request identifier.
        object:
          type: string
          enum:
            - session.message
          description: Object type, always `session.message`.
        session_id:
          type: string
          format: uuid
          description: The session this message belongs to.
        message:
          type: string
          description: The agent's response message.
        capabilities_used:
          type: array
          items:
            type: string
          description: Capabilities used for this request.
        files:
          type: array
          items:
            $ref: '#/components/schemas/ResponseFile'
          description: Files generated by the agent.
        usage:
          $ref: '#/components/schemas/Usage'
        meta:
          $ref: '#/components/schemas/Meta'
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Machine-readable error code.
            message:
              type: string
              description: Human-readable error description.
            docs:
              type: string
              format: uri
              description: Link to relevant documentation.
    InputFile:
      type: object
      required:
        - name
        - content
      properties:
        name:
          type: string
          description: File name with extension.
          example: data.csv
        content:
          type: string
          description: File contents as a string.
          example: |-
            id,name,date
            1,Alice,2024-01-15
    ToolDefinition:
      type: object
      required:
        - name
        - description
        - parameters
      properties:
        name:
          type: string
          pattern: ^[a-zA-Z0-9_]+$
          maxLength: 64
          description: Tool name — alphanumeric and underscores only.
        description:
          type: string
          maxLength: 1024
          description: Description of what the tool does.
        parameters:
          type: object
          description: 'JSON Schema for the tool''s parameters. Must have `type: "object"`.'
    ResponseFile:
      type: object
      properties:
        name:
          type: string
          description: File name.
        content:
          type: string
          description: File contents as a string.
        url:
          type: string
          format: uri
          description: Download URL for the generated file (when available).
    Usage:
      type: object
      properties:
        credits_this_request:
          type: integer
          description: Credits consumed for this request. 0 on tool output continuations.
        credits_remaining:
          type: integer
          description: Credits remaining in this billing period.
        tokens_used:
          type: integer
          description: Tokens consumed for this request.
    Meta:
      type: object
      properties:
        duration_ms:
          type: integer
          description: Request processing time in milliseconds.
        project_id:
          type: string
          description: The project this request was made against.
        plan:
          type: string
          description: Your current plan.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key in the format `sk-stw_...`. Get yours at
        [stewrd.dev/dashboard](https://stewrd.dev/dashboard).

````