{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aifinpay-io/json-schema/aifinpay-io-grouped-agent-overview-schema.json",
  "title": "GroupedAgentOverview",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aifinpay-io-me-agents-api-openapi.yml#/components/schemas/GroupedAgentOverview",
  "type": "object",
  "properties": {
    "window": {
      "type": "integer",
      "minimum": 1,
      "maximum": 90
    },
    "agents": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/LogicalAgentView"
      }
    }
  },
  "required": [
    "window",
    "agents"
  ],
  "$defs": {
    "AgentWalletView": {
      "type": "object",
      "properties": {
        "address": {
          "type": "string"
        },
        "chain": {
          "type": "string"
        },
        "label": {
          "type": [
            "string",
            "null"
          ]
        },
        "wallet_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "balance_usd": {
          "type": [
            "number",
            "null"
          ]
        },
        "balance_native": {
          "type": [
            "number",
            "null"
          ]
        },
        "balance_usd_total": {
          "type": [
            "number",
            "null"
          ]
        },
        "calls_window": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "spent_usd_window": {
          "type": [
            "number",
            "null"
          ]
        },
        "last_activity_ts": {
          "type": [
            "integer",
            "null"
          ]
        },
        "health": {
          "type": "string",
          "enum": [
            "ok",
            "attention",
            "alert"
          ]
        }
      },
      "required": [
        "address",
        "chain",
        "balance_usd",
        "balance_native",
        "calls_window",
        "spent_usd_window",
        "health"
      ]
    },
    "LogicalAgentView": {
      "type": "object",
      "properties": {
        "agent_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "label": {
          "type": [
            "string",
            "null"
          ]
        },
        "wallet_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "source": {
          "type": "string",
          "enum": [
            "claimed",
            "partner"
          ]
        },
        "wallets": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/AgentWalletView"
          }
        },
        "balance_usd_total": {
          "type": [
            "number",
            "null"
          ]
        },
        "balance_coverage": {
          "type": "object",
          "properties": {
            "priced_wallets": {
              "type": "integer",
              "minimum": 0
            },
            "total_wallets": {
              "type": "integer",
              "minimum": 0
            }
          },
          "required": [
            "priced_wallets",
            "total_wallets"
          ]
        },
        "calls_window": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "spent_usd_window": {
          "type": [
            "number",
            "null"
          ]
        },
        "history_coverage": {
          "type": "object",
          "properties": {
            "supported_wallets": {
              "type": "integer",
              "minimum": 0
            },
            "total_wallets": {
              "type": "integer",
              "minimum": 0
            }
          },
          "required": [
            "supported_wallets",
            "total_wallets"
          ]
        },
        "last_activity_ts": {
          "type": [
            "integer",
            "null"
          ]
        },
        "top_merchant": {
          "type": [
            "string",
            "null"
          ]
        },
        "health": {
          "type": "string",
          "enum": [
            "ok",
            "attention",
            "alert"
          ]
        }
      },
      "required": [
        "agent_id",
        "label",
        "wallet_id",
        "source",
        "wallets",
        "balance_usd_total",
        "balance_coverage",
        "calls_window",
        "spent_usd_window",
        "history_coverage",
        "last_activity_ts",
        "top_merchant",
        "health"
      ]
    }
  }
}