{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/roark/json-schema/roark-managed-agent-config-detail-schema.json",
  "title": "ManagedAgentConfigDetail",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/roark-agent-config-api-openapi.yml#/components/schemas/ManagedAgentConfigDetail",
  "allOf": [
    {
      "$ref": "#/$defs/ManagedAgentConfig"
    }
  ],
  "properties": {
    "revisions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ManagedAgentConfigRevision"
      },
      "description": "Recent revisions, newest first."
    }
  },
  "required": [
    "revisions"
  ],
  "$defs": {
    "ManagedAgentConfig": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "key": {
          "type": "string",
          "description": "The stable handle your code fetches by."
        },
        "agentId": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "The linked Roark agent, when one exists."
        },
        "productionRevisionId": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "The revision real traffic reads."
        },
        "stagingRevisionId": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "The candidate revision Roark test calls read. Null when nothing is staged."
        },
        "createdAt": {
          "type": "string",
          "description": "ISO 8601."
        },
        "updatedAt": {
          "type": "string",
          "description": "ISO 8601."
        }
      },
      "required": [
        "id",
        "key",
        "agentId",
        "productionRevisionId",
        "stagingRevisionId",
        "createdAt",
        "updatedAt"
      ],
      "description": "A managed config for a code-first agent (LiveKit, Pipecat, or any stack using the SDK): your agent fetches its tunable surface from Roark at session start. Two channels: production for real traffic, staging for candidates under test."
    },
    "ManagedAgentConfigRevision": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "document": {
          "type": "object",
          "additionalProperties": {},
          "description": "The config JSON, verbatim."
        },
        "parentRevisionId": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        },
        "createdByType": {
          "type": "string",
          "enum": [
            "CUSTOMER",
            "AUTOIMPROVE"
          ],
          "description": "Who wrote it: your own pushes, or the Autoimprove loop staging a candidate."
        },
        "summary": {
          "type": [
            "string",
            "null"
          ],
          "description": "One-line story of the change."
        },
        "createdAt": {
          "type": "string",
          "description": "ISO 8601."
        }
      },
      "required": [
        "id",
        "document",
        "parentRevisionId",
        "createdByType",
        "summary",
        "createdAt"
      ]
    }
  }
}