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

# Create a session



## OpenAPI

````yaml POST /session
openapi: 3.0.3
info:
  title: LiteLLM Agent Platform API
  description: >-
    Unified API for the LiteLLM Agent Platform — gateway, agents, sessions, and
    runtimes.
  version: 0.1.0
servers:
  - url: https://litellm-rust.onrender.com
    description: Production
  - url: http://localhost:4000
    description: Local (Docker Compose)
security:
  - BearerAuth: []
tags:
  - name: System
  - name: Models
  - name: Messages
  - name: API Keys
  - name: Agents
  - name: Sessions
  - name: Runtimes
  - name: MCP
paths:
  /session:
    post:
      tags:
        - Sessions
      summary: Create a session
      operationId: createSession
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSessionRequest'
      responses:
        '200':
          description: Session created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Session'
        '401':
          description: Unauthorized
      security:
        - BearerAuth: []
components:
  schemas:
    CreateSessionRequest:
      type: object
      properties:
        title:
          type: string
        agent:
          type: string
          description: >-
            Agent ID or configured harness ID. For local DB agents, use
            `agent_id` or `agent`.
        agent_id:
          type: string
        harness:
          type: string
        runtime:
          type: string
          description: >-
            Built-in runtime ID or runtime harness alias. When present, creates
            a runtime-backed session.
          example: cursor
        prompt:
          type: string
          description: >-
            Optional initial prompt. If present, the runtime session starts
            immediately.
        environment:
          type: object
          description: Runtime-specific environment settings
          properties:
            repository:
              type: string
              example: https://github.com/your-org/your-repo
            ref:
              type: string
              example: main
            auto_create_pr:
              type: boolean
              default: false
        timezone:
          type: string
          example: America/Los_Angeles
        tz:
          type: string
          example: America/Los_Angeles
    Session:
      type: object
      properties:
        id:
          type: string
        title:
          type: string
        agent:
          type: string
        agent_id:
          type: string
        harness:
          type: string
        runtime:
          type: string
        runtime_agent_ref_id:
          type: string
          nullable: true
        provider_session_id:
          type: string
          nullable: true
        provider_run_id:
          type: string
          nullable: true
        status:
          type: string
          enum:
            - pending
            - running
            - idle
            - error
          example: idle
        environment:
          type: object
        time:
          type: object
          properties:
            created:
              type: integer
              format: int64
            updated:
              type: integer
              format: int64
              nullable: true
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: 'Your LITELLM_MASTER_KEY. Default for local Docker Compose: `sk-local`'

````