{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/roark/json-schema/roark-config-bundle-schema.json",
  "title": "ConfigBundle",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/roark-config-api-openapi.yml#/components/schemas/ConfigBundle",
  "type": "object",
  "properties": {
    "resources": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "anyOf": [
              {
                "$ref": "#/$defs/AgentConfig"
              },
              {
                "$ref": "#/$defs/HttpRequestDefinitionConfig"
              },
              {
                "$ref": "#/$defs/PersonaConfig"
              },
              {
                "$ref": "#/$defs/ImprovFlowConfig"
              },
              {
                "$ref": "#/$defs/ScriptedFlowConfig"
              },
              {
                "$ref": "#/$defs/CollectorConfig"
              },
              {
                "$ref": "#/$defs/MetricConfig"
              },
              {
                "$ref": "#/$defs/ApiCheckMetricConfig"
              },
              {
                "$ref": "#/$defs/SimulationPlanConfig"
              },
              {
                "$ref": "#/$defs/QaSimulationPlanConfig"
              },
              {
                "$ref": "#/$defs/SimulationGroupConfig"
              },
              {
                "$ref": "#/$defs/AlertConfig"
              },
              {
                "$ref": "#/$defs/ToolConfig"
              },
              {
                "$ref": "#/$defs/DashboardConfig"
              }
            ]
          },
          {
            "$ref": "#/$defs/ProjectConfig"
          }
        ]
      }
    },
    "prune": {
      "type": "boolean",
      "default": true
    }
  },
  "required": [
    "resources"
  ],
  "$defs": {
    "AgentConfig": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "agent"
        },
        "name": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1
        },
        "displayName": {
          "type": "string"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "customId": {
          "type": [
            "string",
            "null"
          ]
        },
        "endpoints": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "value": {
                "type": "string",
                "minLength": 1
              },
              "type": {
                "type": "string",
                "enum": [
                  "PHONE",
                  "WEBSOCKET"
                ],
                "default": "PHONE"
              },
              "direction": {
                "type": "string",
                "enum": [
                  "INCOMING",
                  "OUTGOING",
                  "INCOMING_AND_OUTGOING"
                ],
                "default": "INCOMING"
              },
              "environment": {
                "type": "string"
              },
              "outboundDialType": {
                "type": "string",
                "enum": [
                  "NONE",
                  "HTTP_REQUEST"
                ],
                "default": "NONE"
              },
              "outboundDialHttpRequestDefinition": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9-_.]*$",
                "minLength": 1
              }
            },
            "required": [
              "value"
            ]
          }
        },
        "prompt": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "kind",
        "name"
      ]
    },
    "AlertActions": {
      "type": "object",
      "properties": {
        "slack": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AlertSlackChannel"
          }
        },
        "webhooks": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uri"
          }
        }
      }
    },
    "AlertConfig": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "alert"
        },
        "name": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1
        },
        "displayName": {
          "type": "string"
        },
        "enabled": {
          "type": "boolean",
          "default": true
        },
        "trigger": {
          "oneOf": [
            {
              "$ref": "#/$defs/AlertThresholdTrigger"
            },
            {
              "$ref": "#/$defs/AlertEventTrigger"
            },
            {
              "$ref": "#/$defs/AlertSimulationTrigger"
            }
          ]
        },
        "actions": {
          "$ref": "#/$defs/AlertActions"
        }
      },
      "required": [
        "kind",
        "name",
        "trigger"
      ]
    },
    "AlertEventTrigger": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "const": "event"
        },
        "events": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "CALL_ANALYSIS_COMPLETED",
              "CALL_ANALYSIS_FAILED",
              "CALL_ANALYSIS_CANCELLED",
              "SIMULATION_RUN_PLAN_JOB_STARTED",
              "SIMULATION_RUN_PLAN_JOB_COMPLETED",
              "SIMULATION_RUN_PLAN_JOB_FAILED",
              "SIMULATION_RUN_PLAN_JOB_CANCELLED",
              "SIMULATION_JOB_STARTED",
              "SIMULATION_JOB_COMPLETED",
              "SIMULATION_JOB_FAILED",
              "SIMULATION_JOB_CANCELLED",
              "METRIC_COLLECTION_JOB_COMPLETED",
              "METRIC_COLLECTION_JOB_FAILED",
              "CHAT_ANALYSIS_COMPLETED",
              "CHAT_ANALYSIS_FAILED",
              "ISSUE_OPENED",
              "ISSUE_RESOLVED"
            ]
          },
          "minItems": 1
        }
      },
      "required": [
        "type",
        "events"
      ]
    },
    "AlertSimulationTrigger": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "const": "simulation"
        },
        "conditions": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "SUCCESS",
              "FAILURE",
              "THRESHOLD_FAILED"
            ]
          },
          "minItems": 1
        },
        "plan": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1
        },
        "deliveryFormat": {
          "type": "string",
          "enum": [
            "MESSAGE",
            "PDF"
          ],
          "default": "MESSAGE"
        }
      },
      "required": [
        "type",
        "conditions"
      ]
    },
    "AlertSlackChannel": {
      "type": "object",
      "properties": {
        "channelId": {
          "type": "string",
          "minLength": 1
        },
        "channelName": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "channelId",
        "channelName"
      ]
    },
    "AlertThresholdTrigger": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "const": "threshold"
        },
        "metric": {
          "type": "string",
          "minLength": 1
        },
        "metricVariant": {
          "type": "string",
          "minLength": 1
        },
        "aggregation": {
          "type": "string",
          "enum": [
            "COUNT",
            "RATE_PER_MINUTE",
            "MEAN"
          ]
        },
        "windowMinutes": {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "operator": {
          "type": "string",
          "enum": [
            "GT",
            "GTE",
            "LT",
            "LTE"
          ]
        },
        "thresholdValue": {
          "type": "number"
        },
        "grouping": {
          "type": "string",
          "enum": [
            "NONE",
            "BY_AGENT"
          ],
          "default": "NONE"
        },
        "minSampleSize": {
          "type": "integer",
          "minimum": 1,
          "default": 1
        },
        "consecutiveOpen": {
          "type": "integer",
          "minimum": 1,
          "default": 2
        },
        "consecutiveResolve": {
          "type": "integer",
          "minimum": 1,
          "default": 3
        }
      },
      "required": [
        "type",
        "metric",
        "aggregation",
        "windowMinutes",
        "operator",
        "thresholdValue"
      ]
    },
    "ApiCheckMetricConfig": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "metric"
        },
        "calculationType": {
          "type": "string",
          "const": "HTTP_REQUEST"
        },
        "name": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1
        },
        "displayName": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        },
        "httpRequest": {
          "$ref": "#/$defs/ApiCheckRequestConfig"
        },
        "trueLabel": {
          "type": "string"
        },
        "falseLabel": {
          "type": "string"
        }
      },
      "required": [
        "kind",
        "calculationType",
        "name",
        "httpRequest"
      ]
    },
    "ApiCheckRequestConfig": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "format": "uri",
          "maxLength": 2048
        },
        "method": {
          "type": "string",
          "enum": [
            "GET",
            "POST"
          ],
          "default": "POST"
        },
        "headers": {
          "type": "object",
          "propertyNames": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "additionalProperties": {
            "type": "string",
            "maxLength": 4000
          }
        },
        "body": {
          "type": "string",
          "minLength": 1,
          "maxLength": 20000
        }
      },
      "required": [
        "url"
      ]
    },
    "CollectorConfig": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "collector"
        },
        "name": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1
        },
        "displayName": {
          "type": "string"
        },
        "modality": {
          "type": "string",
          "enum": [
            "call",
            "chat"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "ACTIVE",
            "INACTIVE"
          ],
          "default": "ACTIVE"
        },
        "metrics": {
          "type": "array",
          "items": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "$ref": "#/$defs/CollectorMetricConfig"
              }
            ]
          },
          "minItems": 1
        },
        "filters": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "conditions": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "AGENT",
                        "CALL_SOURCE",
                        "CALL_PROPERTY",
                        "INTEGRATION"
                      ]
                    },
                    "key": {
                      "type": "string",
                      "minLength": 1
                    },
                    "operator": {
                      "type": "string",
                      "enum": [
                        "EQUALS",
                        "NOT_EQUALS",
                        "CONTAINS",
                        "STARTS_WITH",
                        "GREATER_THAN",
                        "LESS_THAN",
                        "GREATER_THAN_OR_EQUALS",
                        "LESS_THAN_OR_EQUALS"
                      ]
                    },
                    "value": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "key"
                  ]
                },
                "minItems": 1
              }
            },
            "required": [
              "conditions"
            ]
          }
        }
      },
      "required": [
        "kind",
        "name",
        "modality",
        "metrics"
      ]
    },
    "CollectorMetricConfig": {
      "type": "object",
      "properties": {
        "metric": {
          "type": "string",
          "minLength": 1
        },
        "verifiedProperties": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "maxItems": 50
        },
        "excludedPhrases": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "maxItems": 50
        },
        "voicemailScript": {
          "type": "string",
          "minLength": 1,
          "maxLength": 4000
        },
        "screeningBrief": {
          "type": "string",
          "minLength": 1,
          "maxLength": 4000
        }
      },
      "required": [
        "metric"
      ],
      "additionalProperties": false
    },
    "ConfigFlowStep": {
      "type": "object",
      "properties": {
        "ref": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64
        },
        "type": {
          "type": "string",
          "enum": [
            "AGENT_TURN",
            "CUSTOMER_TURN",
            "CUSTOMER_FIRST_MESSAGE",
            "CUSTOMER_VERBATIM_TURN",
            "CUSTOMER_SILENCE",
            "CUSTOMER_DTMF",
            "AGENT_DTMF",
            "VOICEMAIL",
            "SCENARIO_LINK",
            "CUSTOMER_HANDOFF"
          ]
        },
        "content": {
          "type": "string"
        },
        "offScript": {
          "$ref": "#/$defs/ConfigOffScript"
        },
        "silenceDurationSeconds": {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "dtmfDigits": {
          "type": "string"
        },
        "flow": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1
        },
        "handoffPersona": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1
        },
        "stage": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            },
            {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 80
                },
                "required": {
                  "type": "boolean"
                },
                "analyze": {
                  "type": "boolean"
                }
              },
              "required": [
                "name"
              ],
              "additionalProperties": false
            }
          ]
        },
        "requiredForValidRun": {
          "type": "boolean",
          "description": "Removed. Use `stage` with `required: true`."
        },
        "mergeInto": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "steps": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ConfigFlowStep"
          }
        }
      },
      "required": [
        "type"
      ]
    },
    "ConfigOffScript": {
      "type": "object",
      "properties": {
        "reaction": {
          "type": "string",
          "enum": [
            "STAY_SILENT",
            "REPEAT",
            "RESPOND",
            "SAY"
          ]
        },
        "sayLine": {
          "type": "string",
          "minLength": 1,
          "maxLength": 2000
        },
        "maxAttempts": {
          "type": "integer",
          "minimum": 1,
          "maximum": 20
        },
        "then": {
          "type": "string",
          "enum": [
            "HANG_UP",
            "MOVE_ON",
            "ADAPT",
            "HANG_UP_INVALIDATE"
          ]
        },
        "waitSeconds": {
          "type": "integer",
          "minimum": 1,
          "maximum": 600
        }
      }
    },
    "DashboardConfig": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "dashboard"
        },
        "name": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1
        },
        "displayName": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "description": {
          "type": "string",
          "maxLength": 2000
        },
        "isDefault": {
          "type": "boolean"
        },
        "timeRange": {
          "$ref": "#/$defs/DashboardTimeRangeConfig"
        },
        "filters": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DashboardFilterConfig"
          },
          "maxItems": 20
        },
        "widgets": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DashboardWidgetConfig"
          },
          "maxItems": 50,
          "default": []
        }
      },
      "required": [
        "kind",
        "name"
      ]
    },
    "DashboardFilterConfig": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "METRIC_PROPERTY",
            "CALL_PROPERTY",
            "AGENT_PROPERTY",
            "CALL_ID",
            "MODALITY",
            "DATASET",
            "METRIC_VALUE"
          ]
        },
        "property": {
          "type": "string"
        },
        "operator": {
          "type": "string",
          "enum": [
            "EQUALS",
            "NOT_EQUALS",
            "GREATER_THAN",
            "GREATER_THAN_OR_EQUAL_TO",
            "LESS_THAN",
            "LESS_THAN_OR_EQUAL_TO",
            "CONTAINS",
            "STARTS_WITH",
            "IS_SET",
            "IS_NOT_SET"
          ]
        },
        "value": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "boolean"
            }
          ]
        }
      },
      "required": [
        "type"
      ]
    },
    "DashboardMeasureConfig": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "METRIC",
            "CONVERSATION",
            "UPTIME"
          ]
        },
        "metric": {
          "type": "string",
          "minLength": 1
        },
        "aggregation": {
          "type": "string",
          "enum": [
            "COUNT",
            "AVG",
            "MIN",
            "MAX",
            "SUM",
            "MEDIAN",
            "PERCENTILE",
            "PASS_RATE"
          ]
        },
        "percentile": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        "distinctBy": {
          "type": "string",
          "enum": [
            "NONE",
            "CALL"
          ]
        },
        "nestedAggregation": {
          "type": "string",
          "enum": [
            "COUNT",
            "AVG",
            "MIN",
            "MAX",
            "SUM",
            "MEDIAN",
            "PERCENTILE",
            "PASS_RATE"
          ]
        },
        "nestedAggregationPercentile": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        "passOperator": {
          "type": "string",
          "enum": [
            "EQUALS",
            "NOT_EQUALS",
            "GREATER_THAN",
            "GREATER_THAN_OR_EQUAL_TO",
            "LESS_THAN",
            "LESS_THAN_OR_EQUAL_TO",
            "CONTAINS",
            "STARTS_WITH"
          ]
        },
        "passValue": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "boolean"
            }
          ]
        },
        "breakdown": {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "METRIC_PROPERTY",
                "CALL_PROPERTY",
                "AGENT_PROPERTY",
                "DATASET"
              ]
            },
            "property": {
              "type": "string"
            }
          },
          "required": [
            "type"
          ]
        },
        "filters": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DashboardFilterConfig"
          },
          "maxItems": 20
        },
        "isBaseline": {
          "type": "boolean"
        },
        "color": {
          "type": "string",
          "enum": [
            "GREEN",
            "RED",
            "ORANGE",
            "PURPLE",
            "GREY",
            "BLUE",
            "PEACH",
            "TEAL",
            "INDIGO",
            "AMBER",
            "ROSE",
            "CYAN"
          ]
        }
      }
    },
    "DashboardTimeRangeConfig": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "LAST"
            },
            "value": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            },
            "unit": {
              "type": "string",
              "enum": [
                "DAYS",
                "WEEKS",
                "MONTHS"
              ]
            }
          },
          "required": [
            "type",
            "value",
            "unit"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "CALENDAR_ALIGNED"
            },
            "period": {
              "type": "string",
              "enum": [
                "TODAY",
                "YESTERDAY",
                "THIS_WEEK",
                "LAST_WEEK",
                "THIS_MONTH",
                "LAST_MONTH",
                "THIS_YEAR",
                "LAST_YEAR"
              ]
            }
          },
          "required": [
            "type",
            "period"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "FIXED"
            },
            "from": {
              "type": "string",
              "format": "date-time"
            },
            "to": {
              "type": "string",
              "format": "date-time"
            }
          },
          "required": [
            "type",
            "from",
            "to"
          ]
        },
        {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "const": "SINCE"
            },
            "from": {
              "type": "string",
              "format": "date-time"
            }
          },
          "required": [
            "type",
            "from"
          ]
        }
      ]
    },
    "DashboardWidgetConfig": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "description": {
          "type": "string",
          "maxLength": 2000
        },
        "display": {
          "type": "string",
          "enum": [
            "LINE",
            "NUMBER",
            "RADAR",
            "STACKED_BAR",
            "TABLE"
          ]
        },
        "size": {
          "type": "string",
          "enum": [
            "SMALL",
            "MEDIUM",
            "LARGE",
            "EXTRA_LARGE"
          ]
        },
        "measures": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DashboardMeasureConfig"
          },
          "minItems": 1,
          "maxItems": 10
        },
        "filters": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DashboardFilterConfig"
          },
          "maxItems": 20
        },
        "interval": {
          "type": "string",
          "enum": [
            "HOUR",
            "DAY",
            "WEEK",
            "MONTH"
          ]
        },
        "comparisonMode": {
          "type": "string",
          "enum": [
            "NONE",
            "PREVIOUS_PERIOD"
          ]
        },
        "comparisonGroups": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "filters": {
                "type": "array",
                "items": {
                  "$ref": "#/$defs/DashboardFilterConfig"
                },
                "minItems": 1,
                "maxItems": 20
              },
              "color": {
                "type": "string",
                "enum": [
                  "GREEN",
                  "RED",
                  "ORANGE",
                  "PURPLE",
                  "GREY",
                  "BLUE",
                  "PEACH",
                  "TEAL",
                  "INDIGO",
                  "AMBER",
                  "ROSE",
                  "CYAN"
                ]
              }
            },
            "required": [
              "name",
              "filters"
            ]
          },
          "minItems": 2,
          "maxItems": 5
        }
      },
      "required": [
        "name",
        "measures"
      ]
    },
    "HttpRequestDefinitionConfig": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "httpRequestDefinition"
        },
        "name": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "method": {
          "type": "string",
          "enum": [
            "POST",
            "PUT",
            "PATCH",
            "GET"
          ],
          "default": "POST"
        },
        "body": {
          "type": "string"
        },
        "headers": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        }
      },
      "required": [
        "kind",
        "name",
        "url"
      ]
    },
    "ImprovFlowConfig": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "flow"
        },
        "type": {
          "type": "string",
          "const": "improv"
        },
        "name": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1
        },
        "title": {
          "type": "string"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "agents": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-_.]*$",
            "minLength": 1
          },
          "minItems": 1
        },
        "expectations": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "happyPath": {
          "type": "object",
          "properties": {
            "persona": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-_.]*$",
              "minLength": 1
            },
            "environment": {
              "type": "string"
            },
            "prompt": {
              "type": "string"
            },
            "expectations": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "title": {
              "type": "string"
            }
          },
          "required": [
            "persona",
            "environment"
          ]
        },
        "edgeCases": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "persona": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9-_.]*$",
                "minLength": 1
              },
              "environment": {
                "type": "string"
              },
              "prompt": {
                "type": "string"
              },
              "expectations": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "name": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9-_.]*$",
                "minLength": 1
              },
              "title": {
                "type": "string"
              },
              "includeFlowExpectations": {
                "type": "boolean"
              }
            },
            "required": [
              "name"
            ]
          }
        }
      },
      "required": [
        "kind",
        "type",
        "name",
        "agents",
        "happyPath"
      ]
    },
    "MetricConfig": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "metric"
        },
        "calculationType": {
          "type": "string",
          "const": "LLM_JUDGE"
        },
        "name": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1
        },
        "displayName": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        },
        "type": {
          "type": "string",
          "enum": [
            "BOOLEAN",
            "SCALE",
            "NUMERIC",
            "TEXT",
            "CLASSIFICATION"
          ]
        },
        "prompt": {
          "type": "string",
          "minLength": 1
        },
        "scope": {
          "type": "string",
          "enum": [
            "GLOBAL",
            "PER_PARTICIPANT"
          ],
          "default": "GLOBAL"
        },
        "participantRole": {
          "type": "string",
          "enum": [
            "AGENT",
            "CUSTOMER"
          ]
        },
        "contexts": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "CALL",
              "SEGMENT",
              "TURN"
            ]
          },
          "minItems": 1,
          "default": [
            "CALL"
          ]
        },
        "trueLabel": {
          "type": "string"
        },
        "falseLabel": {
          "type": "string"
        },
        "scaleMin": {
          "type": "integer"
        },
        "scaleMax": {
          "type": "integer"
        },
        "scaleLabels": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "rangeMin": {
                "type": "number"
              },
              "rangeMax": {
                "type": "number"
              },
              "label": {
                "type": "string",
                "minLength": 1
              },
              "description": {
                "type": "string"
              },
              "displayOrder": {
                "type": "integer"
              },
              "colorHex": {
                "type": "string"
              }
            },
            "required": [
              "rangeMin",
              "rangeMax",
              "label",
              "displayOrder"
            ]
          }
        },
        "options": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1
              },
              "description": {
                "type": "string"
              },
              "displayOrder": {
                "type": "integer"
              }
            },
            "required": [
              "label",
              "displayOrder"
            ]
          },
          "minItems": 1
        },
        "maxSelections": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "kind",
        "name",
        "type",
        "prompt"
      ]
    },
    "OrgProjectMemberConfig": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string",
          "format": "email"
        },
        "role": {
          "type": "string",
          "enum": [
            "OWNER",
            "ADMIN",
            "MEMBER",
            "VIEWER"
          ]
        }
      },
      "required": [
        "email",
        "role"
      ]
    },
    "PersonaConfig": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "persona"
        },
        "name": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1
        },
        "displayName": {
          "type": "string"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "language": {
          "type": "string",
          "enum": [
            "EN",
            "ES",
            "DE",
            "HI",
            "FR",
            "NL",
            "AR",
            "EL",
            "IT",
            "ID",
            "TH",
            "JA",
            "TL",
            "MS",
            "ZH",
            "TR",
            "PT",
            "HE"
          ]
        },
        "secondaryLanguage": {
          "type": [
            "string",
            "null"
          ],
          "const": "EN"
        },
        "understoodLanguages": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "EN",
              "ES",
              "DE",
              "HI",
              "FR",
              "NL",
              "AR",
              "EL",
              "IT",
              "ID",
              "TH",
              "JA",
              "TL",
              "MS",
              "ZH",
              "TR",
              "PT",
              "HE"
            ]
          },
          "minItems": 1
        },
        "accent": {
          "type": "string",
          "enum": [
            "US",
            "US_X_SOUTH",
            "GB",
            "ES",
            "DE",
            "IN",
            "FR",
            "NL",
            "SA",
            "GR",
            "AU",
            "IT",
            "ID",
            "TH",
            "JP",
            "NZ",
            "PH",
            "SG",
            "MY",
            "HK",
            "TR",
            "PT",
            "IL"
          ]
        },
        "age": {
          "type": "string",
          "enum": [
            "CHILD",
            "TEENAGER",
            "ADULT",
            "ELDERLY"
          ],
          "default": "ADULT"
        },
        "gender": {
          "type": "string",
          "enum": [
            "MALE",
            "FEMALE"
          ]
        },
        "backgroundNoise": {
          "type": "string",
          "enum": [
            "NONE",
            "AIRPORT",
            "CHILDREN_PLAYING",
            "CITY",
            "COFFEE_SHOP",
            "CONSTRUCTION",
            "CRYING_BABY",
            "DRIVING",
            "LIBRARY",
            "OFFICE",
            "THUNDERSTORM",
            "TRAIN"
          ],
          "default": "NONE"
        },
        "speechPace": {
          "type": "string",
          "enum": [
            "SUPER_SLOW",
            "SLOW",
            "NORMAL",
            "FAST",
            "SUPER_FAST"
          ],
          "default": "NORMAL"
        },
        "speechClarity": {
          "type": "string",
          "enum": [
            "CLEAR",
            "VAGUE",
            "RAMBLING"
          ],
          "default": "CLEAR"
        },
        "hasDisfluencies": {
          "type": "boolean",
          "default": false
        },
        "baseEmotion": {
          "type": "string",
          "enum": [
            "NEUTRAL",
            "CHEERFUL",
            "CONFUSED",
            "FRUSTRATED",
            "SKEPTICAL",
            "RUSHED",
            "DISTRACTED",
            "ANGRY",
            "ANXIOUS",
            "SAD"
          ],
          "default": "NEUTRAL"
        },
        "intentClarity": {
          "type": "string",
          "enum": [
            "CLEAR",
            "INDIRECT",
            "VAGUE"
          ],
          "default": "CLEAR"
        },
        "confirmationStyle": {
          "type": "string",
          "enum": [
            "EXPLICIT",
            "VAGUE"
          ],
          "default": "EXPLICIT"
        },
        "memoryReliability": {
          "type": "string",
          "enum": [
            "HIGH",
            "LOW"
          ],
          "default": "HIGH"
        },
        "responseTiming": {
          "type": "string",
          "enum": [
            "RELAXED",
            "NORMAL",
            "QUICK",
            "BARGE_IN"
          ],
          "default": "NORMAL"
        },
        "interruption": {
          "type": "string",
          "enum": [
            "OFF",
            "BACKCHANNEL",
            "OCCASIONAL",
            "HEAVY"
          ]
        },
        "backstoryPrompt": {
          "type": [
            "string",
            "null"
          ]
        },
        "idleMessages": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          }
        },
        "idleTimeoutSeconds": {
          "type": "integer",
          "minimum": 5,
          "maximum": 60,
          "default": 10
        },
        "idleMessageMaxSpokenCount": {
          "type": "integer",
          "minimum": 1,
          "maximum": 10,
          "default": 3
        },
        "idleMessageResetCountOnUserSpeechEnabled": {
          "type": "boolean",
          "default": true
        },
        "properties": {
          "type": "object",
          "additionalProperties": {}
        }
      },
      "required": [
        "kind",
        "name",
        "language",
        "accent",
        "gender"
      ]
    },
    "ProjectConfig": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "project"
        },
        "name": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1
        },
        "displayName": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        },
        "description": {
          "type": "string",
          "maxLength": 2000
        },
        "category": {
          "type": "string",
          "enum": [
            "HEALTHCARE",
            "FINANCIAL",
            "RETAIL",
            "HOSPITALITY",
            "AUTOMOTIVE",
            "GOVERNMENT",
            "EDUCATION",
            "REAL_ESTATE",
            "OTHER"
          ]
        },
        "dataStorageRegion": {
          "type": "string",
          "enum": [
            "US_EAST_1",
            "EU_WEST_1"
          ]
        },
        "members": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/OrgProjectMemberConfig"
          }
        },
        "resources": {
          "type": "array",
          "items": {
            "anyOf": [
              {
                "$ref": "#/$defs/AgentConfig"
              },
              {
                "$ref": "#/$defs/HttpRequestDefinitionConfig"
              },
              {
                "$ref": "#/$defs/PersonaConfig"
              },
              {
                "$ref": "#/$defs/ImprovFlowConfig"
              },
              {
                "$ref": "#/$defs/ScriptedFlowConfig"
              },
              {
                "$ref": "#/$defs/CollectorConfig"
              },
              {
                "$ref": "#/$defs/MetricConfig"
              },
              {
                "$ref": "#/$defs/ApiCheckMetricConfig"
              },
              {
                "$ref": "#/$defs/SimulationPlanConfig"
              },
              {
                "$ref": "#/$defs/QaSimulationPlanConfig"
              },
              {
                "$ref": "#/$defs/SimulationGroupConfig"
              },
              {
                "$ref": "#/$defs/AlertConfig"
              },
              {
                "$ref": "#/$defs/ToolConfig"
              },
              {
                "$ref": "#/$defs/DashboardConfig"
              }
            ]
          }
        }
      },
      "required": [
        "kind",
        "name"
      ]
    },
    "QaSimulationPlanConfig": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "simulationPlan"
        },
        "name": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "direction": {
          "type": "string",
          "enum": [
            "INBOUND",
            "OUTBOUND"
          ]
        },
        "agentEndpoints": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SimulationPlanAgentEndpointConfig"
          },
          "minItems": 1
        },
        "maxDurationSeconds": {
          "type": "integer",
          "minimum": 1
        },
        "iterations": {
          "type": "integer",
          "minimum": 1,
          "maximum": 10000,
          "default": 1
        },
        "maxConcurrentJobs": {
          "type": "integer",
          "minimum": 1,
          "default": 1
        },
        "executionMode": {
          "type": "string",
          "enum": [
            "PARALLEL",
            "SEQUENTIAL_SAME_RUN_PLAN",
            "SEQUENTIAL_PROJECT"
          ],
          "default": "PARALLEL"
        },
        "silenceTimeoutSeconds": {
          "type": "integer",
          "minimum": 1,
          "default": 30
        },
        "maxNoResponseRetries": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10,
          "default": 0
        },
        "noResponseRetryBackoffSeconds": {
          "type": "integer",
          "minimum": 30,
          "maximum": 600,
          "default": 90
        },
        "endCallPhrases": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "maxItems": 10,
          "default": [
            "goodbye"
          ]
        },
        "endCallReasons": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "maxItems": 10,
          "default": []
        },
        "includeFlowMetrics": {
          "type": "boolean",
          "default": true
        },
        "includeAutomaticMetrics": {
          "type": "boolean",
          "default": true
        },
        "enrichWithLiveConversation": {
          "type": "boolean",
          "default": false
        },
        "schedule": {
          "$ref": "#/$defs/SimulationPlanScheduleConfig"
        },
        "notify": {
          "$ref": "#/$defs/SimulationNotifyConfig"
        },
        "template": {
          "type": "string",
          "const": "question-answer-check"
        },
        "persona": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1
        },
        "environment": {
          "type": "string"
        },
        "gradeWithKnowledgeBase": {
          "type": "boolean",
          "default": false
        },
        "metrics": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "default": []
        },
        "questions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SimulationPlanQaQuestion"
          },
          "minItems": 1
        }
      },
      "required": [
        "kind",
        "name",
        "direction",
        "agentEndpoints",
        "maxDurationSeconds",
        "template",
        "persona",
        "environment",
        "questions"
      ]
    },
    "ScriptedFlowConfig": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "flow"
        },
        "type": {
          "type": "string",
          "const": "scripted"
        },
        "name": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1
        },
        "title": {
          "type": "string"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "agents": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-_.]*$",
            "minLength": 1
          }
        },
        "branchingMode": {
          "type": "string",
          "enum": [
            "DETERMINISTIC",
            "ADAPTIVE"
          ]
        },
        "adherence": {
          "type": "string",
          "enum": [
            "LOOSE",
            "STRICT"
          ]
        },
        "offScript": {
          "$ref": "#/$defs/ConfigOffScript"
        },
        "expectations": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "graph": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ConfigFlowStep"
          },
          "minItems": 1
        }
      },
      "required": [
        "kind",
        "type",
        "name",
        "graph"
      ]
    },
    "SimulationGroupConfig": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "simulationGroup"
        },
        "name": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1,
          "maxLength": 200
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "plans": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 2,
          "maxItems": 20
        },
        "schedule": {
          "$ref": "#/$defs/SimulationPlanScheduleConfig"
        },
        "notify": {
          "allOf": [
            {
              "$ref": "#/$defs/SimulationNotifyConfig"
            }
          ],
          "default": {}
        }
      },
      "required": [
        "kind",
        "name",
        "plans"
      ]
    },
    "SimulationNotifyConfig": {
      "type": "object",
      "properties": {
        "email": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "array",
              "items": {
                "type": "string",
                "format": "email"
              },
              "minItems": 1,
              "maxItems": 50
            }
          ],
          "default": true
        },
        "slack": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AlertSlackChannel"
          },
          "maxItems": 10,
          "default": []
        }
      }
    },
    "SimulationPlanAgentEndpointConfig": {
      "type": "object",
      "properties": {
        "agent": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1
        },
        "value": {
          "type": "string",
          "minLength": 1
        },
        "direction": {
          "type": "string",
          "enum": [
            "INCOMING",
            "OUTGOING",
            "INCOMING_AND_OUTGOING"
          ]
        }
      },
      "required": [
        "agent"
      ]
    },
    "SimulationPlanConfig": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "simulationPlan"
        },
        "name": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "direction": {
          "type": "string",
          "enum": [
            "INBOUND",
            "OUTBOUND"
          ]
        },
        "agentEndpoints": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SimulationPlanAgentEndpointConfig"
          },
          "minItems": 1
        },
        "maxDurationSeconds": {
          "type": "integer",
          "minimum": 1
        },
        "iterations": {
          "type": "integer",
          "minimum": 1,
          "maximum": 10000,
          "default": 1
        },
        "maxConcurrentJobs": {
          "type": "integer",
          "minimum": 1,
          "default": 1
        },
        "executionMode": {
          "type": "string",
          "enum": [
            "PARALLEL",
            "SEQUENTIAL_SAME_RUN_PLAN",
            "SEQUENTIAL_PROJECT"
          ],
          "default": "PARALLEL"
        },
        "silenceTimeoutSeconds": {
          "type": "integer",
          "minimum": 1,
          "default": 30
        },
        "maxNoResponseRetries": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10,
          "default": 0
        },
        "noResponseRetryBackoffSeconds": {
          "type": "integer",
          "minimum": 30,
          "maximum": 600,
          "default": 90
        },
        "endCallPhrases": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "maxItems": 10,
          "default": [
            "goodbye"
          ]
        },
        "endCallReasons": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "maxItems": 10,
          "default": []
        },
        "includeFlowMetrics": {
          "type": "boolean",
          "default": true
        },
        "includeAutomaticMetrics": {
          "type": "boolean",
          "default": true
        },
        "enrichWithLiveConversation": {
          "type": "boolean",
          "default": false
        },
        "schedule": {
          "$ref": "#/$defs/SimulationPlanScheduleConfig"
        },
        "notify": {
          "$ref": "#/$defs/SimulationNotifyConfig"
        },
        "template": {
          "type": "string",
          "const": "manual",
          "default": "manual"
        },
        "metrics": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 1
        },
        "flows": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SimulationPlanFlowConfig"
          },
          "minItems": 1
        }
      },
      "required": [
        "kind",
        "name",
        "direction",
        "agentEndpoints",
        "maxDurationSeconds",
        "metrics",
        "flows"
      ]
    },
    "SimulationPlanFlowConfig": {
      "type": "object",
      "properties": {
        "flow": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1
        },
        "system": {
          "type": "string",
          "minLength": 1
        },
        "happyPath": {
          "type": "boolean"
        },
        "edgeCases": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "personaOverride": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1
        }
      }
    },
    "SimulationPlanQaQuestion": {
      "type": "object",
      "properties": {
        "ask": {
          "type": "string",
          "minLength": 1
        },
        "expect": {
          "type": "string",
          "minLength": 1
        },
        "name": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1
        }
      },
      "required": [
        "ask"
      ]
    },
    "SimulationPlanScheduleConfig": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "timezone": {
              "type": "string",
              "default": "UTC"
            },
            "enabled": {
              "type": "boolean",
              "default": true
            },
            "endDate": {
              "type": "string",
              "format": "date-time"
            },
            "maxRuns": {
              "type": "integer",
              "minimum": 1
            },
            "type": {
              "type": "string",
              "const": "hourly"
            },
            "minute": {
              "type": "integer",
              "minimum": 0,
              "maximum": 59,
              "default": 0
            }
          },
          "required": [
            "type"
          ]
        },
        {
          "type": "object",
          "properties": {
            "timezone": {
              "type": "string",
              "default": "UTC"
            },
            "enabled": {
              "type": "boolean",
              "default": true
            },
            "endDate": {
              "type": "string",
              "format": "date-time"
            },
            "maxRuns": {
              "type": "integer",
              "minimum": 1
            },
            "type": {
              "type": "string",
              "const": "interval"
            },
            "everyMinutes": {
              "type": "integer",
              "minimum": 15,
              "maximum": 59
            }
          },
          "required": [
            "type",
            "everyMinutes"
          ]
        },
        {
          "type": "object",
          "properties": {
            "timezone": {
              "type": "string",
              "default": "UTC"
            },
            "enabled": {
              "type": "boolean",
              "default": true
            },
            "endDate": {
              "type": "string",
              "format": "date-time"
            },
            "maxRuns": {
              "type": "integer",
              "minimum": 1
            },
            "type": {
              "type": "string",
              "const": "daily"
            },
            "time": {
              "type": "string",
              "pattern": "^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$"
            }
          },
          "required": [
            "type",
            "time"
          ]
        },
        {
          "type": "object",
          "properties": {
            "timezone": {
              "type": "string",
              "default": "UTC"
            },
            "enabled": {
              "type": "boolean",
              "default": true
            },
            "endDate": {
              "type": "string",
              "format": "date-time"
            },
            "maxRuns": {
              "type": "integer",
              "minimum": 1
            },
            "type": {
              "type": "string",
              "const": "weekly"
            },
            "days": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "sunday",
                  "monday",
                  "tuesday",
                  "wednesday",
                  "thursday",
                  "friday",
                  "saturday"
                ]
              },
              "minItems": 1,
              "maxItems": 7
            },
            "time": {
              "type": "string",
              "pattern": "^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$"
            }
          },
          "required": [
            "type",
            "days",
            "time"
          ]
        },
        {
          "type": "object",
          "properties": {
            "timezone": {
              "type": "string",
              "default": "UTC"
            },
            "enabled": {
              "type": "boolean",
              "default": true
            },
            "endDate": {
              "type": "string",
              "format": "date-time"
            },
            "maxRuns": {
              "type": "integer",
              "minimum": 1
            },
            "type": {
              "type": "string",
              "const": "monthly"
            },
            "dayOfMonth": {
              "type": "integer",
              "minimum": 1,
              "maximum": 31
            },
            "time": {
              "type": "string",
              "pattern": "^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$"
            }
          },
          "required": [
            "type",
            "dayOfMonth",
            "time"
          ]
        },
        {
          "type": "object",
          "properties": {
            "timezone": {
              "type": "string",
              "default": "UTC"
            },
            "enabled": {
              "type": "boolean",
              "default": true
            },
            "type": {
              "type": "string",
              "const": "once"
            },
            "at": {
              "type": "string",
              "format": "date-time"
            }
          },
          "required": [
            "type",
            "at"
          ]
        }
      ]
    },
    "ToolConfig": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "tool"
        },
        "name": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "parameters": {
          "type": "object",
          "additionalProperties": {
            "type": "string",
            "enum": [
              "string",
              "number",
              "boolean"
            ]
          }
        },
        "invocationCriteria": {
          "type": [
            "string",
            "null"
          ]
        },
        "expectedResult": {
          "type": [
            "string",
            "null"
          ]
        },
        "agent": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9-_.]*$",
          "minLength": 1
        },
        "handler": {
          "$ref": "#/$defs/ToolHandler"
        }
      },
      "required": [
        "kind",
        "name"
      ]
    },
    "ToolHandler": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "const": "http"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "method": {
          "type": "string",
          "enum": [
            "GET",
            "POST",
            "PUT",
            "PATCH",
            "DELETE"
          ]
        }
      },
      "required": [
        "type",
        "url"
      ]
    }
  }
}