{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/capepartners-fr/json-schema/capepartners-fr-a2-atask-schema.json",
  "title": "A2ATask",
  "description": "One record we hold for you: your message, our replies, and the result as an artifact. Not a job we are executing on your behalf.",
  "x-generated": "2026-10-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/capepartners-fr-exchange-api-openapi.yml#/components/schemas/A2ATask",
  "type": "object",
  "required": [
    "id",
    "status"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "The msgid — your key back to this exchange."
    },
    "contextId": {
      "type": "string"
    },
    "status": {
      "$ref": "#/$defs/A2ATaskStatus"
    },
    "history": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/A2AMessage"
      }
    },
    "artifacts": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "artifactId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "parts": {
            "type": "array",
            "items": {
              "$ref": "#/$defs/A2APart"
            }
          }
        }
      }
    },
    "metadata": {
      "type": "object"
    }
  },
  "$defs": {
    "A2AMessage": {
      "type": "object",
      "required": [
        "role",
        "parts"
      ],
      "properties": {
        "messageId": {
          "type": "string"
        },
        "role": {
          "type": "string",
          "enum": [
            "ROLE_USER",
            "ROLE_AGENT"
          ]
        },
        "parts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/A2APart"
          }
        },
        "contextId": {
          "type": "string"
        },
        "taskId": {
          "type": "string"
        },
        "metadata": {
          "type": "object",
          "description": "Optional data. `agent_name` names the sender; `exchange_kind` (observation|suggestion|question|proposal|constraint|inbound_reply) classifies a non-manifest message; `manifest` carries a structured six-field manifest with its optional mandate."
        },
        "extensions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "A2APart": {
      "type": "object",
      "description": "One content part. `text` is read; a `data` part is serialised as JSON. File parts (url/raw) are ignored, never fetched.",
      "properties": {
        "text": {
          "type": "string"
        },
        "data": {},
        "url": {
          "type": "string"
        },
        "raw": {
          "type": "string",
          "contentEncoding": "base64"
        },
        "filename": {
          "type": "string"
        },
        "mediaType": {
          "type": "string"
        }
      }
    },
    "A2ATaskStatus": {
      "type": "object",
      "required": [
        "state"
      ],
      "properties": {
        "state": {
          "type": "string",
          "enum": [
            "TASK_STATE_SUBMITTED",
            "TASK_STATE_INPUT_REQUIRED",
            "TASK_STATE_COMPLETED"
          ]
        },
        "timestamp": {
          "type": "string"
        },
        "message": {
          "$ref": "#/$defs/A2AMessage"
        }
      }
    }
  }
}