LangWatch Scenario Events API

The Scenario Events API from LangWatch — 1 operation(s) for scenario events.

Documentation

Specifications

OpenAPI Specification

langwatch-scenario-events-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: LangWatch Agents Scenario Events API
  version: 1.0.0
  description: LangWatch openapi spec
servers:
- url: https://app.langwatch.ai
security:
- project_api_key: []
tags:
- name: Scenario Events
paths:
  /api/scenario-events:
    post:
      responses:
        '201':
          description: Event created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  url:
                    type:
                    - string
                    - 'null'
                required:
                - success
        '400':
          description: Invalid event data
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                - error
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                required:
                - error
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                required:
                - error
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                required:
                - error
      operationId: postApiScenario-events
      parameters: []
      description: Create a new scenario event
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
              - type: object
                properties:
                  type:
                    type: string
                    const: SCENARIO_RUN_STARTED
                  timestamp:
                    type: number
                  rawEvent: {}
                  batchRunId:
                    type: string
                  scenarioId:
                    type: string
                  scenarioRunId:
                    type: string
                  scenarioSetId:
                    type: string
                    default: default
                  metadata:
                    type: object
                    properties:
                      name:
                        type: string
                      description:
                        type: string
                      langwatch:
                        type: object
                        properties:
                          targetReferenceId:
                            type: string
                          targetType:
                            type: string
                            enum:
                            - prompt
                            - http
                            - code
                            - workflow
                          simulationSuiteId:
                            type: string
                        required:
                        - targetReferenceId
                        - targetType
                    additionalProperties: true
                required:
                - type
                - timestamp
                - batchRunId
                - scenarioId
                - scenarioRunId
                - metadata
              - type: object
                properties:
                  type:
                    type: string
                    const: SCENARIO_RUN_FINISHED
                  timestamp:
                    type: number
                  rawEvent: {}
                  batchRunId:
                    type: string
                  scenarioId:
                    type: string
                  scenarioRunId:
                    type: string
                  scenarioSetId:
                    type: string
                    default: default
                  status:
                    type: string
                    enum:
                    - SUCCESS
                    - ERROR
                    - CANCELLED
                    - IN_PROGRESS
                    - PENDING
                    - FAILED
                    - STALLED
                    - QUEUED
                    - RUNNING
                  results:
                    type:
                    - object
                    - 'null'
                    properties:
                      verdict:
                        type: string
                        enum:
                        - success
                        - failure
                        - inconclusive
                      reasoning:
                        type: string
                      metCriteria:
                        type: array
                        items:
                          type: string
                      unmetCriteria:
                        type: array
                        items:
                          type: string
                      error:
                        type: string
                    required:
                    - verdict
                    - metCriteria
                    - unmetCriteria
                required:
                - type
                - timestamp
                - batchRunId
                - scenarioId
                - scenarioRunId
                - status
              - type: object
                properties:
                  type:
                    type: string
                    const: SCENARIO_MESSAGE_SNAPSHOT
                  timestamp:
                    type: number
                  rawEvent: {}
                  messages:
                    type: array
                    items:
                      allOf:
                      - anyOf:
                        - oneOf:
                          - type: object
                            properties:
                              id:
                                type: string
                              role:
                                type: string
                                const: developer
                              content:
                                type: string
                              name:
                                type: string
                              encryptedValue:
                                type: string
                            required:
                            - id
                            - role
                            - content
                          - type: object
                            properties:
                              id:
                                type: string
                              role:
                                type: string
                                const: system
                              content:
                                type: string
                              name:
                                type: string
                              encryptedValue:
                                type: string
                            required:
                            - id
                            - role
                            - content
                          - type: object
                            properties:
                              id:
                                type: string
                              role:
                                type: string
                                const: assistant
                              content:
                                type: string
                              name:
                                type: string
                              encryptedValue:
                                type: string
                              toolCalls:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    id:
                                      type: string
                                    type:
                                      type: string
                                      const: function
                                    function:
                                      type: object
                                      properties:
                                        name:
                                          type: string
                                        arguments:
                                          type: string
                                      required:
                                      - name
                                      - arguments
                                    encryptedValue:
                                      type: string
                                  required:
                                  - id
                                  - type
                                  - function
                            required:
                            - id
                            - role
                          - type: object
                            properties:
                              id:
                                type: string
                              role:
                                type: string
                                const: user
                              content:
                                anyOf:
                                - type: string
                                - type: array
                                  items:
                                    oneOf:
                                    - type: object
                                      properties:
                                        type:
                                          type: string
                                          const: text
                                        text:
                                          type: string
                                      required:
                                      - type
                                      - text
                                    - type: object
                                      properties:
                                        type:
                                          type: string
                                          const: image
                                        source:
                                          oneOf:
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                const: data
                                              value:
                                                type: string
                                              mimeType:
                                                type: string
                                            required:
                                            - type
                                            - value
                                            - mimeType
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                const: url
                                              value:
                                                type: string
                                              mimeType:
                                                type: string
                                            required:
                                            - type
                                            - value
                                        metadata: {}
                                      required:
                                      - type
                                      - source
                                    - type: object
                                      properties:
                                        type:
                                          type: string
                                          const: audio
                                        source:
                                          oneOf:
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                const: data
                                              value:
                                                type: string
                                              mimeType:
                                                type: string
                                            required:
                                            - type
                                            - value
                                            - mimeType
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                const: url
                                              value:
                                                type: string
                                              mimeType:
                                                type: string
                                            required:
                                            - type
                                            - value
                                        metadata: {}
                                      required:
                                      - type
                                      - source
                                    - type: object
                                      properties:
                                        type:
                                          type: string
                                          const: video
                                        source:
                                          oneOf:
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                const: data
                                              value:
                                                type: string
                                              mimeType:
                                                type: string
                                            required:
                                            - type
                                            - value
                                            - mimeType
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                const: url
                                              value:
                                                type: string
                                              mimeType:
                                                type: string
                                            required:
                                            - type
                                            - value
                                        metadata: {}
                                      required:
                                      - type
                                      - source
                                    - type: object
                                      properties:
                                        type:
                                          type: string
                                          const: document
                                        source:
                                          oneOf:
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                const: data
                                              value:
                                                type: string
                                              mimeType:
                                                type: string
                                            required:
                                            - type
                                            - value
                                            - mimeType
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                const: url
                                              value:
                                                type: string
                                              mimeType:
                                                type: string
                                            required:
                                            - type
                                            - value
                                        metadata: {}
                                      required:
                                      - type
                                      - source
                                    - type: object
                                      properties:
                                        type:
                                          type: string
                                          const: binary
                                        mimeType:
                                          type: string
                                        id:
                                          type: string
                                        url:
                                          type: string
                                        data:
                                          type: string
                                        filename:
                                          type: string
                                      required:
                                      - type
                                      - mimeType
                              name:
                                type: string
                              encryptedValue:
                                type: string
                            required:
                            - id
                            - role
                            - content
                          - type: object
                            properties:
                              id:
                                type: string
                              content:
                                type: string
                              role:
                                type: string
                                const: tool
                              toolCallId:
                                type: string
                              error:
                                type: string
                              encryptedValue:
                                type: string
                            required:
                            - id
                            - content
                            - role
                            - toolCallId
                          - type: object
                            properties:
                              id:
                                type: string
                              role:
                                type: string
                                const: activity
                              activityType:
                                type: string
                              content:
                                type: object
                                additionalProperties: {}
                            required:
                            - id
                            - role
                            - activityType
                            - content
                          - type: object
                            properties:
                              id:
                                type: string
                              role:
                                type: string
                                const: reasoning
                              content:
                                type: string
                              encryptedValue:
                                type: string
                            required:
                            - id
                            - role
                            - content
                        - type: object
                          properties:
                            role:
                              anyOf:
                              - type: string
                                const: system
                              - type: string
                                const: user
                              - type: string
                                const: assistant
                              - type: string
                                const: function
                              - type: string
                                const: tool
                              - type: string
                                const: unknown
                            content:
                              anyOf:
                              - type: string
                              - type: array
                                items:
                                  anyOf:
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        const: text
                                      text:
                                        type: string
                                    required:
                                    - type
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        const: text
                                      content:
                                        type: string
                                    required:
                                    - type
                                  - type: object
                                    properties:
                                      text:
                                        type: string
                                    required:
                                    - text
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        const: image_url
                                      image_url:
                                        type: object
                                        properties:
                                          url:
                                            type: string
                                          detail:
                                            anyOf:
                                            - type: string
                                              const: auto
                                            - type: string
                                              const: low
                                            - type: string
                                              const: high
                                        required:
                                        - url
                                    required:
                                    - type
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        const: tool_call
                                      toolName:
                                        type: string
                                      toolCallId:
                                        type: string
                                      args:
                                        type: string
                                    required:
                                    - type
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        const: tool_result
                                      toolName:
                                        type: string
                                      toolCallId:
                                        type: string
                                      result: {}
                                    required:
                                    - type
                              - type: 'null'
                            parts:
                              type: array
                              items:
                                anyOf:
                                - type: object
                                  properties:
                                    type:
                                      type: string
                                      const: text
                                    text:
                                      type: string
                                  required:
                                  - type
                                - type: object
                                  properties:
                                    type:
                                      type: string
                                      const: text
                                    content:
                                      type: string
                                  required:
                                  - type
                                - type: object
                                  properties:
                                    text:
                                      type: string
                                  required:
                                  - text
                                - type: object
                                  properties:
                                    type:
                                      type: string
                                      const: image_url
                                    image_url:
                                      type: object
                                      properties:
                                        url:
                                          type: string
                                        detail:
                                          anyOf:
                                          - type: string
                                            const: auto
                                          - type: string
                                            const: low
                                          - type: string
                                            const: high
                                      required:
                                      - url
                                  required:
                                  - type
                                - type: object
                                  properties:
                                    type:
                                      type: string
                                      const: tool_call
                                    toolName:
                                      type: string
                                    toolCallId:
                                      type: string
                                    args:
                                      type: string
                                  required:
                                  - type
                                - type: object
                                  properties:
                                    type:
                                      type: string
                                      const: tool_result
                                    toolName:
                                      type: string
                                    toolCallId:
                                      type: string
                                    result: {}
                                  required:
                                  - type
                            function_call:
                              type:
                              - object
                              - 'null'
                              properties:
                                name:
                                  type: string
                                arguments:
                                  type: string
                            tool_calls:
                              type:
                              - array
                              - 'null'
                              items:
                                type: object
                                properties:
                                  id:
                                    type: string
                                  type:
                                    type: string
                                  function:
                                    type: object
                                    properties:
                                      name:
                                        type: string
                                      arguments:
                                        type: string
                                required:
                                - id
                                - type
                                - function
                            tool_call_id:
                              type:
                              - string
                              - 'null'
                            name:
                              type:
                              - string
                              - 'null'
                            reasoning_content:
                              type:
                              - string
                              - 'null'
                      - type: object
                        properties:
                          id:
                            type: string
                          trace_id:
                            type: string
                  batchRunId:
                    type: string
                  scenarioId:
                    type: string
                  scenarioRunId:
                    type: string
                  scenarioSetId:
                    type: string
                    default: default
                required:
                - type
                - timestamp
                - messages
                - batchRunId
                - scenarioId
                - scenarioRunId
              - type: object
                properties:
                  type:
                    type: string
                    const: SCENARIO_TEXT_MESSAGE_START
                  timestamp:
                    type: number
                  rawEvent: {}
                  batchRunId:
                    type: string
                  scenarioId:
                    type: string
   

# --- truncated at 32 KB (39 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/langwatch/refs/heads/main/openapi/langwatch-scenario-events-api-openapi.yml