{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/parallel-ai/json-schema/parallel-ai-memory-retrieve-response-schema.json",
  "title": "MemoryRetrieveResponse",
  "x-generated": "2026-11-17",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/parallel-ai-memory-api-openapi.yml#/components/schemas/MemoryRetrieveResponse",
  "properties": {
    "results": {
      "items": {
        "oneOf": [
          {
            "$ref": "#/$defs/TaskMemoryResult"
          },
          {
            "$ref": "#/$defs/MonitorMemoryResult"
          },
          {
            "$ref": "#/$defs/FindAllMemoryResult"
          }
        ]
      },
      "type": "array",
      "title": "Results"
    }
  },
  "type": "object",
  "required": [
    "results"
  ],
  "$defs": {
    "FindAllMemoryResult": {
      "properties": {
        "kind": {
          "type": "string",
          "const": "findall",
          "title": "Kind",
          "default": "findall"
        },
        "id": {
          "type": "string",
          "title": "Id",
          "description": "ID of the FindAll run."
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "title": "Updated At",
          "description": "When the FindAll result was last updated, as an RFC 3339 timestamp."
        },
        "input_excerpt": {
          "type": "string",
          "title": "Input Excerpt",
          "description": "Preview of the run's objective. May be truncated."
        },
        "matched_count": {
          "type": "integer",
          "title": "Matched Count",
          "description": "Current number of matched entities."
        }
      },
      "type": "object",
      "required": [
        "id",
        "updated_at",
        "input_excerpt",
        "matched_count"
      ],
      "title": "FindAllMemoryResult"
    },
    "MonitorMemoryEvent": {
      "properties": {
        "event_id": {
          "type": "string",
          "title": "Event Id",
          "description": "ID of the monitor event."
        },
        "event_group_id": {
          "type": "string",
          "title": "Event Group Id",
          "description": "ID of the execution that produced this event."
        },
        "detected_at": {
          "type": "string",
          "format": "date-time",
          "title": "Detected At",
          "description": "When the event was detected, as an RFC 3339 timestamp."
        },
        "excerpt": {
          "type": "string",
          "title": "Excerpt",
          "description": "Excerpt of the monitor event. May be truncated."
        }
      },
      "type": "object",
      "required": [
        "event_id",
        "event_group_id",
        "detected_at",
        "excerpt"
      ],
      "title": "MonitorMemoryEvent"
    },
    "MonitorMemoryResult": {
      "properties": {
        "kind": {
          "type": "string",
          "const": "monitor",
          "title": "Kind",
          "default": "monitor"
        },
        "id": {
          "type": "string",
          "title": "Id",
          "description": "ID of the monitor."
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "title": "Updated At",
          "description": "When the monitor last ran, as an RFC 3339 timestamp."
        },
        "input_excerpt": {
          "type": "string",
          "title": "Input Excerpt",
          "description": "Preview of the monitor's query. May be truncated."
        },
        "status": {
          "type": "string",
          "enum": [
            "active",
            "cancelled"
          ],
          "title": "Status",
          "description": "Current status of the monitor."
        },
        "matched_events": {
          "items": {
            "$ref": "#/$defs/MonitorMemoryEvent"
          },
          "type": "array",
          "title": "Matched Events",
          "description": "Detected events matching the retrieval query, ordered by relevance with more recent events favored. For an empty query, events are ordered by recency."
        }
      },
      "type": "object",
      "required": [
        "id",
        "updated_at",
        "input_excerpt",
        "status"
      ],
      "title": "MonitorMemoryResult"
    },
    "TaskMemoryResult": {
      "properties": {
        "kind": {
          "type": "string",
          "const": "task",
          "title": "Kind",
          "default": "task"
        },
        "id": {
          "type": "string",
          "title": "Id",
          "description": "ID of the task run."
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "title": "Updated At",
          "description": "When the run completed, as an RFC 3339 timestamp."
        },
        "input_excerpt": {
          "type": "string",
          "title": "Input Excerpt",
          "description": "Preview of the run's input. May be truncated."
        },
        "output_excerpt": {
          "type": "string",
          "title": "Output Excerpt",
          "description": "Preview of the run's output. May be truncated."
        }
      },
      "type": "object",
      "required": [
        "id",
        "updated_at",
        "input_excerpt",
        "output_excerpt"
      ],
      "title": "TaskMemoryResult"
    }
  }
}