{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aimeat-io/json-schema/aimeat-io-agent-crew-state-schema.json",
  "title": "AgentCrewState",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aimeat-io-agent-crew-api-openapi.yml#/components/schemas/AgentCrewState",
  "type": "object",
  "properties": {
    "agent": {
      "type": "string"
    },
    "gaii": {
      "type": "string"
    },
    "key": {
      "type": "string",
      "description": "The live key, `crews.registry.<agent>`"
    },
    "online": {
      "type": "boolean",
      "description": "Whether the agent holds a connector tunnel right now"
    },
    "published": {
      "nullable": true,
      "allOf": [
        {
          "$ref": "#/$defs/CrewDefEnvelope"
        }
      ]
    },
    "draft": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "doc": {
          "$ref": "#/$defs/CrewDefDoc"
        },
        "savedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "versions": {
      "type": "array",
      "description": "Kept revisions, newest first",
      "items": {
        "type": "object",
        "properties": {
          "revision": {
            "type": "integer"
          },
          "publishedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      }
    },
    "version_window": {
      "type": "integer",
      "description": "How many revisions are kept"
    },
    "runtime": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": true,
      "description": "Whatever the runtime last wrote at `crews.runtime.<agent>` (loadedAt, revision, ok, errors, runtime)"
    },
    "try_timeout_ms": {
      "type": "integer"
    }
  },
  "$defs": {
    "CrewDefDoc": {
      "type": "object",
      "description": "A crewaimeat crew definition (crew_def.py shape): agent_name, agents[], tasks[], an optional model profile, process, listen_for, tags, capabilities, skills, offers and signals. The node checks only that it is an object; the rules are the runtime's validator.",
      "additionalProperties": true
    },
    "CrewDefEnvelope": {
      "type": "object",
      "description": "What sits at `crews.registry.<agent>`; crew_registry.py reads `doc` out of it.",
      "properties": {
        "version": {
          "type": "integer",
          "description": "Envelope schema version (1)"
        },
        "revision": {
          "type": "integer",
          "description": "Running publish number"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time"
        },
        "publishedBy": {
          "type": "string",
          "description": "The principal that published (owner GHII or agent GAII)"
        },
        "agent_name": {
          "type": "string"
        },
        "doc": {
          "$ref": "#/$defs/CrewDefDoc"
        }
      }
    }
  }
}