{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Workflow",
  "type": "object",
  "properties": {
    "apiVersion": {
      "type": "string"
    },
    "kind": {
      "$ref": "#/$defs/WorkflowKind"
    },
    "metadata": {
      "$ref": "#/$defs/Metadata"
    },
    "spec": {
      "$ref": "#/$defs/WorkflowSpec"
    }
  },
  "additionalProperties": false,
  "required": [
    "apiVersion",
    "kind",
    "metadata",
    "spec"
  ],
  "$defs": {
    "WorkflowKind": {
      "type": "string",
      "enum": [
        "Workflow"
      ]
    },
    "Metadata": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "labels": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        }
      },
      "additionalProperties": false,
      "required": [
        "name"
      ]
    },
    "WorkflowSpec": {
      "type": "object",
      "properties": {
        "inputs": {
          "type": "object",
          "additionalProperties": true,
          "default": {}
        },
        "outputs": {
          "type": "object",
          "additionalProperties": true,
          "default": {}
        },
        "providers": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/ProviderDefinition"
          },
          "default": {}
        },
        "agents": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/AgentDefinition"
          },
          "default": {}
        },
        "actions": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/ActionDefinition"
          },
          "default": {}
        },
        "tools": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/ToolDefinition"
          },
          "default": {}
        },
        "subworkflows": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/SubworkflowDefinition"
          },
          "default": {}
        },
        "compensation": {
          "$ref": "#/$defs/CompensationPolicyDefinition",
          "default": {
            "onFailure": "manual",
            "approval": "policy"
          }
        },
        "tasks": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TaskDefinition"
          }
        },
        "policy": {
          "$ref": "#/$defs/PolicyDefinition",
          "default": {
            "workspaceRoot": ".",
            "writableRoots": [],
            "environmentAllowlist": [],
            "networkAllowlist": [],
            "network": {
              "allowedSchemes": [
                "https",
                "http"
              ],
              "allowedPorts": [],
              "allowPrivate": false,
              "allowProxy": false,
              "connectTimeoutSeconds": 10,
              "maxResponseBytes": 8388608
            },
            "processAllowlist": [],
            "secretFileRoots": [],
            "secretProcessAllowlist": [],
            "providers": [],
            "toolsAllow": [],
            "toolsDeny": [],
            "approval": "mutations",
            "nonInteractive": "pause"
          }
        },
        "memory": {
          "$ref": "#/$defs/MemoryDefinition",
          "default": {
            "working": {}
          }
        },
        "mcpServers": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/McpServerDefinition"
          },
          "default": {}
        },
        "a2aPeers": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/A2aPeerDefinition"
          },
          "default": {}
        },
        "packs": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PackReference"
          },
          "default": []
        },
        "packTrust": {
          "$ref": "#/$defs/PackTrustDefinition",
          "default": {
            "unsigned": "warn",
            "identities": [],
            "allowUnsignedProcess": false
          }
        },
        "runtime": {
          "$ref": "#/$defs/RuntimeDefinition",
          "default": {
            "maxConcurrency": 1,
            "defaultTimeoutSeconds": 120,
            "budgets": {}
          }
        },
        "output": {
          "$ref": "#/$defs/OutputDefinition",
          "default": {
            "verbose": false,
            "showDiff": true
          }
        }
      },
      "additionalProperties": false,
      "required": [
        "tasks"
      ]
    },
    "ProviderDefinition": {
      "type": "object",
      "properties": {
        "kind": {
          "$ref": "#/$defs/ProviderKind"
        },
        "endpoint": {
          "type": [
            "string",
            "null"
          ]
        },
        "credential": {
          "anyOf": [
            {
              "$ref": "#/$defs/SecretReference"
            },
            {
              "type": "null"
            }
          ]
        },
        "apiVersion": {
          "type": [
            "string",
            "null"
          ]
        },
        "headers": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/SecretReference"
          },
          "default": {}
        }
      },
      "additionalProperties": false,
      "required": [
        "kind"
      ]
    },
    "ProviderKind": {
      "type": "string",
      "enum": [
        "fake",
        "openai",
        "anthropic",
        "google",
        "azure_openai"
      ]
    },
    "SecretReference": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "env": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "env"
          ]
        },
        {
          "type": "object",
          "properties": {
            "file": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "file"
          ]
        },
        {
          "type": "object",
          "properties": {
            "process": {
              "$ref": "#/$defs/SecretProcessReference"
            }
          },
          "additionalProperties": false,
          "required": [
            "process"
          ]
        }
      ]
    },
    "SecretProcessReference": {
      "type": "object",
      "properties": {
        "command": {
          "type": "string"
        },
        "args": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "default": []
        },
        "timeoutSeconds": {
          "type": "integer",
          "format": "uint64",
          "minimum": 0,
          "default": 5
        },
        "outputLimitBytes": {
          "type": "integer",
          "format": "uint64",
          "minimum": 0,
          "default": 16384
        }
      },
      "additionalProperties": false,
      "required": [
        "command"
      ]
    },
    "AgentDefinition": {
      "type": "object",
      "properties": {
        "provider": {
          "type": "string"
        },
        "model": {
          "type": "string"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "instructions": {
          "type": [
            "string",
            "null"
          ]
        },
        "instructionsFile": {
          "type": [
            "string",
            "null"
          ]
        },
        "vars": {
          "type": "object",
          "additionalProperties": true,
          "default": {}
        },
        "tools": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "default": []
        },
        "maxTurns": {
          "type": "integer",
          "format": "uint16",
          "minimum": 0,
          "maximum": 65535,
          "default": 8
        },
        "maxToolCalls": {
          "type": "integer",
          "format": "uint16",
          "minimum": 0,
          "maximum": 65535,
          "default": 16
        },
        "maxOutputTokens": {
          "type": "integer",
          "format": "uint32",
          "minimum": 0,
          "default": 2048
        },
        "timeoutSeconds": {
          "type": "integer",
          "format": "uint64",
          "minimum": 0,
          "default": 120
        },
        "retry": {
          "$ref": "#/$defs/RetryDefinition",
          "default": {
            "maxAttempts": 1,
            "backoffMs": 0
          }
        },
        "reasoning": {
          "anyOf": [
            {
              "$ref": "#/$defs/ReasoningDefinition"
            },
            {
              "type": "null"
            }
          ]
        },
        "structuredOutput": true,
        "usageLimit": {
          "anyOf": [
            {
              "$ref": "#/$defs/UsageLimitDefinition"
            },
            {
              "type": "null"
            }
          ]
        },
        "stream": {
          "type": "boolean",
          "default": false
        },
        "providerOptions": {
          "type": "object",
          "additionalProperties": true,
          "default": {}
        }
      },
      "additionalProperties": false,
      "required": [
        "provider",
        "model"
      ]
    },
    "RetryDefinition": {
      "type": "object",
      "properties": {
        "maxAttempts": {
          "type": "integer",
          "format": "uint16",
          "minimum": 0,
          "maximum": 65535,
          "default": 1
        },
        "backoffMs": {
          "type": "integer",
          "format": "uint64",
          "minimum": 0,
          "default": 0
        }
      },
      "additionalProperties": false
    },
    "ReasoningDefinition": {
      "type": "object",
      "properties": {
        "effort": {
          "$ref": "#/$defs/ReasoningEffort"
        },
        "mode": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "additionalProperties": false,
      "required": [
        "effort"
      ]
    },
    "ReasoningEffort": {
      "type": "string",
      "enum": [
        "none",
        "low",
        "medium",
        "high",
        "xhigh",
        "max"
      ]
    },
    "UsageLimitDefinition": {
      "type": "object",
      "properties": {
        "maxInputTokens": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0
        },
        "maxOutputTokens": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0
        },
        "maxCostUsd": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        }
      },
      "additionalProperties": false
    },
    "ActionDefinition": {
      "type": "object",
      "properties": {
        "kind": {
          "$ref": "#/$defs/ActionKind"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "with": {
          "type": "object",
          "additionalProperties": true,
          "default": {}
        },
        "idempotency": {
          "anyOf": [
            {
              "$ref": "#/$defs/Idempotency"
            },
            {
              "type": "null"
            }
          ]
        },
        "command": {
          "type": [
            "string",
            "null"
          ]
        },
        "args": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "default": []
        },
        "cwd": {
          "type": [
            "string",
            "null"
          ]
        },
        "env": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/SecretReference"
          },
          "default": {}
        },
        "timeoutSeconds": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0,
          "default": null
        },
        "stdoutLimitBytes": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0
        },
        "stderrLimitBytes": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0
        },
        "combinedOutputLimitBytes": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0
        },
        "isolation": {
          "$ref": "#/$defs/ProcessIsolation"
        },
        "container": {
          "anyOf": [
            {
              "$ref": "#/$defs/ContainerIsolationDefinition"
            },
            {
              "type": "null"
            }
          ]
        },
        "protocolVersion": {
          "type": [
            "string",
            "null"
          ]
        },
        "inputSchema": true,
        "outputSchema": true,
        "capabilities": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "default": []
        }
      },
      "additionalProperties": false,
      "required": [
        "kind"
      ]
    },
    "ActionKind": {
      "type": "string",
      "enum": [
        "builtin.assign",
        "builtin.assert",
        "builtin.read",
        "builtin.write",
        "builtin.shell.exec",
        "extension.process",
        "builtin.memory.read",
        "builtin.memory.write",
        "builtin.long_term_memory.read",
        "builtin.long_term_memory.search",
        "builtin.long_term_memory.write",
        "builtin.long_term_memory.promote",
        "mcp.call",
        "a2a.delegate"
      ]
    },
    "Idempotency": {
      "type": "string",
      "enum": [
        "pure",
        "idempotent",
        "keyed",
        "at_most_once",
        "unknown"
      ]
    },
    "ProcessIsolation": {
      "type": "string",
      "enum": [
        "process",
        "container"
      ]
    },
    "ContainerIsolationDefinition": {
      "type": "object",
      "properties": {
        "image": {
          "type": "string"
        },
        "runtime": {
          "$ref": "#/$defs/ContainerRuntime",
          "default": "auto"
        },
        "memoryLimitBytes": {
          "type": "integer",
          "format": "uint64",
          "minimum": 0,
          "default": 268435456
        },
        "cpuLimitMillis": {
          "type": "integer",
          "format": "uint32",
          "minimum": 0,
          "default": 1000
        },
        "pidsLimit": {
          "type": "integer",
          "format": "uint32",
          "minimum": 0,
          "default": 64
        }
      },
      "additionalProperties": false,
      "required": [
        "image"
      ]
    },
    "ContainerRuntime": {
      "type": "string",
      "enum": [
        "auto",
        "docker",
        "podman"
      ]
    },
    "ToolDefinition": {
      "type": "object",
      "properties": {
        "kind": {
          "$ref": "#/$defs/ToolKind"
        },
        "description": {
          "type": "string"
        },
        "inputSchema": true,
        "outputSchema": true,
        "capability": {
          "type": "string"
        },
        "risk": {
          "$ref": "#/$defs/Risk"
        },
        "effectClass": {
          "$ref": "#/$defs/EffectClass"
        },
        "idempotency": {
          "$ref": "#/$defs/Idempotency"
        },
        "retrySafe": {
          "type": "boolean"
        },
        "timeoutSeconds": {
          "type": "integer",
          "format": "uint64",
          "minimum": 0
        },
        "secrets": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SecretReference"
          },
          "default": []
        },
        "network": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "default": []
        },
        "approval": {
          "$ref": "#/$defs/ApprovalRequirement",
          "default": "policy"
        }
      },
      "additionalProperties": false,
      "required": [
        "kind",
        "description",
        "inputSchema",
        "outputSchema",
        "capability",
        "risk",
        "effectClass",
        "idempotency",
        "retrySafe",
        "timeoutSeconds"
      ]
    },
    "ToolKind": {
      "type": "string",
      "enum": [
        "builtin.workspace.read",
        "builtin.workspace.write",
        "builtin.echo"
      ]
    },
    "Risk": {
      "type": "string",
      "enum": [
        "low",
        "medium",
        "high",
        "critical"
      ]
    },
    "EffectClass": {
      "type": "string",
      "enum": [
        "pure",
        "internal_state",
        "observe",
        "workspace_mutate",
        "external_mutate",
        "process_execution",
        "network",
        "model",
        "remote_agent"
      ]
    },
    "ApprovalRequirement": {
      "type": "string",
      "enum": [
        "policy",
        "never",
        "always"
      ]
    },
    "SubworkflowDefinition": {
      "type": "object",
      "properties": {
        "version": {
          "type": "string"
        },
        "inputs": {
          "type": "object",
          "additionalProperties": true,
          "default": {}
        },
        "inputSchema": true,
        "outputs": {
          "type": "object",
          "additionalProperties": true,
          "default": {}
        },
        "outputSchema": true,
        "tasks": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TaskDefinition"
          }
        }
      },
      "additionalProperties": false,
      "required": [
        "version",
        "inputSchema",
        "outputSchema",
        "tasks"
      ]
    },
    "TaskDefinition": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "uses": {
          "type": "string"
        },
        "needs": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "default": []
        },
        "foreach": {
          "anyOf": [
            {
              "$ref": "#/$defs/ForeachDefinition"
            },
            {
              "type": "null"
            }
          ]
        },
        "matrix": {
          "anyOf": [
            {
              "$ref": "#/$defs/MatrixDefinition"
            },
            {
              "type": "null"
            }
          ]
        },
        "route": {
          "anyOf": [
            {
              "$ref": "#/$defs/RouteDefinition"
            },
            {
              "type": "null"
            }
          ]
        },
        "loop": {
          "anyOf": [
            {
              "$ref": "#/$defs/LoopDefinition"
            },
            {
              "type": "null"
            }
          ]
        },
        "memoryWrites": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "when": {
          "type": [
            "string",
            "null"
          ],
          "default": null
        },
        "vars": {
          "type": "object",
          "additionalProperties": true,
          "default": {}
        },
        "with": {
          "type": "object",
          "additionalProperties": true,
          "default": {}
        },
        "retry": {
          "$ref": "#/$defs/RetryDefinition",
          "default": {
            "maxAttempts": 1,
            "backoffMs": 0
          }
        },
        "timeoutSeconds": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0,
          "default": null
        },
        "failure": {
          "$ref": "#/$defs/FailureBehavior",
          "default": "stop"
        },
        "compensate": {
          "anyOf": [
            {
              "$ref": "#/$defs/CompensationDefinition"
            },
            {
              "type": "null"
            }
          ]
        },
        "outputSchema": true
      },
      "additionalProperties": false,
      "required": [
        "id",
        "uses"
      ]
    },
    "ForeachDefinition": {
      "type": "object",
      "properties": {
        "items": {
          "type": "array",
          "items": true
        },
        "as": {
          "type": "string",
          "default": "item"
        },
        "maxItems": {
          "type": "integer",
          "format": "uint",
          "minimum": 0,
          "default": 32
        }
      },
      "additionalProperties": false,
      "required": [
        "items"
      ]
    },
    "MatrixDefinition": {
      "type": "object",
      "properties": {
        "axes": {
          "type": "object",
          "additionalProperties": {
            "type": "array",
            "items": true
          }
        },
        "maxItems": {
          "type": "integer",
          "format": "uint",
          "minimum": 0,
          "default": 32
        }
      },
      "additionalProperties": false,
      "required": [
        "axes"
      ]
    },
    "RouteDefinition": {
      "type": "object",
      "properties": {
        "select": {
          "type": "string"
        },
        "cases": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RouteCaseDefinition"
          }
        },
        "default": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "default": []
        }
      },
      "additionalProperties": false,
      "required": [
        "select",
        "cases"
      ]
    },
    "RouteCaseDefinition": {
      "type": "object",
      "properties": {
        "equals": true,
        "tasks": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": false,
      "required": [
        "equals",
        "tasks"
      ]
    },
    "LoopDefinition": {
      "type": "object",
      "properties": {
        "maxIterations": {
          "type": "integer",
          "format": "uint",
          "minimum": 0
        },
        "while": {
          "type": "string"
        },
        "initial": {
          "default": null
        }
      },
      "additionalProperties": false,
      "required": [
        "maxIterations",
        "while"
      ]
    },
    "FailureBehavior": {
      "type": "string",
      "enum": [
        "stop",
        "continue"
      ]
    },
    "CompensationDefinition": {
      "type": "object",
      "properties": {
        "uses": {
          "type": "string"
        },
        "with": {
          "type": "object",
          "additionalProperties": true,
          "default": {}
        },
        "retry": {
          "$ref": "#/$defs/RetryDefinition",
          "default": {
            "maxAttempts": 1,
            "backoffMs": 0
          }
        },
        "timeoutSeconds": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0,
          "default": null
        }
      },
      "additionalProperties": false,
      "required": [
        "uses"
      ]
    },
    "CompensationPolicyDefinition": {
      "type": "object",
      "properties": {
        "onFailure": {
          "$ref": "#/$defs/CompensationTrigger",
          "default": "manual"
        },
        "approval": {
          "$ref": "#/$defs/ApprovalRequirement",
          "default": "policy"
        }
      },
      "additionalProperties": false
    },
    "CompensationTrigger": {
      "type": "string",
      "enum": [
        "manual",
        "automatic"
      ]
    },
    "PolicyDefinition": {
      "type": "object",
      "properties": {
        "workspaceRoot": {
          "type": "string",
          "default": "."
        },
        "writableRoots": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "default": []
        },
        "environmentAllowlist": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "default": []
        },
        "networkAllowlist": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "default": []
        },
        "network": {
          "$ref": "#/$defs/NetworkPolicyDefinition",
          "default": {
            "allowedSchemes": [
              "https",
              "http"
            ],
            "allowedPorts": [],
            "allowPrivate": false,
            "allowProxy": false,
            "connectTimeoutSeconds": 10,
            "maxResponseBytes": 8388608
          }
        },
        "processAllowlist": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "default": []
        },
        "secretFileRoots": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "default": []
        },
        "secretProcessAllowlist": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "default": []
        },
        "providers": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "default": []
        },
        "toolsAllow": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "default": []
        },
        "toolsDeny": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "default": []
        },
        "approval": {
          "$ref": "#/$defs/ApprovalMode",
          "default": "mutations"
        },
        "nonInteractive": {
          "$ref": "#/$defs/NonInteractiveMode",
          "default": "pause"
        }
      },
      "additionalProperties": false
    },
    "NetworkPolicyDefinition": {
      "type": "object",
      "properties": {
        "allowedSchemes": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "default": [
            "https",
            "http"
          ]
        },
        "allowedPorts": {
          "type": "array",
          "items": {
            "type": "integer",
            "format": "uint16",
            "minimum": 0,
            "maximum": 65535
          },
          "default": []
        },
        "allowPrivate": {
          "type": "boolean",
          "default": false
        },
        "allowProxy": {
          "type": "boolean",
          "default": false
        },
        "customCa": {
          "anyOf": [
            {
              "$ref": "#/$defs/SecretReference"
            },
            {
              "type": "null"
            }
          ]
        },
        "connectTimeoutSeconds": {
          "type": "integer",
          "format": "uint64",
          "minimum": 0,
          "default": 10
        },
        "maxResponseBytes": {
          "type": "integer",
          "format": "uint64",
          "minimum": 0,
          "default": 8388608
        }
      },
      "additionalProperties": false
    },
    "ApprovalMode": {
      "type": "string",
      "enum": [
        "never",
        "mutations",
        "high_risk",
        "always"
      ]
    },
    "NonInteractiveMode": {
      "type": "string",
      "enum": [
        "pause",
        "deny_approval",
        "fail"
      ]
    },
    "MemoryDefinition": {
      "type": "object",
      "properties": {
        "working": {
          "type": "object",
          "additionalProperties": true,
          "default": {}
        },
        "longTerm": {
          "anyOf": [
            {
              "$ref": "#/$defs/LongTermMemoryDefinition"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "LongTermMemoryDefinition": {
      "type": "object",
      "properties": {
        "provider": {
          "type": "string",
          "default": "sqlite"
        },
        "namespace": {
          "type": "string",
          "default": "default"
        },
        "retentionDays": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint32",
          "minimum": 0
        },
        "embedding": {
          "$ref": "#/$defs/MemoryEmbeddingDefinition",
          "default": {
            "provider": "local_hash",
            "dimensions": 64
          }
        }
      },
      "additionalProperties": false
    },
    "MemoryEmbeddingDefinition": {
      "type": "object",
      "properties": {
        "provider": {
          "type": "string",
          "default": "local_hash"
        },
        "model": {
          "type": [
            "string",
            "null"
          ]
        },
        "dimensions": {
          "type": "integer",
          "format": "uint16",
          "minimum": 0,
          "maximum": 65535,
          "default": 64
        }
      },
      "additionalProperties": false
    },
    "McpServerDefinition": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string"
        },
        "headers": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/SecretReference"
          },
          "default": {}
        },
        "timeoutSeconds": {
          "type": "integer",
          "format": "uint64",
          "minimum": 0,
          "default": 120
        },
        "protocolVersion": {
          "type": "string",
          "default": "2025-11-25"
        }
      },
      "additionalProperties": false,
      "required": [
        "url"
      ]
    },
    "A2aPeerDefinition": {
      "type": "object",
      "properties": {
        "cardUrl": {
          "type": "string"
        },
        "headers": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/SecretReference"
          },
          "default": {}
        },
        "timeoutSeconds": {
          "type": "integer",
          "format": "uint64",
          "minimum": 0,
          "default": 120
        },
        "maxPolls": {
          "type": "integer",
          "format": "uint",
          "minimum": 0,
          "default": 100
        },
        "pollIntervalMs": {
          "type": "integer",
          "format": "uint64",
          "minimum": 0,
          "default": 100
        },
        "protocolVersion": {
          "type": "string",
          "default": "1.0"
        }
      },
      "additionalProperties": false,
      "required": [
        "cardUrl"
      ]
    },
    "PackReference": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "source": {
          "anyOf": [
            {
              "$ref": "#/$defs/PackSource"
            },
            {
              "type": "null"
            }
          ]
        },
        "signature": {
          "anyOf": [
            {
              "$ref": "#/$defs/PackSignature"
            },
            {
              "type": "null"
            }
          ]
        },
        "path": {
          "type": [
            "string",
            "null"
          ]
        },
        "integrity": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "additionalProperties": false,
      "required": [
        "name",
        "version"
      ]
    },
    "PackSource": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "path": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "path"
          ]
        },
        {
          "type": "object",
          "properties": {
            "git": {
              "type": "string"
            },
            "rev": {
              "type": "string"
            },
            "manifest": {
              "type": "string",
              "default": "agentctl.pack.yaml"
            }
          },
          "additionalProperties": false,
          "required": [
            "git",
            "rev"
          ]
        },
        {
          "type": "object",
          "properties": {
            "url": {
              "type": "string"
            },
            "integrity": {
              "type": "string"
            },
            "manifest": {
              "type": "string",
              "default": "agentctl.pack.yaml"
            }
          },
          "additionalProperties": false,
          "required": [
            "url",
            "integrity"
          ]
        }
      ]
    },
    "PackSignature": {
      "type": "object",
      "properties": {
        "bundle": {
          "type": "string"
        },
        "identity": {
          "type": "string"
        },
        "issuer": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "bundle",
        "identity",
        "issuer"
      ]
    },
    "PackTrustDefinition": {
      "type": "object",
      "properties": {
        "unsigned": {
          "$ref": "#/$defs/UnsignedPackPolicy",
          "default": "warn"
        },
        "identities": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PackIdentity"
          },
          "default": []
        },
        "allowUnsignedProcess": {
          "type": "boolean",
          "default": false
        }
      },
      "additionalProperties": false
    },
    "UnsignedPackPolicy": {
      "type": "string",
      "enum": [
        "deny",
        "warn",
        "allow"
      ]
    },
    "PackIdentity": {
      "type": "object",
      "properties": {
        "identity": {
          "type": "string"
        },
        "issuer": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "identity",
        "issuer"
      ]
    },
    "RuntimeDefinition": {
      "type": "object",
      "properties": {
        "maxConcurrency": {
          "type": "integer",
          "format": "uint",
          "minimum": 0,
          "default": 1
        },
        "defaultTimeoutSeconds": {
          "type": "integer",
          "format": "uint64",
          "minimum": 0,
          "default": 120
        },
        "budgets": {
          "$ref": "#/$defs/ResourceBudgetDefinition",
          "default": {}
        },
        "pricing": {
          "anyOf": [
            {
              "$ref": "#/$defs/PricingDefinition"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "ResourceBudgetDefinition": {
      "type": "object",
      "properties": {
        "maxProviderRequests": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0
        },
        "maxTurns": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0
        },
        "maxToolCalls": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0
        },
        "maxInputTokens": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0
        },
        "maxOutputTokens": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0
        },
        "maxTotalTokens": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0
        },
        "maxWallTimeSeconds": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0
        },
        "maxProcessOutputBytes": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0
        },
        "maxArtifactBytes": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0
        },
        "maxTasks": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0
        },
        "maxExpansionItems": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0
        },
        "maxLoopIterations": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0
        },
        "maxCostMicrousd": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0
        }
      },
      "additionalProperties": false
    },
    "PricingDefinition": {
      "type": "object",
      "properties": {
        "version": {
          "type": "string"
        },
        "models": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/ModelPricingDefinition"
          }
        }
      },
      "additionalProperties": false,
      "required": [
        "version",
        "models"
      ]
    },
    "ModelPricingDefinition": {
      "type": "object",
      "properties": {
        "inputMicrousdPerMillionTokens": {
          "type": "integer",
          "format": "uint64",
          "minimum": 0
        },
        "outputMicrousdPerMillionTokens": {
          "type": "integer",
          "format": "uint64",
          "minimum": 0
        },
        "reasoningMicrousdPerMillionTokens": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0
        },
        "cacheReadMicrousdPerMillionTokens": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0
        },
        "cacheWriteMicrousdPerMillionTokens": {
          "type": [
            "integer",
            "null"
          ],
          "format": "uint64",
          "minimum": 0
        }
      },
      "additionalProperties": false,
      "required": [
        "inputMicrousdPerMillionTokens",
        "outputMicrousdPerMillionTokens"
      ]
    },
    "OutputDefinition": {
      "type": "object",
      "properties": {
        "verbose": {
          "type": "boolean",
          "default": false
        },
        "showDiff": {
          "type": "boolean",
          "default": false
        }
      },
      "additionalProperties": false
    }
  }
}
