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

# Diagnose Eval Runs



## OpenAPI

````yaml /openapi.json post /v1/api-performance/diagnose
openapi: 3.1.0
info:
  title: Lightsage Public API
  description: Public API for Lightsage CLI and external integrations.
  version: 1.0.0
servers:
  - url: https://api.lightsage.com
    description: Production
security: []
paths:
  /v1/api-performance/diagnose:
    post:
      tags:
        - API Performance
      summary: Diagnose Eval Runs
      operationId: api_performance_diagnose
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DiagnoseEvalRunsRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DiagnoseEvalRunsResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - LightsageApiKeyAuth: []
components:
  schemas:
    DiagnoseEvalRunsRequest:
      properties:
        since:
          type: string
          title: Since
          description: Lookback window, such as 20d, 72h, or an ISO timestamp.
          default: 20d
        format:
          type: string
          enum:
            - json
            - markdown
            - md
          title: Format
          description: Report format to include in the response.
          default: json
        include_examples:
          type: boolean
          title: Include Examples
          default: true
        max_examples:
          type: integer
          maximum: 50
          minimum: 1
          title: Max Examples
          default: 10
      type: object
      title: DiagnoseEvalRunsRequest
    DiagnoseEvalRunsResponse:
      properties:
        company:
          $ref: '#/components/schemas/PublicCompany'
        since:
          type: string
          title: Since
        summary:
          $ref: '#/components/schemas/DiagnosisSummary'
        failure_analysis:
          $ref: '#/components/schemas/FailureAnalysisSnapshot'
        examples:
          items:
            $ref: '#/components/schemas/EvalRunDetail'
          type: array
          title: Examples
        markdown:
          anyOf:
            - type: string
            - type: 'null'
          title: Markdown
      type: object
      required:
        - company
        - since
        - summary
        - failure_analysis
      title: DiagnoseEvalRunsResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    PublicCompany:
      properties:
        name:
          type: string
          title: Name
        domain:
          anyOf:
            - type: string
            - type: 'null'
          title: Domain
        logo_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Logo Url
        relationship:
          anyOf:
            - type: string
            - type: 'null'
          title: Relationship
      type: object
      required:
        - name
      title: PublicCompany
    DiagnosisSummary:
      properties:
        total_runs:
          type: integer
          title: Total Runs
          default: 0
        failed_runs:
          type: integer
          title: Failed Runs
          default: 0
        passed_runs:
          type: integer
          title: Passed Runs
          default: 0
        failure_rate:
          anyOf:
            - type: number
            - type: 'null'
          title: Failure Rate
        top_failed_endpoints:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Top Failed Endpoints
        top_failed_models:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Top Failed Models
        top_failure_reasons:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Top Failure Reasons
      type: object
      title: DiagnosisSummary
    FailureAnalysisSnapshot:
      properties:
        total_runs:
          type: integer
          title: Total Runs
          default: 0
        failed_runs:
          type: integer
          title: Failed Runs
          default: 0
        failure_rate:
          anyOf:
            - type: number
            - type: 'null'
          title: Failure Rate
        patterns:
          items:
            $ref: '#/components/schemas/FailurePatternSnapshot'
          type: array
          title: Patterns
        top_failure_reasons:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Top Failure Reasons
        endpoints_by_failure_count:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Endpoints By Failure Count
      type: object
      title: FailureAnalysisSnapshot
    EvalRunDetail:
      properties:
        id:
          type: string
          title: Id
        endpoint:
          anyOf:
            - $ref: '#/components/schemas/PublicEndpoint'
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Endpoint
        source:
          anyOf:
            - $ref: '#/components/schemas/EvalRunSource'
            - type: 'null'
        eval_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Eval Type
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
        model_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Model Type
        platform:
          anyOf:
            - type: string
            - type: 'null'
          title: Platform
        passed:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Passed
        score:
          anyOf:
            - type: number
            - type: 'null'
          title: Score
        failure_reasons:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Failure Reasons
        latency_ms:
          anyOf:
            - type: integer
            - type: 'null'
          title: Latency Ms
        run_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Run At
        prompt_sent:
          anyOf:
            - type: string
            - type: 'null'
          title: Prompt Sent
        response_text:
          anyOf:
            - type: string
            - type: 'null'
          title: Response Text
        execution_stdout:
          anyOf:
            - type: string
            - type: 'null'
          title: Execution Stdout
        execution_stderr:
          anyOf:
            - type: string
            - type: 'null'
          title: Execution Stderr
        exit_code:
          anyOf:
            - type: integer
            - type: 'null'
          title: Exit Code
        tool_calls:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Tool Calls
        raw:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Raw
      type: object
      required:
        - id
      title: EvalRunDetail
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    FailurePatternSnapshot:
      properties:
        pattern:
          type: string
          title: Pattern
        label:
          type: string
          title: Label
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        count:
          type: integer
          title: Count
        percentage:
          anyOf:
            - type: number
            - type: 'null'
          title: Percentage
        severity:
          anyOf:
            - type: string
            - type: 'null'
          title: Severity
        example_reasons:
          items:
            type: string
          type: array
          title: Example Reasons
        affected_endpoints:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Affected Endpoints
        affected_models:
          items:
            type: string
          type: array
          title: Affected Models
        run_ids:
          items:
            type: string
          type: array
          title: Run Ids
      type: object
      required:
        - pattern
        - label
        - count
      title: FailurePatternSnapshot
    PublicEndpoint:
      properties:
        id:
          type: string
          title: Id
        method:
          anyOf:
            - type: string
            - type: 'null'
          title: Method
        path:
          anyOf:
            - type: string
            - type: 'null'
          title: Path
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        category:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Category
      type: object
      required:
        - id
      title: PublicEndpoint
    EvalRunSource:
      properties:
        id:
          type: string
          title: Id
        type:
          anyOf:
            - type: string
            - type: 'null'
          title: Type
        label:
          anyOf:
            - type: string
            - type: 'null'
          title: Label
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
      type: object
      required:
        - id
      title: EvalRunSource
  securitySchemes:
    LightsageApiKeyAuth:
      type: apiKey
      in: header
      name: X-Lightsage-Api-Key

````