{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cekura-ai/json-schema/cekura-ai-result-detail-v2-schema.json",
  "title": "ResultDetailV2",
  "x-generated": "2026-10-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cekura-ai-openapi.json#/components/schemas/ResultDetailV2",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "readOnly": true
    },
    "name": {
      "type": "string",
      "description": "\nName of the result\nExample: `\"Test Result 1\"`\n",
      "maxLength": 255
    },
    "agent": {
      "type": "integer"
    },
    "agent_name": {
      "type": "string",
      "readOnly": true,
      "description": "Name of the agent associated with this result"
    },
    "agent_version": {
      "oneOf": [
        {
          "$ref": "#/$defs/AgentVersionSummary"
        },
        {
          "type": "null"
        }
      ],
      "readOnly": true,
      "description": "The agent version (history record) this result ran against, or null."
    },
    "status": {
      "enum": [
        "running",
        "completed",
        "failed",
        "pending",
        "in_progress",
        "evaluating",
        "in_queue",
        "timeout",
        "cancelled",
        "scaling_up"
      ],
      "type": "string",
      "x-spec-enum-id": "623e22fc1eb17833",
      "readOnly": true,
      "description": "\nCurrent status of the result\n\n\n* `running` - Running\n* `completed` - Completed\n* `failed` - Failed\n* `pending` - Pending\n* `in_progress` - In Progress\n* `evaluating` - Evaluating\n* `in_queue` - In Queue\n* `timeout` - Timeout\n* `cancelled` - Cancelled\n* `scaling_up` - Scaling Up"
    },
    "met_expected_outcome_count": {
      "type": "string",
      "readOnly": true,
      "description": "Number of runs that fully met their expected outcomes with a score of 100"
    },
    "total_expected_outcome_count": {
      "type": "string",
      "readOnly": true,
      "description": "Total number of runs that had expected outcomes defined"
    },
    "success_rate": {
      "type": "number",
      "format": "double",
      "readOnly": true,
      "description": "\nSuccess rate of the test runs\n"
    },
    "run_as_text": {
      "type": "boolean",
      "readOnly": true,
      "description": "\nWhether this test was run in text mode instead of voice mode\nExample: `true` or `false`\n"
    },
    "is_cronjob": {
      "type": "string",
      "readOnly": true,
      "description": "Whether this result was created by a scheduled cronjob"
    },
    "created_via": {
      "type": [
        "string",
        "null"
      ],
      "readOnly": true,
      "description": "How this result was started: user (dashboard), api, mcp, cli, sdk, schedule or agent (the Cekura agent). Null when unknown."
    },
    "created_by": {
      "oneOf": [
        {
          "$ref": "#/$defs/UserInline"
        },
        {
          "type": "null"
        }
      ],
      "readOnly": true,
      "description": "The user who started this result, or who created the schedule it ran from. Null for API runs."
    },
    "api_key": {
      "oneOf": [
        {
          "$ref": "#/$defs/ResultApiKey"
        },
        {
          "type": "null"
        }
      ],
      "readOnly": true,
      "description": "The API key that started this result as {id, name, created_by}, or null. created_by is the user who created the key, when known."
    },
    "runs": {
      "type": "object",
      "additionalProperties": {},
      "description": "Run objects keyed by run ID string (e.g. {\"12345\": {...}}). The list endpoint returns `runs` as an array of summaries instead.",
      "readOnly": true
    },
    "overall_evaluation": {
      "oneOf": [
        {},
        {
          "type": "null"
        }
      ],
      "readOnly": true,
      "description": "\nOverall evaluation of the test runs\nExample:\n```json\n{\n    \"success_rate\": \"number\",\n    \"metric_summary\": {\n      \"metric_id\": {\n        \"id\": \"integer\",\n        \"name\": \"string\",\n        \"type\": \"string\",\n        \"score\": \"number\",\n        \"explanation\": \"string (optional)\",\n        \"function_name\": \"string\",\n        \"vocera_defined_metric_code\": \"string (optional)\",\n        \"p50\": \"number (for numeric metrics)\"\n      }\n    },\n    \"worst_performing_metrics\": {\n      \"binary_adherence\": [\n        \"array of metric_ids\"\n      ]\n    },\n    \"numeric_metrics\": [\n      {\n        \"name\": \"string\",\n        \"type\": \"numeric\",\n        \"value\": \"number\",\n        \"percentiles\": {\n          \"p50\": \"number\"\n        }\n      }\n    ],\n    \"enum_metrics\": [\n      \"array of metric_ids\"\n    ],\n    \"extra_metrics\": [\n      {\n        \"name\": \"string (e.g., 'Expected Outcome', 'Average Ringing Duration')\",\n        \"type\": \"string\",\n        \"value\": \"number\",\n        \"percentiles\": {\n          \"p50\": \"number (optional)\"\n        }\n      }\n    ]\n}\n"
    },
    "total_duration": {
      "type": "string",
      "readOnly": true,
      "description": "\nTotal duration of the test runs for this result\nExample: `22:30`\n"
    },
    "total_runs_count": {
      "type": "string",
      "readOnly": true,
      "description": "\nTotal number of test runs associated with this result\nExample: `10`\n"
    },
    "completed_runs_count": {
      "type": "string",
      "readOnly": true,
      "description": "\nNumber of test runs that have completed successfully\nExample: `10`\n"
    },
    "success_runs_count": {
      "type": "string",
      "readOnly": true,
      "description": "\nNumber of test runs that were marked as successful\nExample: `10`\n"
    },
    "failed_runs_count": {
      "type": "string",
      "readOnly": true,
      "description": "\nNumber of test runs that failed or encountered errors\nExample: `10`\n"
    },
    "connected_runs": {
      "type": "string",
      "readOnly": true,
      "description": "List of run IDs that got connected successfully (have transcript data). Returns empty list if no connected runs."
    },
    "not_connected_runs": {
      "type": "string",
      "readOnly": true,
      "description": "List of run IDs that never connected (no transcript data). Returns empty list if every run connected."
    },
    "failed_infrastructure_runs": {
      "type": "string",
      "readOnly": true,
      "description": "List of run IDs that failed infrastructure issues metric (score=0). Returns null if metric not found, empty list if metric exists but no failures."
    },
    "failed_workflow_runs": {
      "type": "string",
      "readOnly": true,
      "description": "List of run IDs that failed expected outcome metric (score=0). Returns null if metric not found, empty list if metric exists but no failures."
    },
    "successful_calls": {
      "type": "string",
      "readOnly": true,
      "description": "List of run IDs that completed successfully. Returns empty list if no successful runs."
    },
    "scenarios": {
      "type": "string",
      "readOnly": true,
      "description": "\nList of scenario names used in the test runs for this result\nExample: ```\n```json\n[\n    {\n        \"id\": 123,\n        \"name\": \"Scenario 1\"\n    },\n    {\n        \"id\": 456,\n        \"name\": \"Scenario 2\"\n    }\n]\n```\n"
    },
    "critical_categories": {
      "type": "string",
      "readOnly": true,
      "description": "\nList of critical categories for this result\nExample:\n```json\n[\n    {\n      \"id\": 2950,\n      \"name\": \"Pronunciation Analysis\",\n      \"eval_type\": \"continuous_qualitative\",\n      \"simulation_enabled\": true,\n      \"observability_enabled\": true\n    },\n    {\n      \"id\": 3284,\n      \"name\": \"Latency\",\n      \"eval_type\": \"numeric\",\n      \"simulation_enabled\": true,\n      \"observability_enabled\": false\n    },\n    {\n      \"id\": 3295,\n      \"name\": \"Detect Silence in Conversation\",\n      \"eval_type\": \"binary\",\n      \"simulation_enabled\": true,\n      \"observability_enabled\": true\n    }\n  ]\n```\n"
    },
    "metrics": {
      "type": "string",
      "readOnly": true
    },
    "runs_by_tags": {
      "type": "string",
      "readOnly": true
    },
    "latency_data": {
      "type": "string",
      "readOnly": true
    },
    "failed_reasons": {
      "oneOf": [
        {},
        {
          "type": "null"
        }
      ],
      "readOnly": true,
      "description": "\nFailed reasons of the test runs\nExample:\n```json\n{\n    \"issues\": [\n      {\n        \"rank\": 1,\n        \"run_ids\": [\n          34588\n        ],\n        \"description\": \"The agent did not provide the standard greeting, emergency disclaimer, or ask how they could help.\",\n        \"affected_count\": 1\n      },\n      {\n        \"rank\": 2,\n        \"run_ids\": [\n          34588\n        ],\n        \"description\": \"The agent did not explain the distinction between the primary care and express clinics.\",\n        \"affected_count\": 1\n      }\n    ],\n    \"total_failed_runs\": 1\n  }\n```\n"
    },
    "ai_summary": {
      "oneOf": [
        {},
        {
          "type": "null"
        }
      ],
      "readOnly": true,
      "description": "\nLLM-generated narrative summary of the result, structured for the Results-page UI.\nExample:\n```json\n{\n    \"what_happened\": \"8 of 10 runs failed, 2 passed. All 8 failures cluster into 3 distinct causes.\",\n    \"why_it_happened\": \"The default test profile isn't seeded in the production backend, so every auth-required workflow exits before PIN/address steps run.\",\n    \"how_to_fix\": \"Seed the test profile in production, tighten the competitor-mention guardrail, and add CA-only store phrasing to the FAQ flow.\",\n    \"generated_from_runs_count\": 10,\n    \"generated_at\": \"2026-05-25T12:00:00Z\"\n}\n```\n"
    },
    "ai_summary_status": {
      "type": "string",
      "readOnly": true,
      "description": "Generation state of the async AI summary, derived so the UI can show a reliable state instead of guessing from an empty `ai_summary`. `completed` = summary populated; `skipped_no_failures` = no failed runs, nothing to summarize; `pending` = there are failed runs but the summary isn't ready yet (still generating)."
    },
    "next_steps": {
      "oneOf": [
        {},
        {
          "type": "null"
        }
      ],
      "readOnly": true,
      "description": "\nLLM-suggested next steps to fix the issues found in this result, ordered by impact.\nExample:\n```json\n[\n    {\"title\": \"Seed test profile in production\", \"description\": \"Unblocks 6 runs; ~5 min.\"},\n    {\"title\": \"Tighten competitor guardrail\", \"description\": \"1 prompt edit; review drift run.\"}\n]\n```\n"
    },
    "path_coverage": {
      "oneOf": [
        {},
        {
          "type": "null"
        }
      ],
      "readOnly": true,
      "description": "\nWorkflow-coverage summary for this result: which of the agent's critical paths the\nruns exercised, and which they missed.\nExample:\n```json\n{\n    \"coverage_pct\": 66.7,\n    \"total_paths\": 3,\n    \"covered_paths\": [\"Book appointment\", \"Reschedule appointment\"],\n    \"uncovered_paths\": [\"Cancel appointment\"],\n    \"generated_at\": \"2026-07-14T12:00:00Z\"\n}\n```\n"
    },
    "performance_metrics": {
      "type": "string",
      "readOnly": true,
      "description": "Per-rubric-rule performance breakdown. One entry per rule in the project's rubric_config: metric name, aggregated value across the result's runs, and whether that aggregate meets the rule's conditions."
    },
    "run_type": {
      "type": [
        "string",
        "null"
      ],
      "readOnly": true,
      "description": "Run Execution Type"
    },
    "run_settings": {
      "oneOf": [
        {},
        {
          "type": "null"
        }
      ],
      "readOnly": true,
      "description": "Snapshot of the override-relevant request payload (personality_ids, frequency, concurrency_limit, connection-specific overrides, etc.)."
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "\nTimestamp when this test result was created\nExample: `2021-01-01 00:00:00`\n"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "readOnly": true,
      "description": "\nTimestamp when this test result was last updated\nExample: `2021-01-01 00:00:00`\n"
    }
  },
  "required": [
    "agent"
  ],
  "$defs": {
    "AgentVersionSummary": {
      "type": "object",
      "properties": {
        "history_id": {
          "type": "integer",
          "description": "History record ID of the agent version"
        },
        "version_id": {
          "type": [
            "string",
            "null"
          ],
          "description": "Version label, e.g. \"v12\""
        },
        "version_name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Optional name given to the version"
        },
        "is_current": {
          "type": "boolean",
          "description": "Whether this is the agent's current version"
        }
      },
      "required": [
        "history_id",
        "is_current",
        "version_id",
        "version_name"
      ]
    },
    "ResultApiKey": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer"
        },
        "name": {
          "type": "string"
        },
        "created_by": {
          "oneOf": [
            {
              "$ref": "#/$defs/UserInline"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "created_by",
        "id",
        "name"
      ]
    },
    "UserInline": {
      "type": "object",
      "description": "",
      "properties": {
        "id": {
          "type": [
            "integer",
            "null"
          ],
          "readOnly": true
        },
        "name": {
          "type": "string",
          "maxLength": 255
        },
        "email": {
          "type": [
            "string",
            "null"
          ],
          "format": "email",
          "readOnly": true
        }
      },
      "required": [
        "name"
      ]
    }
  }
}