{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cekura-ai/json-schema/cekura-ai-agent-improvement-session-schema.json",
  "title": "AgentImprovementSession",
  "description": "Read view of an Improve-Agent session — what the frontend polls to\ntrack progress. `provider_key` and other secrets are never serialized.\nThe raw `proposal` (full prompt bodies + applied diff values) stays\nserver-side; the API exposes a trimmed `proposal_summary` instead.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cekura-ai-observability-api-openapi.yml#/components/schemas/AgentImprovementSession",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "readOnly": true
    },
    "project": {
      "type": [
        "integer",
        "null"
      ],
      "readOnly": true
    },
    "agent": {
      "type": [
        "integer",
        "null"
      ],
      "readOnly": true
    },
    "agent_name": {
      "type": "string",
      "readOnly": true,
      "default": ""
    },
    "provider": {
      "type": "string",
      "readOnly": true
    },
    "source": {
      "enum": [
        "call_log",
        "scenario",
        "run"
      ],
      "type": "string",
      "description": "* `call_log` - Call Log\n* `scenario` - Scenario\n* `run` - Run",
      "x-spec-enum-id": "7a464211ef729f6c",
      "readOnly": true
    },
    "current_phase": {
      "type": "string",
      "readOnly": true
    },
    "insights": {
      "readOnly": true
    },
    "call_log_ids": {
      "readOnly": true
    },
    "run_ids": {
      "readOnly": true
    },
    "scenario_ids": {
      "readOnly": true
    },
    "status": {
      "enum": [
        "pending",
        "running",
        "succeeded",
        "failed",
        "no_improvement",
        "cancelled"
      ],
      "type": "string",
      "description": "* `pending` - Pending\n* `running` - Running\n* `succeeded` - Succeeded\n* `failed` - Failed\n* `no_improvement` - No Improvement\n* `cancelled` - Cancelled",
      "x-spec-enum-id": "c381800a059557a1",
      "readOnly": true
    },
    "stage": {
      "enum": [
        "setup",
        "scenario_generation",
        "reproduce",
        "force",
        "baseline_run",
        "propose",
        "apply",
        "verify_run",
        "finalize",
        null
      ],
      "type": [
        "string",
        "null"
      ],
      "description": "* `setup` - Setup\n* `scenario_generation` - Scenario Generation\n* `reproduce` - Reproduce\n* `force` - Force\n* `baseline_run` - Baseline Run\n* `propose` - Propose\n* `apply` - Apply\n* `verify_run` - Verify Run\n* `finalize` - Finalize",
      "x-spec-enum-id": "994fc0ee8cd8c795",
      "readOnly": true
    },
    "stage_status": {
      "enum": [
        "running",
        "waiting",
        "waiting_input",
        "done",
        "failed",
        null
      ],
      "type": [
        "string",
        "null"
      ],
      "description": "* `running` - Running\n* `waiting` - Waiting\n* `waiting_input` - Waiting Input\n* `done` - Done\n* `failed` - Failed",
      "x-spec-enum-id": "8a59077dd595b0eb",
      "readOnly": true
    },
    "stage_started_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "readOnly": true
    },
    "stage_history": {
      "readOnly": true
    },
    "baseline_result": {
      "type": [
        "integer",
        "null"
      ],
      "readOnly": true
    },
    "baseline_source_result": {
      "type": [
        "integer",
        "null"
      ],
      "readOnly": true
    },
    "verify_result": {
      "type": [
        "integer",
        "null"
      ],
      "readOnly": true
    },
    "metric_delta": {
      "oneOf": [
        {},
        {
          "type": "null"
        }
      ],
      "readOnly": true
    },
    "proposal_summary": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {},
      "readOnly": true
    },
    "iteration": {
      "type": "integer",
      "readOnly": true
    },
    "iteration_history": {
      "readOnly": true
    },
    "failing_scenario_ids": {
      "readOnly": true
    },
    "rounds_since_improvement": {
      "type": "integer",
      "readOnly": true
    },
    "best_iteration": {
      "type": [
        "integer",
        "null"
      ],
      "readOnly": true
    },
    "best_score": {
      "type": [
        "number",
        "null"
      ],
      "format": "double",
      "readOnly": true
    },
    "pending_question": {
      "oneOf": [
        {},
        {
          "type": "null"
        }
      ],
      "readOnly": true
    },
    "reproduction": {
      "type": "object",
      "additionalProperties": {},
      "description": "Reproduction evidence, through the pipeline's own whitelist.\n\nCounts, rates and customer-facing field labels only — no configuration\nvalues, and no raw provider dot-paths.",
      "readOnly": true
    },
    "labs_metrics": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": {}
      },
      "readOnly": true
    },
    "question_answers": {
      "readOnly": true
    },
    "scenario_edit_proposals": {
      "readOnly": true
    },
    "user_guidance": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": {}
      },
      "readOnly": true
    },
    "parent_session": {
      "type": [
        "integer",
        "null"
      ],
      "readOnly": true
    },
    "conversation_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "readOnly": true
    },
    "message_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "readOnly": true
    },
    "error_message": {
      "type": "string",
      "readOnly": true
    },
    "failure_kind": {
      "type": "string",
      "readOnly": true
    },
    "summary_json": {
      "readOnly": true
    },
    "slack_notification_status": {
      "enum": [
        "not_attempted",
        "sending",
        "sent",
        "skipped_no_channel",
        "failed",
        "held"
      ],
      "type": "string",
      "description": "* `not_attempted` - Not Attempted\n* `sending` - Sending\n* `sent` - Sent\n* `skipped_no_channel` - Skipped No Channel\n* `failed` - Failed\n* `held` - Held",
      "x-spec-enum-id": "01d4c400b466e86e",
      "readOnly": true
    },
    "routed_to": {
      "type": "string",
      "readOnly": true
    },
    "slack_channel_id": {
      "type": "string",
      "readOnly": true
    },
    "slack_message_ts": {
      "type": "string",
      "readOnly": true
    },
    "slack_message_text": {
      "type": "string",
      "readOnly": true
    },
    "slack_error": {
      "type": "string",
      "readOnly": true
    },
    "promoted_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "readOnly": true
    },
    "promoted_by": {
      "type": [
        "integer",
        "null"
      ],
      "readOnly": true
    },
    "promoted_by_email": {
      "type": [
        "string",
        "null"
      ],
      "readOnly": true,
      "default": ""
    },
    "promotion_summary": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {},
      "readOnly": true
    },
    "clone_state": {
      "type": "object",
      "additionalProperties": {},
      "readOnly": true
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "readOnly": true
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "readOnly": true
    }
  }
}