{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/parallel-ai/json-schema/parallel-ai-paginated-monitor-events-schema.json",
  "title": "PaginatedMonitorEvents",
  "description": "Paginated list of monitor events, newest first.",
  "x-generated": "2026-11-17",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/parallel-ai-monitor-api-openapi.yml#/components/schemas/PaginatedMonitorEvents",
  "properties": {
    "events": {
      "items": {
        "oneOf": [
          {
            "$ref": "#/$defs/MonitorEventStreamEvent"
          },
          {
            "$ref": "#/$defs/MonitorSnapshotEvent"
          },
          {
            "$ref": "#/$defs/MonitorCompletionEvent"
          },
          {
            "$ref": "#/$defs/MonitorErrorEvent"
          }
        ]
      },
      "type": "array",
      "title": "Events",
      "description": "Monitor events returned by this request, ordered newest first."
    },
    "next_cursor": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Next Cursor",
      "description": "Pass as `cursor` to retrieve more events. Absent when there are no more events."
    },
    "warnings": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/Warning"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Warnings",
      "description": "Execution caveats for this page of events, e.g. compute limits."
    }
  },
  "type": "object",
  "required": [
    "events"
  ],
  "$defs": {
    "Citation": {
      "description": "A citation for a task output.",
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Title of the citation.",
          "title": "Title"
        },
        "url": {
          "description": "URL of the citation.",
          "title": "Url",
          "type": "string"
        },
        "excerpts": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Excerpts from the citation supporting the output. Only certain processors provide excerpts.",
          "title": "Excerpts"
        }
      },
      "required": [
        "url"
      ],
      "title": "Citation",
      "type": "object"
    },
    "FieldBasis": {
      "description": "Citations and reasoning supporting one field of a task output.",
      "properties": {
        "field": {
          "description": "Name of the output field.",
          "title": "Field",
          "type": "string"
        },
        "citations": {
          "default": [],
          "description": "List of citations supporting the output field.",
          "items": {
            "$ref": "#/$defs/Citation"
          },
          "title": "Citations",
          "type": "array"
        },
        "reasoning": {
          "description": "Reasoning for the output field.",
          "title": "Reasoning",
          "type": "string"
        },
        "confidence": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Confidence level for the output field. Only certain processors provide confidence levels.",
          "title": "Confidence"
        }
      },
      "required": [
        "field",
        "reasoning"
      ],
      "title": "FieldBasis",
      "type": "object"
    },
    "McpToolCall": {
      "properties": {
        "tool_call_id": {
          "type": "string",
          "title": "Tool Call ID",
          "description": "Identifier for the tool call."
        },
        "server_name": {
          "type": "string",
          "title": "Server Name",
          "description": "Name of the MCP server."
        },
        "tool_name": {
          "type": "string",
          "title": "Tool Name",
          "description": "Name of the tool being called."
        },
        "arguments": {
          "type": "string",
          "title": "Arguments",
          "description": "Arguments used to call the MCP tool."
        },
        "content": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Content",
          "description": "Output received from the tool call, if successful."
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Error",
          "description": "Error message if the tool call failed."
        }
      },
      "type": "object",
      "required": [
        "tool_call_id",
        "server_name",
        "tool_name",
        "arguments"
      ],
      "title": "McpToolCall",
      "description": "Result of an MCP tool call."
    },
    "MonitorCompletionEvent": {
      "properties": {
        "event_type": {
          "type": "string",
          "enum": [
            "completion"
          ],
          "const": "completion",
          "title": "Event Type",
          "description": "Discriminant for the completion event variant.",
          "default": "completion"
        },
        "timestamp": {
          "type": "string",
          "format": "date-time",
          "title": "Timestamp",
          "description": "Timestamp of when the monitor execution completed, as an RFC 3339 string."
        }
      },
      "type": "object",
      "required": [
        "timestamp"
      ],
      "title": "MonitorCompletionEvent",
      "description": "Emitted when a monitor execution ran but detected no material changes.\n\nOnly returned when `include_completions=true` is passed to the list events\nendpoint. Useful for auditing execution history alongside content events."
    },
    "MonitorErrorEvent": {
      "properties": {
        "event_type": {
          "type": "string",
          "enum": [
            "error"
          ],
          "const": "error",
          "title": "Event Type",
          "description": "Discriminant for the error event variant.",
          "default": "error"
        },
        "error_message": {
          "type": "string",
          "title": "Error Message",
          "description": "Human-readable description of the failure."
        },
        "timestamp": {
          "type": "string",
          "format": "date-time",
          "title": "Timestamp",
          "description": "Timestamp of when the monitor execution failed, as an RFC 3339 string."
        }
      },
      "type": "object",
      "required": [
        "error_message",
        "timestamp"
      ],
      "title": "MonitorErrorEvent",
      "description": "Emitted when a monitor execution failed (e.g. payment or quota error).\n\nAlways included in the events list regardless of `include_completions`."
    },
    "MonitorEventStreamEvent": {
      "properties": {
        "event_id": {
          "type": "string",
          "title": "Event Id",
          "description": "Stable identifier for this event. Safe to use for client-side deduplication across pagination and retries."
        },
        "event_group_id": {
          "type": "string",
          "title": "Event Group Id",
          "description": "ID of the event group that owns this event."
        },
        "event_date": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Event Date",
          "description": "Date when this event was produced. ISO 8601 date (YYYY-MM-DD) or partial (YYYY-MM or YYYY)."
        },
        "event_type": {
          "type": "string",
          "enum": [
            "event_stream"
          ],
          "const": "event_stream",
          "title": "Event Type",
          "description": "Discriminant for the event_stream event variant.",
          "default": "event_stream"
        },
        "output": {
          "oneOf": [
            {
              "$ref": "#/$defs/TaskRunTextOutput"
            },
            {
              "$ref": "#/$defs/TaskRunJsonOutput"
            }
          ],
          "title": "Output",
          "description": "Text or JSON output describing the detected change."
        }
      },
      "type": "object",
      "required": [
        "event_id",
        "event_group_id",
        "event_date",
        "output"
      ],
      "title": "MonitorEventStreamEvent",
      "description": "Append-only event from an event_stream monitor.\n\nEach event represents a distinct material change detected since the\nprevious execution. Events are net-new relative to the cursor; clients\nshould treat them as an append-only log."
    },
    "MonitorSnapshotEvent": {
      "properties": {
        "event_id": {
          "type": "string",
          "title": "Event Id",
          "description": "Stable identifier for this event. Safe to use for client-side deduplication across pagination and retries."
        },
        "event_group_id": {
          "type": "string",
          "title": "Event Group Id",
          "description": "ID of the event group that owns this event."
        },
        "event_date": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Event Date",
          "description": "Date when this event was produced. ISO 8601 date (YYYY-MM-DD) or partial (YYYY-MM or YYYY)."
        },
        "event_type": {
          "type": "string",
          "enum": [
            "snapshot"
          ],
          "const": "snapshot",
          "title": "Event Type",
          "description": "Discriminant for the snapshot event variant.",
          "default": "snapshot"
        },
        "changed_output": {
          "oneOf": [
            {
              "$ref": "#/$defs/TaskRunTextOutput"
            },
            {
              "$ref": "#/$defs/TaskRunJsonOutput"
            }
          ],
          "title": "Changed Output",
          "description": "Partial output containing only the fields that changed since the previous execution, each with its `basis` (reasoning and citations)."
        },
        "previous_output": {
          "oneOf": [
            {
              "$ref": "#/$defs/TaskRunTextOutput"
            },
            {
              "$ref": "#/$defs/TaskRunJsonOutput"
            }
          ],
          "title": "Previous Output",
          "description": "The full output from the prior run, including all fields and basis."
        }
      },
      "type": "object",
      "required": [
        "event_id",
        "event_group_id",
        "event_date",
        "changed_output",
        "previous_output"
      ],
      "title": "MonitorSnapshotEvent",
      "description": "Snapshot diff event emitted when a monitored task run's output changes.\n\n`changed_output` contains only the fields that changed since the previous execution,\nalong with their `basis` (reasoning + citations). `previous_output` holds\nthe complete output from the prior run for comparison."
    },
    "TaskRunJsonOutput": {
      "properties": {
        "basis": {
          "items": {
            "$ref": "#/$defs/FieldBasis"
          },
          "type": "array",
          "title": "Basis",
          "description": "Basis for each top-level field in the JSON output. Per-list-element basis entries are available only when the `parallel-beta: field-basis-2025-11-25` header is supplied."
        },
        "type": {
          "type": "string",
          "const": "json",
          "title": "Type",
          "description": "The type of output being returned, as determined by the output schema of the task spec."
        },
        "mcp_tool_calls": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/McpToolCall"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Mcp Tool Calls",
          "description": "MCP tool calls made by the task."
        },
        "beta_fields": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Beta Fields",
          "description": "Deprecated. mcp-server-2025-07-17 is now included directly in the output (e.g. mcp_tool_calls).",
          "deprecated": true
        },
        "content": {
          "additionalProperties": true,
          "type": "object",
          "title": "Content",
          "description": "Output from the task as a native JSON object, as determined by the output schema of the task spec."
        },
        "output_schema": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Output Schema",
          "description": "Output schema for the Task Run. Populated only if the task was executed with an auto schema."
        }
      },
      "type": "object",
      "required": [
        "basis",
        "type",
        "content"
      ],
      "title": "TaskRunJsonOutput",
      "description": "Output from a task that returns JSON."
    },
    "TaskRunTextOutput": {
      "properties": {
        "basis": {
          "items": {
            "$ref": "#/$defs/FieldBasis"
          },
          "type": "array",
          "title": "Basis",
          "description": "Basis for the output. The basis has a single field 'output'."
        },
        "type": {
          "type": "string",
          "const": "text",
          "title": "Type",
          "description": "The type of output being returned, as determined by the output schema of the task spec."
        },
        "mcp_tool_calls": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/McpToolCall"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Mcp Tool Calls",
          "description": "MCP tool calls made by the task."
        },
        "beta_fields": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Beta Fields",
          "description": "Deprecated. mcp-server-2025-07-17 is now included directly in the output (e.g. mcp_tool_calls).",
          "deprecated": true
        },
        "content": {
          "type": "string",
          "title": "Content",
          "description": "Text output from the task."
        }
      },
      "type": "object",
      "required": [
        "basis",
        "type",
        "content"
      ],
      "title": "TaskRunTextOutput",
      "description": "Output from a task that returns text."
    },
    "Warning": {
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "spec_validation_warning",
            "input_validation_warning",
            "warning"
          ],
          "title": "Type",
          "description": "Type of warning. Note that adding new warning types is considered a backward-compatible change."
        },
        "message": {
          "type": "string",
          "title": "Message",
          "description": "Human-readable message."
        },
        "detail": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Detail",
          "description": "Optional detail supporting the warning."
        }
      },
      "type": "object",
      "required": [
        "type",
        "message"
      ],
      "title": "Warning",
      "description": "Human-readable message for a task."
    }
  }
}