{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/orq/json-schema/orq-public-schedule-schema.json",
  "title": "PublicSchedule",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/orq-agent-schedules-api-openapi.yml#/components/schemas/PublicSchedule",
  "additionalProperties": false,
  "properties": {
    "_id": {
      "description": "ULID identifying this schedule.",
      "type": "string"
    },
    "agent_key": {
      "type": "string"
    },
    "agent_tag": {
      "description": "Pinned agent version. Omit to always run the agent's current active version.",
      "type": "string"
    },
    "created": {
      "format": "date-time",
      "type": "string"
    },
    "created_by_id": {
      "description": "ID of the API key that created the schedule.",
      "type": "string"
    },
    "display_name": {
      "description": "Human-readable name of the schedule. Omitted for schedules created before display names were required.",
      "type": "string"
    },
    "expression": {
      "description": "6-field cron expression. Schedules stored before the cron-only restriction may also return an @every duration or an @at RFC3339 timestamp.",
      "type": "string"
    },
    "generation": {
      "description": "Monotonic counter incremented when the schedule's firing cadence changes, allowing outdated in-flight triggers to be ignored.",
      "format": "int64",
      "type": "integer"
    },
    "is_active": {
      "description": "Whether the schedule is currently firing. Legacy once schedules flip to false automatically after firing.",
      "type": "boolean"
    },
    "last_triggered_at": {
      "description": "Timestamp of the most recent firing, if any.",
      "format": "date-time",
      "type": "string"
    },
    "payload": {
      "$ref": "#/$defs/PublicSchedulePayload"
    },
    "trigger_count": {
      "description": "Total firings since creation or last expression/type change.",
      "format": "int64",
      "type": "integer"
    },
    "type": {
      "description": "Schedule type. Only cron can be created or updated; once and interval only appear on schedules stored before that restriction.",
      "enum": [
        "cron",
        "once",
        "interval"
      ],
      "type": "string"
    },
    "updated": {
      "format": "date-time",
      "type": "string"
    },
    "updated_by_id": {
      "description": "ID of the API key that last updated the schedule. Omitted until the schedule is updated.",
      "type": "string"
    }
  },
  "required": [
    "_id",
    "agent_key",
    "type",
    "expression",
    "is_active",
    "generation",
    "payload",
    "created_by_id",
    "created",
    "updated",
    "trigger_count"
  ],
  "type": "object",
  "$defs": {
    "PublicSchedulePayload": {
      "additionalProperties": false,
      "properties": {
        "input": {
          "description": "Input to pass to the agent on each firing. Same shape as the Responses API input — a string or an array of input items."
        },
        "memory_entity_id": {
          "description": "Optional memory store entity ID to attach to each run.",
          "type": "string"
        },
        "metadata": {
          "additionalProperties": {
            "type": "string"
          },
          "description": "Opaque string key/value pairs attached to every response generated by this schedule.",
          "type": "object"
        },
        "variables": {
          "additionalProperties": {},
          "description": "Template variables substituted into instructions. Supports secret values: {\"secret\": true, \"value\": \"...\"}.",
          "type": "object"
        }
      },
      "type": "object"
    }
  }
}