{
  "components": {
    "schemas": {
      "APIPricing": {
        "additionalProperties": false,
        "properties": {
          "completion_cost": {
            "description": "Cost per completion token",
            "format": "double",
            "type": "number"
          },
          "prompt_cost": {
            "description": "Cost per prompt token",
            "format": "double",
            "type": "number"
          },
          "request_cost": {
            "description": "Fixed cost per request",
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "prompt_cost",
          "completion_cost"
        ],
        "type": "object"
      },
      "AgentCapabilityItem": {
        "additionalProperties": false,
        "properties": {
          "description": {
            "description": "Capability description",
            "type": "string"
          },
          "name": {
            "description": "Capability identifier",
            "type": "string"
          },
          "test_coverage": {
            "description": "Test coverage score (0-1); values \u003e= 0.5 are treated as covered",
            "format": "double",
            "maximum": 1,
            "minimum": 0,
            "type": "number"
          }
        },
        "required": [
          "name",
          "description",
          "test_coverage"
        ],
        "type": "object"
      },
      "AgentConfig": {
        "additionalProperties": false,
        "properties": {
          "AdaptiveRetryEnabled": {
            "type": "boolean"
          },
          "ApprovalTimeout": {
            "format": "int64",
            "type": "integer"
          },
          "CheapModelContextLength": {
            "format": "int64",
            "type": "integer"
          },
          "CheapModelPricing": {
            "$ref": "#/components/schemas/ModelPricing"
          },
          "ContinueAsNewStateBytes": {
            "format": "int64",
            "type": "integer"
          },
          "ContinueAsNewSteps": {
            "format": "int64",
            "type": "integer"
          },
          "CostPolicy": {
            "$ref": "#/components/schemas/CostPolicy"
          },
          "DecisionLogLimit": {
            "format": "int64",
            "type": "integer"
          },
          "LoopEfficiencyGuardDisabled": {
            "type": "boolean"
          },
          "MaxSteps": {
            "format": "int64",
            "type": "integer"
          },
          "MemoryPolicy": {
            "$ref": "#/components/schemas/MemoryPolicy"
          },
          "Model": {
            "type": "string"
          },
          "ModelContextLength": {
            "format": "int64",
            "type": "integer"
          },
          "ModelPricing": {
            "$ref": "#/components/schemas/ModelPricing"
          },
          "PIIChallengeTimeout": {
            "format": "int64",
            "type": "integer"
          },
          "PreferredModels": {
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "PromptExperimentsEnabled": {
            "type": "boolean"
          },
          "RepeatedSuccessHaltThreshold": {
            "format": "int64",
            "type": "integer"
          },
          "SemanticNamespace": {
            "type": "string"
          },
          "StepTimeout": {
            "format": "int64",
            "type": "integer"
          },
          "ToolContextLimit": {
            "format": "int64",
            "type": "integer"
          },
          "ToolRepairEnabled": {
            "type": "boolean"
          },
          "ToolRepairMaxAttempts": {
            "format": "int64",
            "type": "integer"
          },
          "ToolRepairTimeout": {
            "format": "int64",
            "type": "integer"
          },
          "ToolRoutingEnabled": {
            "type": "boolean"
          },
          "ToolRoutingThreshold": {
            "format": "double",
            "type": "number"
          },
          "ToolSearchEnabled": {
            "type": "boolean"
          },
          "ToolSearchSemanticEnabled": {
            "type": "boolean"
          },
          "ToolSelectionMinConfidence": {
            "format": "double",
            "type": "number"
          },
          "ToolSelectionMode": {
            "type": "string"
          },
          "ToolSelectionRequireRoute": {
            "type": "boolean"
          },
          "ToolSelectionTopK": {
            "format": "int64",
            "type": "integer"
          },
          "TotalTimeout": {
            "format": "int64",
            "type": "integer"
          },
          "TraceRetentionSteps": {
            "format": "int64",
            "type": "integer"
          },
          "context_budget_enabled": {
            "type": "boolean"
          },
          "context_budget_tokens": {
            "format": "int64",
            "type": "integer"
          },
          "context_system_tokens": {
            "format": "int64",
            "type": "integer"
          },
          "metacognitive_policy": {
            "$ref": "#/components/schemas/MetacognitivePolicy"
          },
          "temporal_constraints": {
            "$ref": "#/components/schemas/TemporalConstraints"
          }
        },
        "required": [
          "Model",
          "MaxSteps",
          "StepTimeout",
          "TotalTimeout",
          "RepeatedSuccessHaltThreshold",
          "ContinueAsNewSteps",
          "ContinueAsNewStateBytes",
          "DecisionLogLimit",
          "ApprovalTimeout",
          "PIIChallengeTimeout",
          "ToolRoutingEnabled",
          "ToolRoutingThreshold",
          "ToolSearchEnabled",
          "ToolSearchSemanticEnabled",
          "ToolContextLimit",
          "ToolSelectionMode",
          "ToolSelectionTopK",
          "ToolSelectionMinConfidence",
          "ToolSelectionRequireRoute",
          "LoopEfficiencyGuardDisabled",
          "ToolRepairEnabled",
          "ToolRepairMaxAttempts",
          "ToolRepairTimeout",
          "MemoryPolicy",
          "SemanticNamespace",
          "TraceRetentionSteps",
          "AdaptiveRetryEnabled",
          "CostPolicy",
          "ModelPricing",
          "ModelContextLength",
          "CheapModelPricing",
          "CheapModelContextLength",
          "PreferredModels",
          "PromptExperimentsEnabled"
        ],
        "type": "object"
      },
      "AgentRunResult": {
        "additionalProperties": false,
        "properties": {
          "DecisionLog": {
            "items": {
              "$ref": "#/components/schemas/DecisionRecord"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "State": {
            "$ref": "#/components/schemas/AgentState"
          }
        },
        "required": [
          "State",
          "DecisionLog"
        ],
        "type": "object"
      },
      "AgentState": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/AgentState.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "blocked_tool_hashes": {
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "conversation_history": {
            "items": {
              "$ref": "#/components/schemas/ConversationTurn"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "cost_last_step": {
            "format": "double",
            "type": "number"
          },
          "cost_total": {
            "format": "double",
            "type": "number"
          },
          "goal_met": {
            "type": "boolean"
          },
          "halt": {
            "type": "boolean"
          },
          "last_observation": {
            "$ref": "#/components/schemas/Observation"
          },
          "loop_guard": {
            "$ref": "#/components/schemas/LoopGuardState"
          },
          "memory": {
            "$ref": "#/components/schemas/MemoryState"
          },
          "metacognitive_state": {
            "$ref": "#/components/schemas/MetacognitiveState"
          },
          "model_escalated": {
            "type": "boolean"
          },
          "paused": {
            "type": "boolean"
          },
          "pending_approvals": {
            "items": {
              "$ref": "#/components/schemas/ApprovalRequest"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "pending_questions": {
            "items": {
              "$ref": "#/components/schemas/QuestionRequest"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "pii_holds": {
            "additionalProperties": {
              "$ref": "#/components/schemas/PIIHold"
            },
            "type": "object"
          },
          "pivot_note": {
            "type": "string"
          },
          "quota_remaining": {
            "$ref": "#/components/schemas/QuotaRemaining"
          },
          "reflection_note": {
            "type": "string"
          },
          "run_outcome": {
            "type": "string"
          },
          "run_outcome_reason": {
            "type": "string"
          },
          "step_index": {
            "format": "int64",
            "type": "integer"
          },
          "step_once": {
            "type": "boolean"
          },
          "time_awareness": {
            "$ref": "#/components/schemas/TimeAwareness"
          }
        },
        "required": [
          "step_index",
          "goal_met",
          "halt"
        ],
        "type": "object"
      },
      "AgentSummary": {
        "additionalProperties": false,
        "properties": {
          "avg_trust_score": {
            "description": "Average trust score across capabilities",
            "format": "double",
            "type": "number"
          },
          "capabilities_count": {
            "description": "Number of registered capabilities",
            "format": "int64",
            "type": "integer"
          },
          "last_active": {
            "description": "Most recent delegation timestamp (RFC3339)",
            "type": "string"
          },
          "name": {
            "description": "Agent name",
            "type": "string"
          },
          "total_delegations": {
            "description": "Number of delegations involving this agent as delegate",
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "name",
          "capabilities_count",
          "avg_trust_score",
          "total_delegations"
        ],
        "type": "object"
      },
      "AgentTrustScoreEntry": {
        "additionalProperties": false,
        "properties": {
          "agent_name": {
            "description": "Agent name",
            "type": "string"
          },
          "avg_quality": {
            "description": "Average quality score",
            "format": "double",
            "type": "number"
          },
          "capability": {
            "description": "Capability identifier",
            "type": "string"
          },
          "failure_count": {
            "description": "Number of failed invocations",
            "format": "int64",
            "type": "integer"
          },
          "last_evaluated_at": {
            "description": "Last evaluation timestamp (RFC3339)",
            "type": "string"
          },
          "success_count": {
            "description": "Number of successful invocations",
            "format": "int64",
            "type": "integer"
          },
          "trust_score": {
            "description": "Trust score (0-1)",
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "agent_name",
          "capability",
          "trust_score",
          "success_count",
          "failure_count",
          "avg_quality"
        ],
        "type": "object"
      },
      "AgentVersionEntry": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/AgentVersionEntry.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "changelog": {
            "description": "Version changelog text",
            "type": "string"
          },
          "compatible": {
            "description": "Whether this version is compatible",
            "type": "boolean"
          },
          "created_at": {
            "description": "Version registration timestamp (RFC3339)",
            "type": "string"
          },
          "version": {
            "description": "Semantic version string",
            "type": "string"
          }
        },
        "required": [
          "version",
          "compatible",
          "created_at"
        ],
        "type": "object"
      },
      "AggregateCostOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/AggregateCostOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "from": {
            "description": "Start of time range filter",
            "type": "string"
          },
          "group": {
            "description": "Grouping key used (day or model)",
            "type": "string"
          },
          "items": {
            "additionalProperties": {
              "$ref": "#/components/schemas/CostBucket"
            },
            "description": "Cost buckets keyed by group value",
            "type": "object"
          },
          "to": {
            "description": "End of time range filter",
            "type": "string"
          }
        },
        "required": [
          "group",
          "items"
        ],
        "type": "object"
      },
      "AnswerRunInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/AnswerRunInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "answer": {
            "description": "Answer text",
            "type": "string"
          },
          "request_id": {
            "description": "Question request ID",
            "type": "string"
          },
          "run_id": {
            "type": "string"
          }
        },
        "required": [
          "request_id",
          "answer"
        ],
        "type": "object"
      },
      "ApprovalRequest": {
        "additionalProperties": false,
        "properties": {
          "Args": {},
          "CreatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "ID": {
            "type": "string"
          },
          "Reason": {
            "type": "string"
          },
          "Status": {
            "type": "string"
          },
          "ToolName": {
            "type": "string"
          }
        },
        "required": [
          "ID",
          "ToolName",
          "Args",
          "Reason",
          "CreatedAt",
          "Status"
        ],
        "type": "object"
      },
      "ApproveGraphInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ApproveGraphInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "approved": {
            "description": "Approve or reject",
            "type": "boolean"
          },
          "request_id": {
            "description": "Approval request ID",
            "type": "string"
          },
          "run_id": {
            "description": "Temporal run ID",
            "type": "string"
          }
        },
        "required": [
          "request_id",
          "approved"
        ],
        "type": "object"
      },
      "ApproveRunInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ApproveRunInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "approved": {
            "description": "Approve (true) or reject (false)",
            "type": "boolean"
          },
          "hint": {
            "description": "Optional hint for the agent",
            "type": "string"
          },
          "reason": {
            "description": "Reason for decision",
            "type": "string"
          },
          "request_id": {
            "description": "Approval request ID",
            "type": "string"
          },
          "run_id": {
            "description": "Temporal run ID",
            "type": "string"
          }
        },
        "required": [
          "request_id",
          "approved"
        ],
        "type": "object"
      },
      "AuditArchiveInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/AuditArchiveInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "days": {
            "default": 90,
            "description": "Archive events older than N days",
            "format": "int64",
            "type": "integer"
          },
          "delete": {
            "description": "Delete archived events from database",
            "type": "boolean"
          },
          "dry_run": {
            "description": "Preview without deleting",
            "type": "boolean"
          },
          "s3_key": {
            "description": "S3 key prefix",
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          }
        },
        "required": [
          "days",
          "dry_run",
          "delete"
        ],
        "type": "object"
      },
      "AuditArchiveOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/AuditArchiveOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "deleted_rows": {
            "description": "Number of rows deleted from database",
            "format": "int64",
            "type": "integer"
          },
          "exported_rows": {
            "description": "Number of rows archived",
            "format": "int64",
            "type": "integer"
          },
          "path": {
            "description": "Archive file path on server",
            "type": "string"
          },
          "s3_key": {
            "description": "S3 object key if uploaded",
            "type": "string"
          },
          "size_bytes": {
            "description": "File size in bytes",
            "format": "int64",
            "type": "integer"
          },
          "status": {
            "description": "Operation result",
            "type": "string"
          }
        },
        "required": [
          "status",
          "path",
          "size_bytes",
          "exported_rows"
        ],
        "type": "object"
      },
      "AuditEntry": {
        "additionalProperties": false,
        "properties": {
          "action": {
            "description": "Action performed",
            "type": "string"
          },
          "actor": {
            "description": "Identity that triggered the event",
            "type": "string"
          },
          "created_at": {
            "description": "Event timestamp (RFC3339)",
            "type": "string"
          },
          "details": {
            "additionalProperties": {},
            "description": "Additional structured event data",
            "type": "object"
          },
          "event_type": {
            "description": "Event category (decision, tool_call, approval, etc.)",
            "type": "string"
          },
          "hash": {
            "description": "Hash chain hash for integrity verification",
            "type": "string"
          },
          "id": {
            "description": "Unique audit event identifier",
            "type": "string"
          },
          "pii_redacted": {
            "description": "Whether PII was detected and redacted",
            "type": "boolean"
          },
          "resource": {
            "description": "Resource acted upon",
            "type": "string"
          },
          "run_id": {
            "description": "Associated workflow run ID",
            "type": "string"
          },
          "step_index": {
            "description": "Step index within the run",
            "format": "int64",
            "type": "integer"
          },
          "tenant_id": {
            "description": "Tenant that owns this event",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tenant_id",
          "step_index",
          "event_type",
          "actor",
          "action",
          "resource",
          "pii_redacted",
          "hash",
          "created_at"
        ],
        "type": "object"
      },
      "AutocompleteModelsOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/AutocompleteModelsOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "count": {
            "description": "Number of results",
            "format": "int64",
            "type": "integer"
          },
          "results": {
            "description": "Ranked autocomplete matches",
            "items": {
              "$ref": "#/components/schemas/AutocompleteResult"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "results",
          "count"
        ],
        "type": "object"
      },
      "AutocompleteResult": {
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "similarity": {
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "id",
          "name",
          "provider",
          "similarity"
        ],
        "type": "object"
      },
      "BackpressureEvent": {
        "additionalProperties": false,
        "properties": {
          "action": {
            "format": "int64",
            "type": "integer"
          },
          "reason": {
            "type": "string"
          },
          "step_index": {
            "format": "int64",
            "type": "integer"
          },
          "timestamp": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "step_index",
          "action",
          "reason",
          "timestamp"
        ],
        "type": "object"
      },
      "BackupDumpInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/BackupDumpInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "format": {
            "default": "custom",
            "description": "pg_dump format",
            "enum": [
              "custom",
              "sql"
            ],
            "type": "string"
          },
          "timeout": {
            "default": "10m",
            "description": "Dump timeout",
            "type": "string"
          }
        },
        "required": [
          "format",
          "timeout"
        ],
        "type": "object"
      },
      "BackupDumpOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/BackupDumpOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "duration": {
            "description": "Time taken for the dump",
            "type": "string"
          },
          "format": {
            "description": "Dump format used",
            "type": "string"
          },
          "path": {
            "description": "Output file path (server-side)",
            "type": "string"
          },
          "size_bytes": {
            "description": "File size in bytes",
            "format": "int64",
            "type": "integer"
          },
          "status": {
            "description": "Operation result",
            "type": "string"
          }
        },
        "required": [
          "status",
          "format",
          "size_bytes",
          "duration"
        ],
        "type": "object"
      },
      "BackupRestoreInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/BackupRestoreInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "clean": {
            "description": "Drop objects before restoring",
            "type": "boolean"
          },
          "path": {
            "description": "Path to dump file on server",
            "type": "string"
          },
          "timeout": {
            "default": "10m",
            "type": "string"
          }
        },
        "required": [
          "path",
          "clean",
          "timeout"
        ],
        "type": "object"
      },
      "BackupRestoreOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/BackupRestoreOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "duration": {
            "description": "Time taken for the restore",
            "type": "string"
          },
          "path": {
            "description": "Restored dump file path",
            "type": "string"
          },
          "status": {
            "description": "Operation result",
            "type": "string"
          }
        },
        "required": [
          "status",
          "path",
          "duration"
        ],
        "type": "object"
      },
      "CapabilityEntry": {
        "additionalProperties": false,
        "properties": {
          "agent": {
            "description": "Agent name",
            "type": "string"
          },
          "capability": {
            "description": "Capability identifier",
            "type": "string"
          },
          "description": {
            "description": "Capability description",
            "type": "string"
          },
          "registered_at": {
            "description": "Registration timestamp (RFC3339)",
            "type": "string"
          },
          "test_coverage": {
            "description": "Test coverage score (0 or 1)",
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "agent",
          "capability",
          "description",
          "test_coverage"
        ],
        "type": "object"
      },
      "CapabilityWithScore": {
        "additionalProperties": false,
        "properties": {
          "avg_quality": {
            "description": "Average quality score",
            "format": "double",
            "type": "number"
          },
          "capability": {
            "description": "Capability identifier",
            "type": "string"
          },
          "failure_count": {
            "description": "Number of failed invocations",
            "format": "int64",
            "type": "integer"
          },
          "score": {
            "description": "Trust score (0-1)",
            "format": "double",
            "type": "number"
          },
          "success_count": {
            "description": "Number of successful invocations",
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "capability",
          "score",
          "success_count",
          "failure_count",
          "avg_quality"
        ],
        "type": "object"
      },
      "CausalTrace": {
        "additionalProperties": false,
        "properties": {
          "decision": {
            "$ref": "#/components/schemas/Decision"
          },
          "influences": {
            "items": {
              "$ref": "#/components/schemas/Influence"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "override": {
            "type": "boolean"
          },
          "step_index": {
            "format": "int64",
            "type": "integer"
          },
          "timestamp": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "step_index",
          "timestamp",
          "decision",
          "override",
          "influences"
        ],
        "type": "object"
      },
      "ComponentHealth": {
        "additionalProperties": false,
        "properties": {
          "error": {
            "description": "Error message if component is not healthy",
            "type": "string"
          },
          "latency": {
            "description": "Health check latency",
            "examples": [
              "2ms"
            ],
            "type": "string"
          },
          "status": {
            "description": "Component status: healthy, degraded, or unhealthy",
            "examples": [
              "healthy"
            ],
            "type": "string"
          }
        },
        "required": [
          "status"
        ],
        "type": "object"
      },
      "ComposeToolInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ComposeToolInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "dry_run": {
            "description": "Validate without saving",
            "type": "boolean"
          },
          "input_schema": {
            "additionalProperties": {},
            "description": "JSON Schema for composite input",
            "type": "object"
          },
          "name": {
            "description": "Composite tool name",
            "type": "string"
          },
          "registry_id": {
            "default": "default",
            "type": "string"
          },
          "registry_version": {
            "default": "latest",
            "type": "string"
          },
          "steps": {
            "description": "Pipeline step definitions",
            "items": {
              "additionalProperties": {},
              "type": "object"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "name",
          "description",
          "steps",
          "registry_id",
          "registry_version",
          "dry_run"
        ],
        "type": "object"
      },
      "ComposeToolOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ComposeToolOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "dry_run": {
            "description": "True if validation-only (not persisted)",
            "type": "boolean"
          },
          "name": {
            "description": "Composite tool name",
            "type": "string"
          },
          "step_count": {
            "description": "Number of pipeline steps",
            "format": "int64",
            "type": "integer"
          },
          "valid": {
            "description": "Whether the pipeline validated successfully",
            "type": "boolean"
          },
          "version": {
            "description": "Registry version containing the composite",
            "type": "string"
          }
        },
        "required": [
          "name",
          "version",
          "step_count",
          "valid",
          "dry_run"
        ],
        "type": "object"
      },
      "CompositeToolSpec": {
        "additionalProperties": false,
        "properties": {
          "description": {
            "type": "string"
          },
          "input_schema": {
            "additionalProperties": {},
            "type": "object"
          },
          "name": {
            "type": "string"
          },
          "steps": {
            "items": {
              "additionalProperties": {},
              "type": "object"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "name",
          "description",
          "steps"
        ],
        "type": "object"
      },
      "ControlRunInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ControlRunInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "action": {
            "description": "Control action",
            "enum": [
              "pause",
              "resume",
              "step"
            ],
            "type": "string"
          }
        },
        "required": [
          "action"
        ],
        "type": "object"
      },
      "ConversationTurn": {
        "additionalProperties": false,
        "properties": {
          "assistant": {
            "type": "string"
          },
          "step_index": {
            "format": "int64",
            "type": "integer"
          },
          "user": {
            "type": "string"
          }
        },
        "required": [
          "step_index",
          "assistant",
          "user"
        ],
        "type": "object"
      },
      "CostBucket": {
        "additionalProperties": false,
        "properties": {
          "count": {
            "description": "Number of runs in this bucket",
            "format": "int64",
            "type": "integer"
          },
          "total_cost": {
            "description": "Total cost in USD",
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "count",
          "total_cost"
        ],
        "type": "object"
      },
      "CostPolicy": {
        "additionalProperties": false,
        "properties": {
          "CheapModel": {
            "type": "string"
          },
          "CostPer1KTokens": {
            "format": "double",
            "type": "number"
          },
          "MaxCostPerRun": {
            "format": "double",
            "type": "number"
          },
          "MaxCostPerStep": {
            "format": "double",
            "type": "number"
          },
          "PreferCheaper": {
            "type": "boolean"
          },
          "ToolCostDefault": {
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "MaxCostPerRun",
          "MaxCostPerStep",
          "CostPer1KTokens",
          "ToolCostDefault",
          "PreferCheaper",
          "CheapModel"
        ],
        "type": "object"
      },
      "CreateTenantInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/CreateTenantInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "allowed_models": {
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "allowed_tools": {
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "blocked_tools": {
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "display_name": {
            "type": "string"
          },
          "id": {
            "description": "Unique tenant identifier",
            "type": "string"
          },
          "llm_provider": {
            "description": "Default LLM provider",
            "type": "string"
          },
          "max_concurrent": {
            "description": "Max concurrent runs",
            "format": "int64",
            "type": "integer"
          },
          "max_runs_per_day": {
            "format": "int64",
            "type": "integer"
          },
          "memory_namespace": {
            "type": "string"
          },
          "namespace": {
            "description": "Temporal namespace (defaults to cruvero-{id})",
            "type": "string"
          },
          "rph": {
            "description": "Requests per hour",
            "format": "int64",
            "type": "integer"
          },
          "rpm": {
            "description": "Requests per minute",
            "format": "int64",
            "type": "integer"
          },
          "tpd": {
            "description": "Tokens per day",
            "format": "int64",
            "type": "integer"
          },
          "tph": {
            "description": "Tokens per hour",
            "format": "int64",
            "type": "integer"
          },
          "tpm": {
            "description": "Tokens per minute",
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "display_name"
        ],
        "type": "object"
      },
      "Decision": {
        "additionalProperties": false,
        "properties": {
          "action": {
            "type": "string"
          },
          "args": {},
          "options": {
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "question": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "require_approval": {
            "type": "boolean"
          },
          "tool_name": {
            "type": "string"
          }
        },
        "required": [
          "action"
        ],
        "type": "object"
      },
      "DecisionRecord": {
        "additionalProperties": false,
        "properties": {
          "AgentVersion": {
            "type": "string"
          },
          "CompletionTokens": {
            "format": "int64",
            "type": "integer"
          },
          "CostActual": {
            "format": "double",
            "type": "number"
          },
          "CostEstimate": {
            "format": "double",
            "type": "number"
          },
          "Decision": {
            "$ref": "#/components/schemas/Decision"
          },
          "InputHash": {
            "type": "string"
          },
          "LatencyMs": {
            "format": "int64",
            "type": "integer"
          },
          "ModelConfig": {
            "$ref": "#/components/schemas/AgentConfig"
          },
          "ModelID": {
            "type": "string"
          },
          "ModelVersion": {
            "type": "string"
          },
          "Override": {
            "type": "boolean"
          },
          "PromptHash": {
            "type": "string"
          },
          "PromptTokens": {
            "format": "int64",
            "type": "integer"
          },
          "RepairLog": {
            "items": {
              "$ref": "#/components/schemas/RepairEvent"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "ResponseSimilarity": {
            "format": "double",
            "type": "number"
          },
          "ResponseSummary": {
            "type": "string"
          },
          "RouteConfidence": {
            "format": "double",
            "type": "number"
          },
          "RouteReason": {
            "type": "string"
          },
          "RoutedTool": {
            "type": "string"
          },
          "StateHash": {
            "type": "string"
          },
          "StepIndex": {
            "format": "int64",
            "type": "integer"
          },
          "Timestamp": {
            "format": "date-time",
            "type": "string"
          },
          "TokenEstimate": {
            "format": "int64",
            "type": "integer"
          },
          "TokensUsed": {
            "format": "int64",
            "type": "integer"
          },
          "ToolSchemaHash": {
            "type": "string"
          },
          "TotalTokens": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "StepIndex",
          "Timestamp",
          "InputHash",
          "RoutedTool",
          "RouteConfidence",
          "RouteReason",
          "RepairLog",
          "PromptHash",
          "StateHash",
          "ToolSchemaHash",
          "ModelConfig",
          "Decision",
          "Override",
          "TokensUsed",
          "PromptTokens",
          "CompletionTokens",
          "TotalTokens",
          "LatencyMs",
          "ModelID",
          "ModelVersion",
          "AgentVersion",
          "TokenEstimate",
          "CostEstimate",
          "CostActual",
          "ResponseSummary",
          "ResponseSimilarity"
        ],
        "type": "object"
      },
      "DelegationRecord": {
        "additionalProperties": false,
        "properties": {
          "capability": {
            "type": "string"
          },
          "completed_at": {
            "format": "date-time",
            "type": "string"
          },
          "delegate": {
            "type": "string"
          },
          "delegated_at": {
            "format": "date-time",
            "type": "string"
          },
          "delegator": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "outcome": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "step_index": {
            "format": "int64",
            "type": "integer"
          },
          "supervisor_run_id": {
            "type": "string"
          },
          "trust_score_at_delegation": {
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "id",
          "supervisor_run_id",
          "step_index",
          "delegator",
          "delegate",
          "capability",
          "reason",
          "trust_score_at_delegation",
          "outcome",
          "delegated_at"
        ],
        "type": "object"
      },
      "DiffEntry": {
        "additionalProperties": false,
        "properties": {
          "change_type": {
            "description": "added, removed, modified",
            "type": "string"
          },
          "details": {
            "additionalProperties": {},
            "description": "Detailed diff information",
            "type": "object"
          },
          "step_index": {
            "description": "Step index of the difference",
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "step_index",
          "change_type"
        ],
        "type": "object"
      },
      "DiffProvenanceOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/DiffProvenanceOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "differences": {
            "description": "List of provenance differences",
            "items": {
              "$ref": "#/components/schemas/DiffEntry"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "run_a": {
            "description": "First run ID",
            "type": "string"
          },
          "run_b": {
            "description": "Second run ID",
            "type": "string"
          }
        },
        "required": [
          "run_a",
          "run_b",
          "differences"
        ],
        "type": "object"
      },
      "DiffTestInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/DiffTestInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "max_steps": {
            "default": 6,
            "format": "int64",
            "maximum": 20,
            "minimum": 1,
            "type": "integer"
          },
          "model_a": {
            "description": "First model ID",
            "type": "string"
          },
          "model_b": {
            "description": "Second model ID",
            "type": "string"
          },
          "prompt": {
            "description": "Test prompt",
            "minLength": 1,
            "type": "string"
          },
          "registry_id": {
            "default": "default",
            "type": "string"
          },
          "registry_version": {
            "default": "latest",
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          }
        },
        "required": [
          "prompt",
          "model_a",
          "model_b",
          "registry_id",
          "registry_version",
          "max_steps"
        ],
        "type": "object"
      },
      "DiffTestOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/DiffTestOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "cost_a": {
            "description": "Total cost for model A run",
            "format": "double",
            "type": "number"
          },
          "cost_b": {
            "description": "Total cost for model B run",
            "format": "double",
            "type": "number"
          },
          "model_a": {
            "description": "First model ID",
            "type": "string"
          },
          "model_b": {
            "description": "Second model ID",
            "type": "string"
          },
          "response_a": {
            "description": "Final response from model A",
            "type": "string"
          },
          "response_b": {
            "description": "Final response from model B",
            "type": "string"
          },
          "similarity": {
            "description": "Jaccard similarity score (0-1)",
            "format": "double",
            "type": "number"
          },
          "steps_a": {
            "description": "Number of steps for model A",
            "format": "int64",
            "type": "integer"
          },
          "steps_b": {
            "description": "Number of steps for model B",
            "format": "int64",
            "type": "integer"
          },
          "workflow_a": {
            "description": "Temporal workflow ID for model A",
            "type": "string"
          },
          "workflow_b": {
            "description": "Temporal workflow ID for model B",
            "type": "string"
          }
        },
        "required": [
          "model_a",
          "model_b",
          "workflow_a",
          "workflow_b",
          "response_a",
          "response_b",
          "similarity",
          "cost_a",
          "cost_b",
          "steps_a",
          "steps_b"
        ],
        "type": "object"
      },
      "DisableTenantOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/DisableTenantOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "enabled": {
            "description": "Always false after disable",
            "type": "boolean"
          },
          "status": {
            "description": "Operation result",
            "type": "string"
          },
          "tenant_id": {
            "description": "Disabled tenant ID",
            "type": "string"
          }
        },
        "required": [
          "status",
          "tenant_id",
          "enabled"
        ],
        "type": "object"
      },
      "EditGraphStateInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/EditGraphStateInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "run_id": {
            "description": "Temporal run ID",
            "type": "string"
          },
          "state": {
            "additionalProperties": {},
            "description": "State fields to merge",
            "type": "object"
          }
        },
        "required": [
          "state"
        ],
        "type": "object"
      },
      "EditRunStateInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/EditRunStateInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "state": {
            "additionalProperties": {},
            "description": "State fields to merge",
            "type": "object"
          }
        },
        "required": [
          "state"
        ],
        "type": "object"
      },
      "Episode": {
        "additionalProperties": false,
        "properties": {
          "content": {
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "metadata": {
            "additionalProperties": {},
            "type": "object"
          },
          "run_id": {
            "type": "string"
          },
          "source_tool": {
            "type": "string"
          },
          "step_index": {
            "format": "int64",
            "type": "integer"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "run_id",
          "step_index",
          "type",
          "content",
          "created_at"
        ],
        "type": "object"
      },
      "ErrorDetail": {
        "additionalProperties": false,
        "properties": {
          "location": {
            "description": "Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id'",
            "type": "string"
          },
          "message": {
            "description": "Error message text",
            "type": "string"
          },
          "value": {
            "description": "The value at the given location"
          }
        },
        "type": "object"
      },
      "ErrorModel": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ErrorModel.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "detail": {
            "description": "A human-readable explanation specific to this occurrence of the problem.",
            "examples": [
              "Property foo is required but is missing."
            ],
            "type": "string"
          },
          "errors": {
            "description": "Optional list of individual error details",
            "items": {
              "$ref": "#/components/schemas/ErrorDetail"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "instance": {
            "description": "A URI reference that identifies the specific occurrence of the problem.",
            "examples": [
              "https://example.com/error-log/abc123"
            ],
            "format": "uri",
            "type": "string"
          },
          "status": {
            "description": "HTTP status code",
            "examples": [
              400
            ],
            "format": "int64",
            "type": "integer"
          },
          "title": {
            "description": "A short, human-readable summary of the problem type. This value should not change between occurrences of the error.",
            "examples": [
              "Bad Request"
            ],
            "type": "string"
          },
          "type": {
            "default": "about:blank",
            "description": "A URI reference to human-readable documentation for the error.",
            "examples": [
              "https://example.com/errors/example"
            ],
            "format": "uri",
            "type": "string"
          }
        },
        "type": "object"
      },
      "Event": {
        "additionalProperties": false,
        "properties": {
          "payload": {
            "type": "string"
          },
          "timestamp": {
            "format": "date-time",
            "type": "string"
          },
          "topic": {
            "type": "string"
          }
        },
        "required": [
          "topic",
          "payload",
          "timestamp"
        ],
        "type": "object"
      },
      "ExecuteToolInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ExecuteToolInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "args": {
            "additionalProperties": {},
            "description": "Tool arguments",
            "type": "object"
          },
          "registry_id": {
            "default": "default",
            "type": "string"
          },
          "registry_version": {
            "default": "latest",
            "type": "string"
          },
          "tool_name": {
            "description": "Name of the tool to execute",
            "type": "string"
          }
        },
        "required": [
          "tool_name",
          "args",
          "registry_id",
          "registry_version"
        ],
        "type": "object"
      },
      "ExecuteToolOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ExecuteToolOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "error": {
            "description": "Error message if execution failed",
            "type": "string"
          },
          "latency": {
            "description": "Execution duration",
            "type": "string"
          },
          "result": {
            "description": "Tool execution result"
          }
        },
        "required": [
          "result",
          "latency"
        ],
        "type": "object"
      },
      "Fact": {
        "additionalProperties": false,
        "properties": {
          "content": {
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "embedding": {
            "items": {
              "format": "float",
              "type": "number"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "fact_type": {
            "type": "string"
          },
          "freshness_half_life": {
            "format": "int64",
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "last_retrieved_at": {
            "format": "date-time",
            "type": "string"
          },
          "last_verified_at": {
            "format": "date-time",
            "type": "string"
          },
          "metadata": {
            "additionalProperties": {},
            "type": "object"
          },
          "namespace": {
            "type": "string"
          },
          "retrieval_count": {
            "format": "int64",
            "type": "integer"
          },
          "source_run_id": {
            "type": "string"
          },
          "source_step": {
            "format": "int64",
            "type": "integer"
          },
          "source_tool": {
            "type": "string"
          },
          "source_type": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "namespace",
          "content",
          "created_at"
        ],
        "type": "object"
      },
      "Finding": {
        "additionalProperties": false,
        "properties": {
          "class": {
            "type": "string"
          },
          "confidence": {
            "format": "double",
            "type": "number"
          },
          "detector": {
            "type": "string"
          },
          "end": {
            "format": "int64",
            "type": "integer"
          },
          "path": {
            "type": "string"
          },
          "start": {
            "format": "int64",
            "type": "integer"
          },
          "value": {
            "type": "string"
          }
        },
        "required": [
          "class",
          "start",
          "end",
          "value",
          "confidence",
          "detector"
        ],
        "type": "object"
      },
      "GetAgentTrustScoreOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/GetAgentTrustScoreOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "agent": {
            "type": "string"
          },
          "capability": {
            "type": "string"
          },
          "trust_score": {
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "agent",
          "capability",
          "trust_score"
        ],
        "type": "object"
      },
      "GetAlertsOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/GetAlertsOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "metrics": {
            "description": "Security metrics snapshot"
          },
          "tenant_id": {
            "description": "Tenant filter applied",
            "type": "string"
          }
        },
        "required": [
          "metrics"
        ],
        "type": "object"
      },
      "GetAnomaliesOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/GetAnomaliesOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "anomalies": {
            "description": "Unresolved anomaly records"
          },
          "enabled": {
            "description": "Whether the immune system is configured",
            "type": "boolean"
          },
          "tenant_id": {
            "description": "Tenant queried",
            "type": "string"
          }
        },
        "required": [
          "enabled",
          "tenant_id",
          "anomalies"
        ],
        "type": "object"
      },
      "GetCostOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/GetCostOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "cost_last_step": {
            "description": "Cost of the most recent step",
            "format": "double",
            "type": "number"
          },
          "cost_total": {
            "description": "Cumulative cost across all steps",
            "format": "double",
            "type": "number"
          },
          "run_id": {
            "description": "Temporal run identifier",
            "type": "string"
          },
          "workflow_id": {
            "description": "Temporal workflow identifier",
            "type": "string"
          }
        },
        "required": [
          "workflow_id",
          "run_id",
          "cost_total",
          "cost_last_step"
        ],
        "type": "object"
      },
      "GetDecisionsOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/GetDecisionsOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "decisions": {
            "items": {
              "$ref": "#/components/schemas/DecisionRecord"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "decisions"
        ],
        "type": "object"
      },
      "GetGraphOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/GetGraphOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "state": {
            "additionalProperties": {},
            "description": "Current graph state map",
            "type": "object"
          },
          "workflow_id": {
            "description": "Temporal workflow identifier",
            "type": "string"
          }
        },
        "required": [
          "workflow_id",
          "state"
        ],
        "type": "object"
      },
      "GetPreferencesOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/GetPreferencesOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "models": {
            "description": "Ordered list of preferred model IDs",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "namespace": {
            "description": "Preference namespace",
            "type": "string"
          }
        },
        "required": [
          "namespace",
          "models"
        ],
        "type": "object"
      },
      "GetQuarantineOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/GetQuarantineOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "enabled": {
            "description": "Whether the immune system is configured",
            "type": "boolean"
          },
          "quarantines": {
            "description": "Quarantined tool records"
          },
          "tenant_id": {
            "description": "Tenant queried",
            "type": "string"
          }
        },
        "required": [
          "enabled",
          "tenant_id",
          "quarantines"
        ],
        "type": "object"
      },
      "GetQuotaOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/GetQuotaOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "enabled": {
            "description": "Whether quota enforcement is active",
            "type": "boolean"
          },
          "status": {
            "description": "Current quota usage and limits"
          },
          "tenant_id": {
            "description": "Tenant ID queried",
            "type": "string"
          }
        },
        "required": [
          "enabled",
          "tenant_id"
        ],
        "type": "object"
      },
      "GetRunOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/GetRunOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "decision_log": {
            "description": "Complete decision log for the run",
            "items": {
              "$ref": "#/components/schemas/DecisionRecord"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "pending_approvals": {
            "description": "Approval requests awaiting human response",
            "items": {
              "$ref": "#/components/schemas/ApprovalRequest"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "pending_questions": {
            "description": "Questions awaiting human response",
            "items": {
              "$ref": "#/components/schemas/QuestionRequest"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "run_id": {
            "description": "Temporal run identifier",
            "type": "string"
          },
          "state": {
            "$ref": "#/components/schemas/AgentState",
            "description": "Current agent state snapshot"
          },
          "status": {
            "description": "Workflow execution status",
            "type": "string"
          },
          "step_count": {
            "description": "Number of completed agent steps",
            "format": "int64",
            "type": "integer"
          },
          "total_cost": {
            "description": "Cumulative cost across all steps",
            "format": "double",
            "type": "number"
          },
          "workflow_id": {
            "description": "Temporal workflow identifier",
            "type": "string"
          }
        },
        "required": [
          "workflow_id",
          "run_id",
          "status",
          "step_count",
          "total_cost",
          "state",
          "decision_log",
          "pending_approvals",
          "pending_questions"
        ],
        "type": "object"
      },
      "GetSupervisorOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/GetSupervisorOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "state": {
            "$ref": "#/components/schemas/SupervisorState",
            "description": "Current supervisor state"
          },
          "workflow_id": {
            "description": "Temporal workflow identifier",
            "type": "string"
          }
        },
        "required": [
          "workflow_id",
          "state"
        ],
        "type": "object"
      },
      "GetTraceOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/GetTraceOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "traces": {
            "items": {
              "$ref": "#/components/schemas/CausalTrace"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "traces"
        ],
        "type": "object"
      },
      "GetTrustOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/GetTrustOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "agent": {
            "description": "Agent name",
            "type": "string"
          },
          "capabilities": {
            "description": "Per-capability trust scores",
            "items": {
              "$ref": "#/components/schemas/CapabilityWithScore"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "overall_score": {
            "description": "Weighted overall trust score",
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "agent",
          "capabilities",
          "overall_score"
        ],
        "type": "object"
      },
      "GraphConfig": {
        "additionalProperties": false,
        "properties": {
          "approval_timeout": {
            "default": "5m",
            "description": "Approval wait timeout",
            "type": "string"
          },
          "step_timeout": {
            "default": "60s",
            "description": "Per-step timeout",
            "type": "string"
          }
        },
        "required": [
          "step_timeout",
          "approval_timeout"
        ],
        "type": "object"
      },
      "GraphNode": {
        "additionalProperties": false,
        "properties": {
          "activity": {
            "description": "Activity name (for step nodes)",
            "type": "string"
          },
          "approval": {
            "description": "Require approval before execution",
            "type": "boolean"
          },
          "branches": {
            "description": "Parallel branches",
            "items": {
              "items": {
                "$ref": "#/components/schemas/GraphNode"
              },
              "type": [
                "array",
                "null"
              ]
            },
            "type": [
              "array",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "join_n": {
            "description": "N for join_type=n",
            "format": "int64",
            "type": "integer"
          },
          "join_type": {
            "description": "Parallel join type",
            "enum": [
              "all",
              "any",
              "n",
              "vote"
            ],
            "type": "string"
          },
          "prompt": {
            "description": "LLM prompt (for llm_mode step nodes)",
            "type": "string"
          },
          "routes": {
            "description": "Route conditions",
            "items": {
              "$ref": "#/components/schemas/GraphRouteCase"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "type": {
            "description": "Node type",
            "enum": [
              "step",
              "parallel",
              "route"
            ],
            "type": "string"
          }
        },
        "required": [
          "id",
          "type",
          "approval"
        ],
        "type": "object"
      },
      "GraphRouteCase": {
        "additionalProperties": false,
        "properties": {
          "condition": {
            "description": "Condition reference name",
            "type": "string"
          },
          "nodes": {
            "description": "Nodes to execute if condition is true",
            "items": {
              "$ref": "#/components/schemas/GraphNode"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "condition",
          "nodes"
        ],
        "type": "object"
      },
      "HealthOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/HealthOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "status": {
            "description": "Always 'ok' when the process is alive",
            "examples": [
              "ok"
            ],
            "type": "string"
          },
          "version": {
            "description": "API server version string",
            "examples": [
              "1.0.0"
            ],
            "type": "string"
          }
        },
        "required": [
          "status",
          "version"
        ],
        "type": "object"
      },
      "Influence": {
        "additionalProperties": false,
        "properties": {
          "hash": {
            "type": "string"
          },
          "input_id": {
            "type": "string"
          },
          "input_type": {
            "type": "string"
          },
          "metadata": {
            "additionalProperties": {},
            "type": "object"
          }
        },
        "required": [
          "input_id",
          "input_type",
          "hash"
        ],
        "type": "object"
      },
      "ListAgentCapabilitiesOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ListAgentCapabilitiesOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "capabilities": {
            "items": {
              "$ref": "#/components/schemas/CapabilityEntry"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "capabilities"
        ],
        "type": "object"
      },
      "ListAgentDelegationsOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ListAgentDelegationsOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "delegations": {
            "items": {
              "$ref": "#/components/schemas/DelegationRecord"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "delegations"
        ],
        "type": "object"
      },
      "ListAgentTrustScoresOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ListAgentTrustScoresOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "scores": {
            "items": {
              "$ref": "#/components/schemas/AgentTrustScoreEntry"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "scores"
        ],
        "type": "object"
      },
      "ListAgentsOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ListAgentsOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "agents": {
            "items": {
              "$ref": "#/components/schemas/AgentSummary"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "agents"
        ],
        "type": "object"
      },
      "ListCapabilitiesOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ListCapabilitiesOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "capabilities": {
            "items": {
              "$ref": "#/components/schemas/CapabilityEntry"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "capabilities"
        ],
        "type": "object"
      },
      "ListModelsOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ListModelsOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "count": {
            "description": "Total number of models returned",
            "format": "int64",
            "type": "integer"
          },
          "models": {
            "description": "List of model summaries",
            "items": {
              "$ref": "#/components/schemas/ModelSummary"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "models",
          "count"
        ],
        "type": "object"
      },
      "ListRegistriesOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ListRegistriesOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "registries": {
            "items": {
              "$ref": "#/components/schemas/RegistryVersion"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "registries"
        ],
        "type": "object"
      },
      "ListRunsOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ListRunsOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "next_page_token": {
            "description": "Cursor for the next page of results",
            "type": "string"
          },
          "runs": {
            "description": "List of run summaries",
            "items": {
              "$ref": "#/components/schemas/RunSummary"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "runs"
        ],
        "type": "object"
      },
      "ListTenantsOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ListTenantsOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "tenants": {
            "items": {
              "$ref": "#/components/schemas/TenantSummary"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "tenants"
        ],
        "type": "object"
      },
      "ListToolsOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ListToolsOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "next_page_token": {
            "type": "string"
          },
          "tools": {
            "items": {
              "$ref": "#/components/schemas/ToolSummary"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "total": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "tools",
          "total"
        ],
        "type": "object"
      },
      "ListVersionsOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ListVersionsOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "versions": {
            "items": {
              "$ref": "#/components/schemas/AgentVersionEntry"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "versions"
        ],
        "type": "object"
      },
      "LoopGuardState": {
        "additionalProperties": false,
        "properties": {
          "args_hash": {
            "type": "string"
          },
          "fingerprint": {
            "type": "string"
          },
          "success_streak": {
            "format": "int64",
            "type": "integer"
          },
          "tool_name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "MemoryEpisode": {
        "additionalProperties": false,
        "properties": {
          "content": {
            "description": "Episode text content",
            "type": "string"
          },
          "created_at": {
            "description": "Creation timestamp (RFC3339)",
            "type": "string"
          },
          "metadata": {
            "additionalProperties": {},
            "description": "Additional key-value metadata",
            "type": "object"
          },
          "run_id": {
            "description": "Run that produced this episode",
            "type": "string"
          },
          "step_index": {
            "description": "Step index within the run",
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "run_id",
          "step_index",
          "content",
          "created_at"
        ],
        "type": "object"
      },
      "MemoryFact": {
        "additionalProperties": false,
        "properties": {
          "content": {
            "description": "Fact text content",
            "type": "string"
          },
          "created_at": {
            "description": "Creation timestamp (RFC3339)",
            "type": "string"
          },
          "id": {
            "description": "Unique fact identifier",
            "type": "string"
          },
          "namespace": {
            "description": "Memory namespace",
            "type": "string"
          },
          "score": {
            "description": "Similarity score (for semantic queries)",
            "format": "double",
            "type": "number"
          },
          "source_type": {
            "description": "Origin source type",
            "type": "string"
          }
        },
        "required": [
          "id",
          "content",
          "namespace",
          "created_at"
        ],
        "type": "object"
      },
      "MemoryItem": {
        "additionalProperties": false,
        "properties": {
          "content": {
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "content",
          "created_at"
        ],
        "type": "object"
      },
      "MemoryPolicy": {
        "additionalProperties": false,
        "properties": {
          "ConversationWindow": {
            "format": "int64",
            "type": "integer"
          },
          "EpisodicSummarize": {
            "format": "int64",
            "type": "integer"
          },
          "SemanticExtract": {
            "type": "boolean"
          },
          "SemanticExtractEvery": {
            "format": "int64",
            "type": "integer"
          },
          "SemanticTopK": {
            "format": "int64",
            "type": "integer"
          },
          "WorkingMemoryLimit": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "WorkingMemoryLimit",
          "EpisodicSummarize",
          "SemanticExtract",
          "SemanticExtractEvery",
          "ConversationWindow",
          "SemanticTopK"
        ],
        "type": "object"
      },
      "MemoryProc": {
        "additionalProperties": false,
        "properties": {
          "content": {
            "description": "Procedure text content",
            "type": "string"
          },
          "name": {
            "description": "Procedure name",
            "type": "string"
          },
          "updated_at": {
            "description": "Last update timestamp (RFC3339)",
            "type": "string"
          }
        },
        "required": [
          "name",
          "content",
          "updated_at"
        ],
        "type": "object"
      },
      "MemoryState": {
        "additionalProperties": false,
        "properties": {
          "episodic_summary": {
            "type": "string"
          },
          "episodic_summary_step": {
            "format": "int64",
            "type": "integer"
          },
          "procedures": {
            "items": {
              "$ref": "#/components/schemas/Procedure"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "recent_episodes": {
            "items": {
              "$ref": "#/components/schemas/Episode"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "semantic_extract_step": {
            "format": "int64",
            "type": "integer"
          },
          "semantic_facts": {
            "items": {
              "$ref": "#/components/schemas/Fact"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "working": {
            "items": {
              "$ref": "#/components/schemas/MemoryItem"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "Message": {
        "additionalProperties": false,
        "properties": {
          "content": {
            "type": "string"
          },
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "from",
          "to",
          "type",
          "content"
        ],
        "type": "object"
      },
      "MetacognitivePolicy": {
        "additionalProperties": false,
        "properties": {
          "check_interval": {
            "format": "int64",
            "type": "integer"
          },
          "enabled": {
            "type": "boolean"
          },
          "escalation_model": {
            "type": "string"
          },
          "goal_drift_threshold": {
            "format": "double",
            "type": "number"
          },
          "max_entropy_score": {
            "format": "double",
            "type": "number"
          },
          "max_repetition_count": {
            "format": "int64",
            "type": "integer"
          },
          "min_progress_delta": {
            "format": "double",
            "type": "number"
          },
          "reflection_prompt": {
            "type": "string"
          }
        },
        "required": [
          "enabled",
          "check_interval",
          "max_repetition_count",
          "min_progress_delta",
          "max_entropy_score",
          "goal_drift_threshold"
        ],
        "type": "object"
      },
      "MetacognitiveState": {
        "additionalProperties": false,
        "properties": {
          "backpressure_history": {
            "items": {
              "$ref": "#/components/schemas/BackpressureEvent"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "entropy_scores": {
            "items": {
              "format": "double",
              "type": "number"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "goal_similarity_scores": {
            "items": {
              "format": "double",
              "type": "number"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "observation_hashes": {
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "pending_backpressure": {
            "format": "int64",
            "type": "integer"
          },
          "progress_scores": {
            "items": {
              "format": "double",
              "type": "number"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "recent_tool_hashes": {
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "recent_tool_hashes",
          "progress_scores",
          "entropy_scores",
          "goal_similarity_scores",
          "backpressure_history"
        ],
        "type": "object"
      },
      "ModelDetail": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ModelDetail.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "architecture": {
            "description": "Model architecture summary",
            "type": "string"
          },
          "context_length": {
            "description": "Maximum context window in tokens",
            "format": "int64",
            "type": "integer"
          },
          "id": {
            "description": "Model identifier",
            "type": "string"
          },
          "max_output": {
            "description": "Maximum output tokens",
            "format": "int64",
            "type": "integer"
          },
          "name": {
            "description": "Human-readable model name",
            "type": "string"
          },
          "pricing": {
            "$ref": "#/components/schemas/APIPricing",
            "description": "Per-token pricing breakdown"
          },
          "provider": {
            "description": "Model provider",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "provider",
          "context_length",
          "pricing"
        ],
        "type": "object"
      },
      "ModelPricing": {
        "additionalProperties": false,
        "properties": {
          "CompletionPerToken": {
            "format": "double",
            "type": "number"
          },
          "PromptPerToken": {
            "format": "double",
            "type": "number"
          },
          "Request": {
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "PromptPerToken",
          "CompletionPerToken",
          "Request"
        ],
        "type": "object"
      },
      "ModelSummary": {
        "additionalProperties": false,
        "properties": {
          "architecture": {
            "description": "Model architecture summary",
            "type": "string"
          },
          "completion_cost_per_token": {
            "description": "Cost per completion token",
            "format": "double",
            "type": "number"
          },
          "context_length": {
            "description": "Maximum context window in tokens",
            "format": "int64",
            "type": "integer"
          },
          "id": {
            "description": "Model identifier",
            "type": "string"
          },
          "name": {
            "description": "Human-readable model name",
            "type": "string"
          },
          "prompt_cost_per_token": {
            "description": "Cost per prompt token",
            "format": "double",
            "type": "number"
          },
          "provider": {
            "description": "Model provider (openrouter, azure, openai, or google)",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "provider",
          "context_length",
          "prompt_cost_per_token",
          "completion_cost_per_token"
        ],
        "type": "object"
      },
      "Observation": {
        "additionalProperties": false,
        "properties": {
          "Error": {
            "type": "string"
          },
          "Result": {},
          "ToolName": {
            "type": "string"
          }
        },
        "required": [
          "ToolName",
          "Result",
          "Error"
        ],
        "type": "object"
      },
      "OverrideQuotaInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/OverrideQuotaInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "clear": {
            "description": "Clear existing override instead of setting",
            "type": "boolean"
          },
          "expires": {
            "description": "Expiration (Go duration like '30m' or RFC3339 timestamp)",
            "type": "string"
          },
          "field": {
            "description": "Quota field to override",
            "enum": [
              "rpm",
              "rph",
              "tpm",
              "tph",
              "tpd",
              "cost"
            ],
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          },
          "value": {
            "description": "Override value (ignored if clear=true)",
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "field",
          "value",
          "clear"
        ],
        "type": "object"
      },
      "OverrideQuotaOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/OverrideQuotaOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "cleared": {
            "description": "Whether the override was cleared",
            "type": "boolean"
          },
          "expires_at": {
            "description": "Override expiration (RFC3339)",
            "type": "string"
          },
          "field": {
            "description": "Quota field that was overridden",
            "type": "string"
          },
          "status": {
            "description": "Operation result",
            "type": "string"
          },
          "tenant_id": {
            "description": "Tenant ID",
            "type": "string"
          },
          "value": {
            "description": "Override value",
            "format": "double",
            "type": "number"
          }
        },
        "required": [
          "status",
          "tenant_id",
          "field"
        ],
        "type": "object"
      },
      "PIIHold": {
        "additionalProperties": false,
        "properties": {
          "boundary": {
            "type": "string"
          },
          "created_at_step": {
            "format": "int64",
            "type": "integer"
          },
          "expires_at_step": {
            "format": "int64",
            "type": "integer"
          },
          "findings": {
            "items": {
              "$ref": "#/components/schemas/Finding"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "original_text": {
            "type": "string"
          },
          "redacted_text": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "tool_name": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "findings",
          "original_text",
          "redacted_text",
          "boundary",
          "tool_name",
          "created_at_step",
          "expires_at_step",
          "status"
        ],
        "type": "object"
      },
      "Procedure": {
        "additionalProperties": false,
        "properties": {
          "content": {
            "type": "string"
          },
          "metadata": {
            "additionalProperties": {},
            "type": "object"
          },
          "name": {
            "type": "string"
          },
          "source_run_id": {
            "type": "string"
          },
          "source_step": {
            "format": "int64",
            "type": "integer"
          },
          "source_tool": {
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "name",
          "content",
          "updated_at"
        ],
        "type": "object"
      },
      "ProvenanceEdge": {
        "additionalProperties": false,
        "properties": {
          "edge_type": {
            "description": "Edge relationship type",
            "type": "string"
          },
          "source_id": {
            "description": "Source node identifier",
            "type": "string"
          },
          "target_id": {
            "description": "Target node identifier",
            "type": "string"
          }
        },
        "required": [
          "source_id",
          "target_id",
          "edge_type"
        ],
        "type": "object"
      },
      "ProvenanceNode": {
        "additionalProperties": false,
        "properties": {
          "content": {
            "additionalProperties": {},
            "description": "Node content including hash and summary",
            "type": "object"
          },
          "created_at": {
            "description": "Node creation timestamp (RFC3339)",
            "type": "string"
          },
          "id": {
            "description": "Unique node identifier",
            "type": "string"
          },
          "node_type": {
            "description": "Node type (input, decision, output, etc.)",
            "type": "string"
          },
          "run_id": {
            "description": "Workflow run ID",
            "type": "string"
          },
          "step_index": {
            "description": "Step index within the run",
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "run_id",
          "step_index",
          "node_type",
          "created_at"
        ],
        "type": "object"
      },
      "PythonManifestOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/PythonManifestOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "packages": {
            "items": {
              "$ref": "#/components/schemas/PythonPackage"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "packages"
        ],
        "type": "object"
      },
      "PythonPackage": {
        "additionalProperties": false,
        "properties": {
          "available": {
            "description": "Whether the package is installed",
            "type": "boolean"
          },
          "name": {
            "description": "Python package name",
            "type": "string"
          },
          "version": {
            "description": "Installed version string",
            "type": "string"
          }
        },
        "required": [
          "name",
          "available"
        ],
        "type": "object"
      },
      "QueryAuditOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/QueryAuditOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "enabled": {
            "description": "Whether audit logging is configured",
            "type": "boolean"
          },
          "events": {
            "description": "Matching audit events",
            "items": {
              "$ref": "#/components/schemas/AuditEntry"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "enabled",
          "events"
        ],
        "type": "object"
      },
      "QueryMemoryOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/QueryMemoryOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "episodes": {
            "description": "Episodic memory entries",
            "items": {
              "$ref": "#/components/schemas/MemoryEpisode"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "facts": {
            "description": "Semantic memory facts",
            "items": {
              "$ref": "#/components/schemas/MemoryFact"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "procedures": {
            "description": "Procedural memory entries",
            "items": {
              "$ref": "#/components/schemas/MemoryProc"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "type": {
            "description": "Memory type queried",
            "type": "string"
          }
        },
        "required": [
          "type"
        ],
        "type": "object"
      },
      "QueryProvenanceOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/QueryProvenanceOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "edges": {
            "description": "Provenance graph edges",
            "items": {
              "$ref": "#/components/schemas/ProvenanceEdge"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "nodes": {
            "description": "Provenance graph nodes",
            "items": {
              "$ref": "#/components/schemas/ProvenanceNode"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "run_id": {
            "description": "Root run ID for the graph",
            "type": "string"
          }
        },
        "required": [
          "run_id",
          "nodes",
          "edges"
        ],
        "type": "object"
      },
      "QueryTracesOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/QueryTracesOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "traces": {
            "description": "Matching trace entries",
            "items": {
              "$ref": "#/components/schemas/TraceEntry"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "traces"
        ],
        "type": "object"
      },
      "QuestionRequest": {
        "additionalProperties": false,
        "properties": {
          "CreatedAt": {
            "format": "date-time",
            "type": "string"
          },
          "ID": {
            "type": "string"
          },
          "Options": {
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "Prompt": {
            "type": "string"
          },
          "Status": {
            "type": "string"
          }
        },
        "required": [
          "ID",
          "Prompt",
          "Options",
          "CreatedAt",
          "Status"
        ],
        "type": "object"
      },
      "QuotaRemaining": {
        "additionalProperties": false,
        "properties": {
          "cost_usd": {
            "format": "double",
            "type": "number"
          },
          "requests": {
            "format": "int64",
            "type": "integer"
          },
          "tokens": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "requests",
          "tokens",
          "cost_usd"
        ],
        "type": "object"
      },
      "ReadyOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ReadyOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "components": {
            "additionalProperties": {
              "$ref": "#/components/schemas/ComponentHealth"
            },
            "description": "Per-component health status keyed by component name",
            "type": "object"
          },
          "status": {
            "description": "Overall readiness: 'ready' or 'not_ready'",
            "examples": [
              "ready"
            ],
            "type": "string"
          }
        },
        "required": [
          "status",
          "components"
        ],
        "type": "object"
      },
      "RecordFixturesInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/RecordFixturesInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "run_id": {
            "type": "string"
          },
          "workflow_id": {
            "description": "Workflow to record from",
            "type": "string"
          }
        },
        "required": [
          "workflow_id"
        ],
        "type": "object"
      },
      "RecordFixturesOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/RecordFixturesOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "fixture": {
            "description": "Recorded fixture data (decision log snapshot)"
          },
          "step_count": {
            "description": "Number of decision log entries",
            "format": "int64",
            "type": "integer"
          },
          "workflow_id": {
            "description": "Source workflow ID",
            "type": "string"
          }
        },
        "required": [
          "workflow_id",
          "step_count",
          "fixture"
        ],
        "type": "object"
      },
      "RefreshModelsInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/RefreshModelsInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "source": {
            "description": "Provider to refresh from",
            "enum": [
              "openrouter",
              "azure",
              "openai",
              "google"
            ],
            "type": "string"
          }
        },
        "required": [
          "source"
        ],
        "type": "object"
      },
      "RefreshModelsOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/RefreshModelsOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "models_added": {
            "description": "Number of models upserted",
            "format": "int64",
            "type": "integer"
          },
          "source": {
            "description": "Provider that was refreshed",
            "type": "string"
          },
          "status": {
            "description": "Operation result",
            "examples": [
              "ok"
            ],
            "type": "string"
          }
        },
        "required": [
          "source",
          "models_added",
          "status"
        ],
        "type": "object"
      },
      "RefreshRegistryInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/RefreshRegistryInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "force": {
            "description": "Force a new registry version even when toolset is unchanged",
            "type": "boolean"
          },
          "reason": {
            "description": "Operator-provided reason for audit trail",
            "type": "string"
          },
          "registry_id": {
            "default": "default",
            "description": "Registry ID",
            "type": "string"
          },
          "tenant_id": {
            "description": "Tenant ID for scoped refresh",
            "type": "string"
          }
        },
        "required": [
          "registry_id"
        ],
        "type": "object"
      },
      "RefreshRegistryOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/RefreshRegistryOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "changed": {
            "description": "True when a new registry version was created",
            "type": "boolean"
          },
          "hash": {
            "description": "Latest registry hash after refresh",
            "type": "string"
          },
          "previous_hash": {
            "description": "Prior latest hash before refresh",
            "type": "string"
          },
          "previous_version": {
            "description": "Prior latest version before refresh",
            "type": "string"
          },
          "reason": {
            "description": "Refresh reason",
            "type": "string"
          },
          "registry_id": {
            "description": "Registry identifier",
            "type": "string"
          },
          "tool_count": {
            "description": "Tool count in refreshed registry",
            "format": "int64",
            "type": "integer"
          },
          "version": {
            "description": "Latest registry version after refresh",
            "type": "string"
          }
        },
        "required": [
          "changed",
          "registry_id",
          "version",
          "hash",
          "tool_count"
        ],
        "type": "object"
      },
      "RegisterCapabilityInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/RegisterCapabilityInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "agent": {
            "description": "Agent name",
            "type": "string"
          },
          "capability": {
            "description": "Capability identifier",
            "type": "string"
          },
          "description": {
            "description": "What this capability does",
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          },
          "test_coverage": {
            "description": "Test coverage score (0-1)",
            "format": "double",
            "maximum": 1,
            "minimum": 0,
            "type": "number"
          }
        },
        "required": [
          "agent",
          "capability",
          "description",
          "test_coverage"
        ],
        "type": "object"
      },
      "RegistryExportInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/RegistryExportInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "RegistryExportOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/RegistryExportOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "path": {
            "description": "Export file path on server",
            "type": "string"
          },
          "size_bytes": {
            "description": "File size in bytes",
            "format": "int64",
            "type": "integer"
          },
          "status": {
            "description": "Operation result",
            "type": "string"
          }
        },
        "required": [
          "status",
          "path",
          "size_bytes"
        ],
        "type": "object"
      },
      "RegistryVersion": {
        "additionalProperties": false,
        "properties": {
          "created_at": {
            "description": "Creation timestamp in RFC3339 format",
            "type": "string"
          },
          "hash": {
            "description": "Content hash of the registry",
            "type": "string"
          },
          "id": {
            "description": "Registry identifier",
            "type": "string"
          },
          "tool_count": {
            "description": "Number of tools in this version",
            "format": "int64",
            "type": "integer"
          },
          "version": {
            "description": "Version string",
            "type": "string"
          }
        },
        "required": [
          "id",
          "version",
          "hash",
          "tool_count",
          "created_at"
        ],
        "type": "object"
      },
      "ReleaseQuarantineInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ReleaseQuarantineInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "reason": {
            "description": "Reason for release",
            "type": "string"
          },
          "released_by": {
            "description": "Who is releasing (defaults to API user)",
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          },
          "tool_name": {
            "description": "Name of quarantined tool",
            "type": "string"
          }
        },
        "required": [
          "tool_name"
        ],
        "type": "object"
      },
      "ReleaseQuarantineOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ReleaseQuarantineOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "status": {
            "description": "Operation result",
            "type": "string"
          },
          "tenant_id": {
            "description": "Tenant ID",
            "type": "string"
          },
          "tool_name": {
            "description": "Released tool name",
            "type": "string"
          }
        },
        "required": [
          "status",
          "tenant_id",
          "tool_name"
        ],
        "type": "object"
      },
      "RepairEvent": {
        "additionalProperties": false,
        "properties": {
          "Action": {
            "type": "string"
          },
          "Answer": {
            "type": "string"
          },
          "Attempt": {
            "format": "int64",
            "type": "integer"
          },
          "Error": {
            "type": "string"
          },
          "Outcome": {
            "type": "string"
          },
          "Question": {
            "type": "string"
          },
          "Reason": {
            "type": "string"
          },
          "Result": {
            "type": "string"
          },
          "Timestamp": {
            "format": "date-time",
            "type": "string"
          },
          "ToolName": {
            "type": "string"
          }
        },
        "required": [
          "Attempt",
          "Action",
          "ToolName",
          "Reason",
          "Error",
          "Result",
          "Question",
          "Answer",
          "Outcome",
          "Timestamp"
        ],
        "type": "object"
      },
      "ReplayCompareInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ReplayCompareInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "from_step": {
            "default": 0,
            "description": "Step index for comparison baseline",
            "format": "int64",
            "type": "integer"
          },
          "prompt": {
            "description": "Prompt used for replay workflow",
            "type": "string"
          },
          "registry_id": {
            "default": "default",
            "description": "Tool registry ID",
            "type": "string"
          },
          "registry_version": {
            "default": "latest",
            "description": "Tool registry version",
            "type": "string"
          },
          "run_id": {
            "description": "Temporal run ID",
            "type": "string"
          },
          "timeout_seconds": {
            "default": 600,
            "description": "Replay wait timeout",
            "format": "int64",
            "maximum": 3600,
            "minimum": 30,
            "type": "integer"
          },
          "workflow_id": {
            "description": "Workflow ID to replay and compare",
            "type": "string"
          }
        },
        "required": [
          "workflow_id",
          "prompt",
          "registry_id",
          "registry_version",
          "from_step",
          "timeout_seconds"
        ],
        "type": "object"
      },
      "ReplayCompareOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ReplayCompareOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "compared": {
            "description": "True if decision logs matched",
            "type": "boolean"
          },
          "comparison_error": {
            "description": "Comparison failure description, if any",
            "type": "string"
          },
          "original_count": {
            "description": "Number of decisions in the original log",
            "format": "int64",
            "type": "integer"
          },
          "replayed_count": {
            "description": "Number of decisions in the replay log",
            "format": "int64",
            "type": "integer"
          },
          "run_id": {
            "description": "Replay run identifier",
            "type": "string"
          },
          "status": {
            "description": "Operation status",
            "type": "string"
          },
          "workflow_id": {
            "description": "Replay workflow identifier",
            "type": "string"
          }
        },
        "required": [
          "status",
          "workflow_id",
          "run_id",
          "compared",
          "original_count",
          "replayed_count"
        ],
        "type": "object"
      },
      "ReplayRunInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ReplayRunInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "decision_overrides": {
            "additionalProperties": {
              "$ref": "#/components/schemas/Decision"
            },
            "description": "Override decisions by step",
            "type": "object"
          },
          "from_step": {
            "default": 0,
            "description": "Step to replay from",
            "format": "int64",
            "type": "integer"
          },
          "registry_version": {
            "description": "Override registry version",
            "type": "string"
          },
          "run_id": {
            "type": "string"
          }
        },
        "required": [
          "from_step"
        ],
        "type": "object"
      },
      "ReplayRunOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ReplayRunOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "original_workflow": {
            "description": "Original workflow ID that was replayed",
            "type": "string"
          },
          "run_id": {
            "description": "New replay run identifier",
            "type": "string"
          },
          "status": {
            "description": "Acceptance status",
            "examples": [
              "accepted"
            ],
            "type": "string"
          },
          "workflow_id": {
            "description": "New replay workflow identifier",
            "type": "string"
          }
        },
        "required": [
          "workflow_id",
          "run_id",
          "original_workflow",
          "status"
        ],
        "type": "object"
      },
      "ResetQuotaInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ResetQuotaInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          },
          "window": {
            "description": "Window to reset",
            "enum": [
              "minute",
              "hour",
              "day"
            ],
            "type": "string"
          }
        },
        "required": [
          "window"
        ],
        "type": "object"
      },
      "ResetQuotaOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ResetQuotaOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "status": {
            "description": "Operation result",
            "type": "string"
          },
          "tenant_id": {
            "description": "Tenant whose quota was reset",
            "type": "string"
          },
          "window": {
            "description": "Window that was reset",
            "type": "string"
          }
        },
        "required": [
          "status",
          "tenant_id",
          "window"
        ],
        "type": "object"
      },
      "RunSummary": {
        "additionalProperties": false,
        "properties": {
          "description": {
            "description": "LLM-generated run description",
            "type": "string"
          },
          "model": {
            "description": "Model used for run metadata generation",
            "type": "string"
          },
          "run_id": {
            "description": "Temporal run identifier",
            "type": "string"
          },
          "started_at": {
            "description": "Workflow start time in RFC3339 format",
            "type": "string"
          },
          "status": {
            "description": "Workflow execution status",
            "type": "string"
          },
          "tags": {
            "description": "LLM-generated run tags",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "workflow_id": {
            "description": "Temporal workflow identifier",
            "type": "string"
          }
        },
        "required": [
          "workflow_id",
          "run_id",
          "status",
          "started_at"
        ],
        "type": "object"
      },
      "SeedRegistryInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/SeedRegistryInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "composites": {
            "description": "Optional composite tool definitions to include",
            "items": {
              "$ref": "#/components/schemas/CompositeToolSpec"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "registry_id": {
            "default": "default",
            "description": "Registry ID",
            "type": "string"
          },
          "tenant_id": {
            "description": "Tenant ID for scoped tools",
            "type": "string"
          },
          "version": {
            "description": "Version string (auto-generated if empty)",
            "type": "string"
          }
        },
        "required": [
          "registry_id"
        ],
        "type": "object"
      },
      "SeedRegistryOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/SeedRegistryOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "hash": {
            "description": "Content hash of the new registry",
            "type": "string"
          },
          "registry_id": {
            "description": "Registry identifier",
            "type": "string"
          },
          "tool_count": {
            "description": "Total number of tools seeded",
            "format": "int64",
            "type": "integer"
          },
          "version": {
            "description": "Created version string",
            "type": "string"
          }
        },
        "required": [
          "registry_id",
          "version",
          "hash",
          "tool_count"
        ],
        "type": "object"
      },
      "SetApprovalsInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/SetApprovalsInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "approvals": {
            "additionalProperties": {
              "type": "boolean"
            },
            "description": "Tool name → requires approval",
            "type": "object"
          },
          "registry_id": {
            "default": "default",
            "type": "string"
          },
          "registry_version": {
            "default": "latest",
            "type": "string"
          }
        },
        "required": [
          "registry_id",
          "registry_version",
          "approvals"
        ],
        "type": "object"
      },
      "SetPreferencesInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/SetPreferencesInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "models": {
            "description": "Ordered list of preferred models",
            "items": {
              "type": "string"
            },
            "minItems": 1,
            "type": [
              "array",
              "null"
            ]
          },
          "namespace": {
            "default": "default",
            "description": "Namespace",
            "type": "string"
          }
        },
        "required": [
          "namespace",
          "models"
        ],
        "type": "object"
      },
      "SetPreferencesOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/SetPreferencesOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "models": {
            "description": "Ordered list of preferred model IDs",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "namespace": {
            "description": "Preference namespace",
            "type": "string"
          },
          "status": {
            "description": "Operation result",
            "examples": [
              "ok"
            ],
            "type": "string"
          }
        },
        "required": [
          "status",
          "namespace",
          "models"
        ],
        "type": "object"
      },
      "SetRepairInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/SetRepairInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "policies": {
            "additionalProperties": {
              "$ref": "#/components/schemas/ToolRepairPolicy"
            },
            "description": "Tool name → repair policy",
            "type": "object"
          },
          "registry_id": {
            "default": "default",
            "type": "string"
          },
          "registry_version": {
            "default": "latest",
            "type": "string"
          }
        },
        "required": [
          "registry_id",
          "registry_version",
          "policies"
        ],
        "type": "object"
      },
      "SetVersionInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/SetVersionInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "changelog": {
            "type": "string"
          },
          "compatible": {
            "default": true,
            "type": "boolean"
          },
          "version": {
            "type": "string"
          }
        },
        "required": [
          "version",
          "compatible"
        ],
        "type": "object"
      },
      "SignalSupervisorInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/SignalSupervisorInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "from": {
            "description": "Source agent",
            "type": "string"
          },
          "kind": {
            "description": "Signal type",
            "enum": [
              "message",
              "event"
            ],
            "type": "string"
          },
          "payload": {
            "additionalProperties": {},
            "description": "Signal payload",
            "type": "object"
          },
          "run_id": {
            "description": "Temporal run ID",
            "type": "string"
          },
          "to": {
            "description": "Target agent (for messages)",
            "type": "string"
          },
          "topic": {
            "description": "Event topic (for events)",
            "type": "string"
          }
        },
        "required": [
          "kind"
        ],
        "type": "object"
      },
      "StartGraphInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/StartGraphInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "config": {
            "$ref": "#/components/schemas/GraphConfig",
            "description": "Execution configuration"
          },
          "llm_mode": {
            "description": "Use LLM activity for steps instead of echo",
            "type": "boolean"
          },
          "name": {
            "description": "Graph name",
            "type": "string"
          },
          "nodes": {
            "description": "Graph node definitions",
            "items": {
              "$ref": "#/components/schemas/GraphNode"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "state": {
            "additionalProperties": {},
            "description": "Initial state",
            "type": "object"
          }
        },
        "required": [
          "name",
          "nodes",
          "llm_mode"
        ],
        "type": "object"
      },
      "StartGraphOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/StartGraphOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "node_count": {
            "description": "Number of top-level graph nodes",
            "format": "int64",
            "type": "integer"
          },
          "run_id": {
            "description": "Temporal run identifier",
            "type": "string"
          },
          "status": {
            "description": "Acceptance status",
            "examples": [
              "accepted"
            ],
            "type": "string"
          },
          "workflow_id": {
            "description": "Temporal workflow identifier",
            "type": "string"
          }
        },
        "required": [
          "workflow_id",
          "run_id",
          "node_count",
          "status"
        ],
        "type": "object"
      },
      "StartRunInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/StartRunInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "max_steps": {
            "default": 6,
            "description": "Max agent steps",
            "format": "int64",
            "maximum": 100,
            "minimum": 1,
            "type": "integer"
          },
          "memory_refs": {
            "description": "Memory references to load",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "model": {
            "description": "Model ID override",
            "type": "string"
          },
          "prompt": {
            "description": "The task prompt for the agent",
            "minLength": 1,
            "type": "string"
          },
          "prompt_id": {
            "description": "Optional prompt library identifier for experiment routing",
            "type": "string"
          },
          "provider": {
            "description": "LLM provider",
            "enum": [
              "openrouter",
              "azure",
              "openai",
              "google"
            ],
            "type": "string"
          },
          "registry_id": {
            "default": "default",
            "description": "Tool registry ID",
            "type": "string"
          },
          "registry_version": {
            "default": "latest",
            "description": "Tool registry version",
            "type": "string"
          },
          "repair_attempts": {
            "default": 3,
            "description": "Tool repair max attempts",
            "format": "int64",
            "maximum": 10,
            "minimum": 0,
            "type": "integer"
          },
          "repair_timeout": {
            "default": "1m",
            "description": "Tool repair timeout (Go duration)",
            "type": "string"
          },
          "tool_limit": {
            "default": 20,
            "description": "Max tools in context",
            "format": "int64",
            "maximum": 50,
            "minimum": 1,
            "type": "integer"
          },
          "tool_search": {
            "description": "Enable tool search routing",
            "type": "boolean"
          }
        },
        "required": [
          "prompt",
          "registry_id",
          "registry_version",
          "max_steps",
          "repair_attempts",
          "tool_limit"
        ],
        "type": "object"
      },
      "StartRunOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/StartRunOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "run_id": {
            "description": "Temporal run identifier",
            "type": "string"
          },
          "status": {
            "description": "Acceptance status",
            "examples": [
              "accepted"
            ],
            "type": "string"
          },
          "workflow_id": {
            "description": "Temporal workflow identifier",
            "type": "string"
          }
        },
        "required": [
          "workflow_id",
          "run_id",
          "status"
        ],
        "type": "object"
      },
      "StartSupervisorInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/StartSupervisorInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "agents": {
            "description": "Agent configurations",
            "items": {
              "$ref": "#/components/schemas/SupervisorAgentSpec"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "items": {
            "description": "Work items for map_reduce/broadcast patterns",
            "items": {
              "additionalProperties": {},
              "type": "object"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "model": {
            "description": "Model override for all agents",
            "type": "string"
          },
          "pattern": {
            "description": "Multi-agent orchestration pattern",
            "enum": [
              "delegate",
              "broadcast",
              "debate",
              "pipeline",
              "map_reduce",
              "voting",
              "saga"
            ],
            "type": "string"
          },
          "prompt": {
            "description": "Task prompt",
            "minLength": 1,
            "type": "string"
          },
          "provider": {
            "enum": [
              "openrouter",
              "azure",
              "openai",
              "google"
            ],
            "type": "string"
          },
          "registry_id": {
            "default": "default",
            "type": "string"
          },
          "registry_version": {
            "default": "latest",
            "type": "string"
          },
          "repair_attempts": {
            "default": 3,
            "format": "int64",
            "type": "integer"
          },
          "saga_steps": {
            "description": "Step definitions for saga pattern",
            "items": {
              "$ref": "#/components/schemas/SupervisorSagaStep"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "tenant_id": {
            "type": "string"
          },
          "tool_search": {
            "default": true,
            "type": "boolean"
          }
        },
        "required": [
          "pattern",
          "prompt",
          "agents",
          "registry_id",
          "registry_version",
          "repair_attempts",
          "tool_search"
        ],
        "type": "object"
      },
      "StartSupervisorOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/StartSupervisorOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "agent_count": {
            "description": "Number of agents in the workflow",
            "format": "int64",
            "type": "integer"
          },
          "pattern": {
            "description": "Orchestration pattern used",
            "type": "string"
          },
          "run_id": {
            "description": "Temporal run identifier",
            "type": "string"
          },
          "status": {
            "description": "Acceptance status",
            "examples": [
              "accepted"
            ],
            "type": "string"
          },
          "workflow_id": {
            "description": "Temporal workflow identifier",
            "type": "string"
          }
        },
        "required": [
          "workflow_id",
          "run_id",
          "pattern",
          "agent_count",
          "status"
        ],
        "type": "object"
      },
      "StartWorkerInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/StartWorkerInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "task_queue": {
            "description": "Custom task queue (defaults to standard queue)",
            "type": "string"
          },
          "type": {
            "description": "Worker type",
            "enum": [
              "agent",
              "graph"
            ],
            "type": "string"
          }
        },
        "required": [
          "type"
        ],
        "type": "object"
      },
      "StartWorkerOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/StartWorkerOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "mode": {
            "description": "Execution mode",
            "examples": [
              "subprocess"
            ],
            "type": "string"
          },
          "note": {
            "description": "Informational note about this worker",
            "type": "string"
          },
          "status": {
            "description": "Worker status",
            "examples": [
              "started"
            ],
            "type": "string"
          },
          "task_queue": {
            "description": "Temporal task queue",
            "type": "string"
          },
          "type": {
            "description": "Worker type (agent or graph)",
            "type": "string"
          },
          "worker_id": {
            "description": "Unique identifier for the managed worker",
            "type": "string"
          }
        },
        "required": [
          "worker_id",
          "type",
          "task_queue",
          "status",
          "mode"
        ],
        "type": "object"
      },
      "StatusResponse": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/StatusResponse.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "status": {
            "examples": [
              "ok"
            ],
            "type": "string"
          }
        },
        "required": [
          "status"
        ],
        "type": "object"
      },
      "StopWorkerInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/StopWorkerInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "timeout": {
            "default": "10s",
            "type": "string"
          },
          "worker_id": {
            "type": "string"
          }
        },
        "required": [
          "worker_id"
        ],
        "type": "object"
      },
      "StopWorkerOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/StopWorkerOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "status": {
            "description": "Operation result",
            "type": "string"
          },
          "worker_id": {
            "description": "Stopped worker ID",
            "type": "string"
          }
        },
        "required": [
          "status",
          "worker_id"
        ],
        "type": "object"
      },
      "SupervisorAgentSpec": {
        "additionalProperties": false,
        "properties": {
          "model": {
            "description": "Model override for this agent",
            "type": "string"
          },
          "name": {
            "description": "Agent name",
            "type": "string"
          },
          "prompt": {
            "description": "Agent-specific prompt",
            "type": "string"
          },
          "role": {
            "description": "Agent role (e.g., judge, reducer)",
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "type": "object"
      },
      "SupervisorSagaStep": {
        "additionalProperties": false,
        "properties": {
          "action": {
            "type": "string"
          },
          "compensation": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "action",
          "compensation"
        ],
        "type": "object"
      },
      "SupervisorState": {
        "additionalProperties": false,
        "properties": {
          "events": {
            "items": {
              "$ref": "#/components/schemas/Event"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "messages": {
            "items": {
              "$ref": "#/components/schemas/Message"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "pattern": {
            "type": "string"
          },
          "results": {
            "additionalProperties": {
              "$ref": "#/components/schemas/AgentRunResult"
            },
            "type": "object"
          },
          "run_id": {
            "type": "string"
          },
          "started_at": {
            "format": "date-time",
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "run_id",
          "pattern",
          "started_at",
          "results",
          "status"
        ],
        "type": "object"
      },
      "TemporalConstraints": {
        "additionalProperties": false,
        "properties": {
          "deadline_action": {
            "type": "string"
          },
          "fast_model": {
            "type": "string"
          },
          "hard_deadline": {
            "format": "date-time",
            "type": "string"
          },
          "soft_deadline": {
            "format": "date-time",
            "type": "string"
          }
        },
        "type": "object"
      },
      "TenantDetail": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/TenantDetail.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "allowed_models": {
            "description": "Allowed model IDs",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "allowed_tools": {
            "description": "Allowed tool names",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "blocked_tools": {
            "description": "Blocked tool names",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "created_at": {
            "description": "Creation timestamp (RFC3339)",
            "type": "string"
          },
          "display_name": {
            "description": "Human-readable tenant name",
            "type": "string"
          },
          "enabled": {
            "description": "Whether the tenant is active",
            "type": "boolean"
          },
          "id": {
            "description": "Unique tenant identifier",
            "type": "string"
          },
          "llm_provider": {
            "description": "Default LLM provider",
            "type": "string"
          },
          "max_concurrent": {
            "description": "Maximum concurrent runs",
            "format": "int64",
            "type": "integer"
          },
          "max_runs_per_day": {
            "description": "Maximum runs per day",
            "format": "int64",
            "type": "integer"
          },
          "memory_namespace": {
            "description": "Memory store namespace",
            "type": "string"
          },
          "namespace": {
            "description": "Temporal namespace",
            "type": "string"
          },
          "rph": {
            "description": "Requests per hour limit",
            "format": "int64",
            "type": "integer"
          },
          "rpm": {
            "description": "Requests per minute limit",
            "format": "int64",
            "type": "integer"
          },
          "tpd": {
            "description": "Tokens per day limit",
            "format": "int64",
            "type": "integer"
          },
          "tph": {
            "description": "Tokens per hour limit",
            "format": "int64",
            "type": "integer"
          },
          "tpm": {
            "description": "Tokens per minute limit",
            "format": "int64",
            "type": "integer"
          },
          "updated_at": {
            "description": "Last update timestamp (RFC3339)",
            "type": "string"
          }
        },
        "required": [
          "id",
          "display_name",
          "namespace",
          "memory_namespace",
          "enabled",
          "max_concurrent",
          "max_runs_per_day",
          "rpm",
          "rph",
          "tpm",
          "tph",
          "tpd",
          "created_at",
          "updated_at"
        ],
        "type": "object"
      },
      "TenantSummary": {
        "additionalProperties": false,
        "properties": {
          "created_at": {
            "description": "Tenant creation timestamp (RFC3339)",
            "type": "string"
          },
          "display_name": {
            "description": "Human-readable tenant name",
            "type": "string"
          },
          "enabled": {
            "description": "Whether the tenant is active",
            "type": "boolean"
          },
          "id": {
            "description": "Unique tenant identifier",
            "type": "string"
          },
          "memory_namespace": {
            "description": "Memory store namespace",
            "type": "string"
          },
          "namespace": {
            "description": "Temporal namespace for this tenant",
            "type": "string"
          }
        },
        "required": [
          "id",
          "display_name",
          "namespace",
          "memory_namespace",
          "enabled",
          "created_at"
        ],
        "type": "object"
      },
      "TimeAwareness": {
        "additionalProperties": false,
        "properties": {
          "current_time": {
            "format": "date-time",
            "type": "string"
          },
          "hard_deadline": {
            "format": "date-time",
            "type": "string"
          },
          "pressure_level": {
            "type": "string"
          },
          "soft_deadline": {
            "format": "date-time",
            "type": "string"
          },
          "time_remaining": {
            "format": "int64",
            "type": "integer"
          },
          "using_fast_model": {
            "type": "boolean"
          }
        },
        "required": [
          "current_time",
          "time_remaining",
          "pressure_level",
          "using_fast_model"
        ],
        "type": "object"
      },
      "ToolRepairPolicy": {
        "additionalProperties": false,
        "properties": {
          "Enabled": {
            "type": "boolean"
          },
          "MaxAttempts": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "Enabled",
          "MaxAttempts"
        ],
        "type": "object"
      },
      "ToolSummary": {
        "additionalProperties": false,
        "properties": {
          "cost_hint": {
            "description": "Estimated cost per call",
            "type": "string"
          },
          "description": {
            "description": "Tool description",
            "type": "string"
          },
          "display_name": {
            "description": "Display alias for UI/LLM prompts",
            "type": "string"
          },
          "name": {
            "description": "Tool name",
            "type": "string"
          },
          "network_policy": {
            "description": "Network access policy (allowed domains/ports)",
            "type": "string"
          },
          "read_only": {
            "description": "True if tool has no side effects",
            "type": "boolean"
          },
          "repair_enabled": {
            "description": "Whether automated repair is enabled",
            "type": "boolean"
          },
          "repair_max": {
            "description": "Maximum repair attempts",
            "format": "int64",
            "type": "integer"
          },
          "requires_approval": {
            "description": "True if human approval is required",
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "description",
          "read_only",
          "requires_approval",
          "repair_enabled",
          "repair_max"
        ],
        "type": "object"
      },
      "TraceEntry": {
        "additionalProperties": false,
        "properties": {
          "created_at": {
            "description": "Trace timestamp (RFC3339)",
            "type": "string"
          },
          "influences": {
            "description": "Causal influence hashes",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "metadata": {
            "additionalProperties": {},
            "description": "Additional trace metadata",
            "type": "object"
          },
          "reasoning": {
            "description": "Decision reasoning text",
            "type": "string"
          },
          "run_id": {
            "description": "Workflow run ID",
            "type": "string"
          },
          "step_index": {
            "description": "Step index within the run",
            "format": "int64",
            "type": "integer"
          },
          "tool_name": {
            "description": "Tool used in this step",
            "type": "string"
          }
        },
        "required": [
          "run_id",
          "step_index",
          "influences",
          "reasoning",
          "created_at"
        ],
        "type": "object"
      },
      "UpdateTenantInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/UpdateTenantInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "allowed_models": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "allowed_tools": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "blocked_tools": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "display_name": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "llm_provider": {
            "type": "string"
          },
          "max_concurrent": {
            "format": "int64",
            "type": "integer"
          },
          "max_runs_per_day": {
            "format": "int64",
            "type": "integer"
          },
          "rph": {
            "format": "int64",
            "type": "integer"
          },
          "rpm": {
            "format": "int64",
            "type": "integer"
          },
          "tpd": {
            "format": "int64",
            "type": "integer"
          },
          "tph": {
            "format": "int64",
            "type": "integer"
          },
          "tpm": {
            "format": "int64",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "UpsertAgentCapabilitiesInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/UpsertAgentCapabilitiesInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "agent_name": {
            "description": "Agent name",
            "type": "string"
          },
          "capabilities": {
            "description": "Capability manifests to register",
            "items": {
              "$ref": "#/components/schemas/AgentCapabilityItem"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "tenant_id": {
            "type": "string"
          }
        },
        "required": [
          "agent_name",
          "capabilities"
        ],
        "type": "object"
      },
      "VaccinateInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/VaccinateInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "procedure": {
            "description": "Vaccination procedure description",
            "type": "string"
          },
          "resolved_by": {
            "description": "Who resolved it",
            "type": "string"
          },
          "signature_hash": {
            "description": "Anomaly signature hash to resolve",
            "type": "string"
          },
          "tenant_id": {
            "type": "string"
          }
        },
        "required": [
          "signature_hash",
          "procedure"
        ],
        "type": "object"
      },
      "VaccinateOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/VaccinateOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "procedure_name": {
            "description": "Name of the stored vaccination procedure",
            "type": "string"
          },
          "signature_hash": {
            "description": "Resolved anomaly signature hash",
            "type": "string"
          },
          "status": {
            "description": "Operation result",
            "type": "string"
          },
          "tenant_id": {
            "description": "Tenant ID",
            "type": "string"
          }
        },
        "required": [
          "status",
          "tenant_id",
          "signature_hash"
        ],
        "type": "object"
      },
      "ValidateBashInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ValidateBashInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "allow_network": {
            "description": "Allow network access commands",
            "type": "boolean"
          },
          "command": {
            "description": "Bash command to validate",
            "type": "string"
          }
        },
        "required": [
          "command",
          "allow_network"
        ],
        "type": "object"
      },
      "ValidateBashOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/ValidateBashOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "allowed": {
            "description": "Whether the command is allowed",
            "type": "boolean"
          },
          "command": {
            "description": "Command that was validated",
            "type": "string"
          },
          "reason": {
            "description": "Why the command was denied",
            "type": "string"
          }
        },
        "required": [
          "command",
          "allowed"
        ],
        "type": "object"
      },
      "VerifyAuditOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/VerifyAuditOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "chain_break": {
            "description": "ID where chain breaks, if invalid",
            "type": "string"
          },
          "enabled": {
            "description": "Whether audit logging is configured",
            "type": "boolean"
          },
          "tenant_id": {
            "description": "Tenant verified",
            "type": "string"
          },
          "valid": {
            "description": "Whether the hash chain is intact",
            "type": "boolean"
          }
        },
        "required": [
          "enabled",
          "tenant_id",
          "valid"
        ],
        "type": "object"
      },
      "WorkerInfo": {
        "additionalProperties": false,
        "properties": {
          "id": {
            "description": "Worker identifier",
            "type": "string"
          },
          "pid": {
            "description": "Operating system process ID",
            "format": "int64",
            "type": "integer"
          },
          "started_at": {
            "description": "Start timestamp (RFC3339)",
            "type": "string"
          },
          "status": {
            "description": "Current worker status",
            "type": "string"
          },
          "task_queue": {
            "description": "Temporal task queue",
            "type": "string"
          },
          "type": {
            "description": "Worker type",
            "type": "string"
          }
        },
        "required": [
          "id",
          "type",
          "task_queue",
          "status",
          "started_at"
        ],
        "type": "object"
      },
      "WorkerStatusOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/WorkerStatusOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "workers": {
            "items": {
              "$ref": "#/components/schemas/WorkerInfo"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "workers"
        ],
        "type": "object"
      },
      "WriteMemoryInputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/WriteMemoryInputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "content": {
            "description": "Memory content",
            "type": "string"
          },
          "metadata": {
            "additionalProperties": {},
            "description": "Additional metadata",
            "type": "object"
          },
          "name": {
            "description": "Procedure name (required for procedural)",
            "type": "string"
          },
          "namespace": {
            "description": "Memory namespace",
            "type": "string"
          },
          "run_id": {
            "description": "Run ID (required for episodic)",
            "type": "string"
          },
          "step_index": {
            "description": "Step index (for episodic)",
            "format": "int64",
            "type": "integer"
          },
          "type": {
            "description": "Memory type to write",
            "enum": [
              "episodic",
              "semantic",
              "procedural"
            ],
            "type": "string"
          }
        },
        "required": [
          "type",
          "content"
        ],
        "type": "object"
      },
      "WriteMemoryOutputBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "examples": [
              "https://example.com/schemas/WriteMemoryOutputBody.json"
            ],
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "id": {
            "description": "Generated ID (semantic only)",
            "type": "string"
          },
          "status": {
            "description": "Operation result",
            "examples": [
              "ok"
            ],
            "type": "string"
          },
          "type": {
            "description": "Memory type written",
            "type": "string"
          }
        },
        "required": [
          "status",
          "type"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "apiKeyAuth": {
        "description": "Static API key header for apikey auth mode.",
        "in": "header",
        "name": "X-API-Key",
        "type": "apiKey"
      },
      "bearerAuth": {
        "bearerFormat": "JWT",
        "description": "JWT bearer token for OIDC-based authentication (keycloak/azuread modes).",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "contact": {
      "name": "Cruvero",
      "url": "https://github.com/cruvero/cruvero-platform"
    },
    "description": "Production REST API for the Cruvero agent runtime. Provides endpoints for managing agent workflow runs, tool registries, multi-agent supervisors, graph workflows, memory, models, cost tracking, tenants, quotas, audit logging, and security. Supports JWT and API key authentication, per-tenant rate limiting, and OpenTelemetry tracing.",
    "license": {
      "name": "BUSL-1.1",
      "url": "https://github.com/cruvero/cruvero-platform/blob/main/LICENSE"
    },
    "title": "Cruvero API",
    "version": "1.0.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/v1/admin/backup/audit-archive": {
      "post": {
        "description": "Archives audit events older than the specified number of days (default 90) to a JSONL file on the server. Optionally uploads to S3 and deletes archived rows from the database. Supports dry_run mode to preview without deletion. Requires admin role.",
        "operationId": "admin-backup-audit-archive",
        "parameters": [
          {
            "description": "Optional admin token for privileged operations",
            "in": "header",
            "name": "X-Cruvero-Admin-Token",
            "schema": {
              "description": "Optional admin token for privileged operations",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuditArchiveInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditArchiveOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Archive old audit events to server-side JSONL and optional S3",
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/backup/dump": {
      "post": {
        "description": "Runs pg_dump to create a database backup in 'custom' or 'sql' format, stored on the server filesystem. The dump path is returned in the response. Requires admin role and a configured PostgreSQL URL.",
        "operationId": "admin-backup-dump",
        "parameters": [
          {
            "description": "Optional admin token for privileged operations",
            "in": "header",
            "name": "X-Cruvero-Admin-Token",
            "schema": {
              "description": "Optional admin token for privileged operations",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BackupDumpInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BackupDumpOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Create a PostgreSQL dump file on the server",
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/backup/registry-export": {
      "post": {
        "description": "Exports all tool registry versions (optionally filtered by tenant) to a JSON file on the server filesystem. Returns the file path and size. Requires admin role.",
        "operationId": "admin-backup-registry-export",
        "parameters": [
          {
            "description": "Optional admin token for privileged operations",
            "in": "header",
            "name": "X-Cruvero-Admin-Token",
            "schema": {
              "description": "Optional admin token for privileged operations",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegistryExportInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistryExportOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Export tool registries to a server-side JSON file",
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/backup/restore": {
      "post": {
        "description": "Runs pg_restore from a server-side dump file path. Optionally drops existing objects before restoring (clean mode). Requires admin role and a configured PostgreSQL URL.",
        "operationId": "admin-backup-restore",
        "parameters": [
          {
            "description": "Optional admin token for privileged operations",
            "in": "header",
            "name": "X-Cruvero-Admin-Token",
            "schema": {
              "description": "Optional admin token for privileged operations",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BackupRestoreInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BackupRestoreOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Restore PostgreSQL from a server-side dump path",
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/fixtures/record": {
      "post": {
        "description": "Queries a completed workflow's decision log and creates a fixture map keyed by input hash. Useful for creating deterministic test fixtures from real agent runs. Requires admin role.",
        "operationId": "admin-fixtures-record",
        "parameters": [
          {
            "description": "Optional admin token for privileged operations",
            "in": "header",
            "name": "X-Cruvero-Admin-Token",
            "schema": {
              "description": "Optional admin token for privileged operations",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RecordFixturesInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordFixturesOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Record fixture snapshot from workflow decision log",
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/python-manifest": {
      "get": {
        "description": "Probes the server's Python environment to report which standard scientific packages (numpy, pandas, sympy, scipy, etc.) are available and their versions. Requires admin role.",
        "operationId": "admin-python-manifest",
        "parameters": [
          {
            "description": "Optional admin token for privileged operations",
            "in": "header",
            "name": "X-Cruvero-Admin-Token",
            "schema": {
              "description": "Optional admin token for privileged operations",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PythonManifestOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Inspect available Python package manifest on server",
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/validate-bash": {
      "post": {
        "description": "Checks whether a bash command would be allowed by the bash execution tool's security allowlist. Returns allowed=true/false with a denial reason if blocked. Requires admin role.",
        "operationId": "admin-validate-bash",
        "parameters": [
          {
            "description": "Optional admin token for privileged operations",
            "in": "header",
            "name": "X-Cruvero-Admin-Token",
            "schema": {
              "description": "Optional admin token for privileged operations",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ValidateBashInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidateBashOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Validate bash command against allowlist",
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/workers/start": {
      "post": {
        "description": "Starts a Temporal worker as a subprocess managed by the API server. Intended for development and testing only; production workers should be managed by Kubernetes or similar orchestration. Supports 'agent' and 'graph' worker types. Requires admin role.",
        "operationId": "admin-workers-start",
        "parameters": [
          {
            "description": "Optional admin token for privileged operations",
            "in": "header",
            "name": "X-Cruvero-Admin-Token",
            "schema": {
              "description": "Optional admin token for privileged operations",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartWorkerInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StartWorkerOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Start an in-process development worker subprocess",
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/workers/status": {
      "get": {
        "description": "Returns the status of all worker subprocesses started via the admin API, including PID, type, task queue, and start time. Workers that have exited are automatically cleaned up. Requires admin role.",
        "operationId": "admin-workers-status",
        "parameters": [
          {
            "description": "Optional admin token for privileged operations",
            "in": "header",
            "name": "X-Cruvero-Admin-Token",
            "schema": {
              "description": "Optional admin token for privileged operations",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkerStatusOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "List tracked worker subprocesses",
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/admin/workers/stop": {
      "post": {
        "description": "Sends SIGTERM to a tracked worker subprocess and waits up to the specified timeout (default 10s) before sending SIGKILL. Removes the worker from the tracking registry. Requires admin role.",
        "operationId": "admin-workers-stop",
        "parameters": [
          {
            "description": "Optional admin token for privileged operations",
            "in": "header",
            "name": "X-Cruvero-Admin-Token",
            "schema": {
              "description": "Optional admin token for privileged operations",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StopWorkerInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StopWorkerOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Stop a tracked worker subprocess",
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/agent-versions": {
      "get": {
        "description": "Lists all registered agent version metadata entries, including version string, changelog, compatibility status, and creation time. Requires admin role.",
        "operationId": "agent-versions-list",
        "parameters": [
          {
            "description": "Optional admin token for privileged operations",
            "in": "header",
            "name": "X-Cruvero-Admin-Token",
            "schema": {
              "description": "Optional admin token for privileged operations",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListVersionsOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "List agent versions",
        "tags": [
          "admin"
        ]
      },
      "put": {
        "description": "Creates or updates an agent version metadata entry with version string, optional changelog, and compatibility flag. Requires admin role.",
        "operationId": "agent-versions-set",
        "parameters": [
          {
            "description": "Optional admin token for privileged operations",
            "in": "header",
            "name": "X-Cruvero-Admin-Token",
            "schema": {
              "description": "Optional admin token for privileged operations",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetVersionInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentVersionEntry"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Set or update agent version metadata",
        "tags": [
          "admin"
        ]
      }
    },
    "/v1/agents": {
      "get": {
        "description": "Returns per-agent summary metrics including capability count, average trust score, delegation volume, and last active timestamp.",
        "operationId": "agents-list",
        "parameters": [
          {
            "description": "Filter by tenant",
            "explode": false,
            "in": "query",
            "name": "tenant_id",
            "schema": {
              "description": "Filter by tenant",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAgentsOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "List agent summaries",
        "tags": [
          "agents"
        ]
      }
    },
    "/v1/agents/capabilities": {
      "get": {
        "description": "Lists registered capabilities, optionally filtered by agent.",
        "operationId": "agents-capabilities-list",
        "parameters": [
          {
            "description": "Filter by agent name",
            "explode": false,
            "in": "query",
            "name": "agent",
            "schema": {
              "description": "Filter by agent name",
              "type": "string"
            }
          },
          {
            "description": "Filter by tenant",
            "explode": false,
            "in": "query",
            "name": "tenant_id",
            "schema": {
              "description": "Filter by tenant",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAgentCapabilitiesOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "List agent capabilities",
        "tags": [
          "agents"
        ]
      },
      "post": {
        "description": "Replaces an agent's capability manifest with the provided capability definitions.",
        "operationId": "agents-capabilities-upsert",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertAgentCapabilitiesInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            },
            "description": "Created"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Register agent capabilities",
        "tags": [
          "agents"
        ]
      }
    },
    "/v1/agents/delegations": {
      "get": {
        "description": "Returns delegation records, optionally filtered by agent or supervisor run ID.",
        "operationId": "agents-delegations-list",
        "parameters": [
          {
            "description": "Filter by delegator/delegate agent name",
            "explode": false,
            "in": "query",
            "name": "agent",
            "schema": {
              "description": "Filter by delegator/delegate agent name",
              "type": "string"
            }
          },
          {
            "description": "Filter by supervisor run ID",
            "explode": false,
            "in": "query",
            "name": "supervisor_run_id",
            "schema": {
              "description": "Filter by supervisor run ID",
              "type": "string"
            }
          },
          {
            "description": "Maximum number of delegations to return",
            "explode": false,
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "description": "Maximum number of delegations to return",
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "Filter by tenant",
            "explode": false,
            "in": "query",
            "name": "tenant_id",
            "schema": {
              "description": "Filter by tenant",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAgentDelegationsOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "List delegation records",
        "tags": [
          "agents"
        ]
      }
    },
    "/v1/agents/trust-scores": {
      "get": {
        "description": "Returns trust score entries, optionally filtered by agent.",
        "operationId": "agents-trust-scores-list",
        "parameters": [
          {
            "description": "Filter by agent name",
            "explode": false,
            "in": "query",
            "name": "agent",
            "schema": {
              "description": "Filter by agent name",
              "type": "string"
            }
          },
          {
            "description": "Filter by tenant",
            "explode": false,
            "in": "query",
            "name": "tenant_id",
            "schema": {
              "description": "Filter by tenant",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAgentTrustScoresOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "List agent trust scores",
        "tags": [
          "agents"
        ]
      }
    },
    "/v1/agents/trust-scores/{agent}/{capability}": {
      "get": {
        "description": "Returns the computed trust score for a specific agent-capability pair.",
        "operationId": "agents-trust-score-get",
        "parameters": [
          {
            "description": "Agent name",
            "in": "path",
            "name": "agent",
            "required": true,
            "schema": {
              "description": "Agent name",
              "type": "string"
            }
          },
          {
            "description": "Capability identifier",
            "in": "path",
            "name": "capability",
            "required": true,
            "schema": {
              "description": "Capability identifier",
              "type": "string"
            }
          },
          {
            "description": "Filter by tenant",
            "explode": false,
            "in": "query",
            "name": "tenant_id",
            "schema": {
              "description": "Filter by tenant",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetAgentTrustScoreOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Get trust score for an agent capability",
        "tags": [
          "agents"
        ]
      }
    },
    "/v1/audit": {
      "get": {
        "description": "Queries the audit event log with optional filtering by tenant, run ID, event type(s), actor prefix, and time range. Each event includes its hash-chain hash for integrity verification. Returns enabled=false if the audit logger is not configured.",
        "operationId": "audit-query",
        "parameters": [
          {
            "description": "Filter by tenant",
            "explode": false,
            "in": "query",
            "name": "tenant_id",
            "schema": {
              "description": "Filter by tenant",
              "type": "string"
            }
          },
          {
            "description": "Filter by run ID",
            "explode": false,
            "in": "query",
            "name": "run_id",
            "schema": {
              "description": "Filter by run ID",
              "type": "string"
            }
          },
          {
            "description": "Filter by event type (decision, tool_call, approval, etc.)",
            "explode": false,
            "in": "query",
            "name": "event_type",
            "schema": {
              "description": "Filter by event type (decision, tool_call, approval, etc.)",
              "type": "string"
            }
          },
          {
            "description": "Comma-separated event types",
            "explode": false,
            "in": "query",
            "name": "event_types",
            "schema": {
              "description": "Comma-separated event types",
              "type": "string"
            }
          },
          {
            "description": "Filter by actor prefix (e.g., 'user:')",
            "explode": false,
            "in": "query",
            "name": "actor_prefix",
            "schema": {
              "description": "Filter by actor prefix (e.g., 'user:')",
              "type": "string"
            }
          },
          {
            "description": "Start time (RFC3339)",
            "explode": false,
            "in": "query",
            "name": "from",
            "schema": {
              "description": "Start time (RFC3339)",
              "type": "string"
            }
          },
          {
            "description": "End time (RFC3339)",
            "explode": false,
            "in": "query",
            "name": "to",
            "schema": {
              "description": "End time (RFC3339)",
              "type": "string"
            }
          },
          {
            "explode": false,
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 200,
              "format": "int64",
              "maximum": 10000,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueryAuditOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Query audit events",
        "tags": [
          "audit"
        ]
      }
    },
    "/v1/audit/export": {
      "get": {
        "description": "Exports audit events in compliance-ready formats: SOC2 and HIPAA produce structured compliance reports, JSON exports raw events, and CSV produces a downloadable spreadsheet. PII inclusion requires admin role. Delivered as a streaming response.",
        "operationId": "audit-export",
        "parameters": [
          {
            "description": "Optional admin token for privileged operations",
            "in": "header",
            "name": "X-Cruvero-Admin-Token",
            "schema": {
              "description": "Optional admin token for privileged operations",
              "type": "string"
            }
          },
          {
            "description": "Export format",
            "explode": false,
            "in": "query",
            "name": "format",
            "required": true,
            "schema": {
              "description": "Export format",
              "enum": [
                "soc2",
                "hipaa",
                "json",
                "csv"
              ],
              "type": "string"
            }
          },
          {
            "description": "Tenant to export",
            "explode": false,
            "in": "query",
            "name": "tenant_id",
            "schema": {
              "description": "Tenant to export",
              "type": "string"
            }
          },
          {
            "description": "Start time (RFC3339)",
            "explode": false,
            "in": "query",
            "name": "from",
            "schema": {
              "description": "Start time (RFC3339)",
              "type": "string"
            }
          },
          {
            "description": "End time (RFC3339)",
            "explode": false,
            "in": "query",
            "name": "to",
            "schema": {
              "description": "End time (RFC3339)",
              "type": "string"
            }
          },
          {
            "description": "Include PII in export (default false)",
            "explode": false,
            "in": "query",
            "name": "include_pii",
            "schema": {
              "description": "Include PII in export (default false)",
              "type": "boolean"
            }
          },
          {
            "explode": false,
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 10000,
              "format": "int64",
              "maximum": 100000,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Export audit events in compliance formats",
        "tags": [
          "audit"
        ]
      }
    },
    "/v1/audit/verify": {
      "get": {
        "description": "Verifies the cryptographic hash chain integrity of audit events for a tenant within an optional time range. Returns valid=true if the chain is unbroken, or the ID of the first event where the chain breaks.",
        "operationId": "audit-verify",
        "parameters": [
          {
            "description": "Tenant to verify",
            "explode": false,
            "in": "query",
            "name": "tenant_id",
            "schema": {
              "description": "Tenant to verify",
              "type": "string"
            }
          },
          {
            "description": "Start time (RFC3339)",
            "explode": false,
            "in": "query",
            "name": "from",
            "schema": {
              "description": "Start time (RFC3339)",
              "type": "string"
            }
          },
          {
            "description": "End time (RFC3339)",
            "explode": false,
            "in": "query",
            "name": "to",
            "schema": {
              "description": "End time (RFC3339)",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyAuditOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Verify audit hash chain integrity",
        "tags": [
          "audit"
        ]
      }
    },
    "/v1/capabilities": {
      "get": {
        "description": "Legacy alias for capabilities listing. Use /v1/agents/capabilities for new integrations. Lists registered agent capabilities from the trust store, optionally filtered by agent name, including description, test coverage score, and registration timestamp.",
        "operationId": "capabilities-list",
        "parameters": [
          {
            "description": "Filter by agent name",
            "explode": false,
            "in": "query",
            "name": "agent",
            "schema": {
              "description": "Filter by agent name",
              "type": "string"
            }
          },
          {
            "description": "Filter by tenant",
            "explode": false,
            "in": "query",
            "name": "tenant_id",
            "schema": {
              "description": "Filter by tenant",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListCapabilitiesOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "List registered agent capabilities",
        "tags": [
          "supervisor"
        ]
      },
      "post": {
        "description": "Legacy alias for capability registration. Use POST /v1/agents/capabilities for new integrations. The test_coverage score (0-1) indicates how well the capability is tested; values \u003e= 0.5 are marked as covered.",
        "operationId": "capabilities-register",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterCapabilityInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Register agent capability",
        "tags": [
          "supervisor"
        ]
      }
    },
    "/v1/cost": {
      "get": {
        "description": "Aggregates cost across all agent workflow executions, grouped by day or model. Supports time range filtering via RFC3339 from/to parameters. Results are cached with a configurable TTL (default 30s, override via CRUVERO_API_COST_CACHE_TTL).",
        "operationId": "cost-aggregate",
        "parameters": [
          {
            "description": "Start date (RFC3339)",
            "explode": false,
            "in": "query",
            "name": "from",
            "schema": {
              "description": "Start date (RFC3339)",
              "type": "string"
            }
          },
          {
            "description": "End date (RFC3339)",
            "explode": false,
            "in": "query",
            "name": "to",
            "schema": {
              "description": "End date (RFC3339)",
              "type": "string"
            }
          },
          {
            "description": "Grouping key",
            "explode": false,
            "in": "query",
            "name": "group",
            "schema": {
              "default": "day",
              "description": "Grouping key",
              "enum": [
                "day",
                "model"
              ],
              "type": "string"
            }
          },
          {
            "description": "Filter by tenant",
            "explode": false,
            "in": "query",
            "name": "tenant_id",
            "schema": {
              "description": "Filter by tenant",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AggregateCostOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Aggregate run cost",
        "tags": [
          "cost"
        ]
      }
    },
    "/v1/diff-test": {
      "post": {
        "description": "Runs the same prompt through two different models as parallel agent workflows and compares the results. Waits synchronously for both workflows to complete (up to 5 minutes), then returns the responses, token-based Jaccard similarity score, cost breakdown, and step counts for each model.",
        "operationId": "diff-test",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DiffTestInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiffTestOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Compare two models on one prompt",
        "tags": [
          "cost"
        ]
      }
    },
    "/v1/graph": {
      "post": {
        "description": "Starts a graph-based workflow on Temporal with the provided node definitions and initial state. Supports step, parallel, and route node types. Route conditions are dynamically registered. Returns HTTP 202 with the workflow IDs.",
        "operationId": "graph-start",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartGraphInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StartGraphOutputBody"
                }
              }
            },
            "description": "Accepted"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Start graph workflow",
        "tags": [
          "graph"
        ]
      }
    },
    "/v1/graph/{id}": {
      "get": {
        "description": "Returns the current state of a graph workflow by querying the Temporal 'graph_state' handler. The state is a free-form map containing all values written by graph steps.",
        "operationId": "graph-get",
        "parameters": [
          {
            "description": "Graph workflow ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "Graph workflow ID",
              "type": "string"
            }
          },
          {
            "description": "Temporal run ID (optional)",
            "explode": false,
            "in": "query",
            "name": "run_id",
            "schema": {
              "description": "Temporal run ID (optional)",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetGraphOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Query graph state",
        "tags": [
          "graph"
        ]
      }
    },
    "/v1/graph/{id}/approve": {
      "post": {
        "description": "Sends an approval or rejection signal to a graph workflow step that requires human approval. The request_id must match a pending approval gate in the graph.",
        "operationId": "graph-approve",
        "parameters": [
          {
            "description": "Graph workflow ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "Graph workflow ID",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApproveGraphInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Approve graph step",
        "tags": [
          "graph"
        ]
      }
    },
    "/v1/graph/{id}/state": {
      "patch": {
        "description": "Merges the provided state fields into the graph workflow's current state via a Temporal signal. Useful for injecting values that route conditions or downstream steps depend on.",
        "operationId": "graph-state-edit",
        "parameters": [
          {
            "description": "Graph workflow ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "Graph workflow ID",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EditGraphStateInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Edit graph state",
        "tags": [
          "graph"
        ]
      }
    },
    "/v1/health": {
      "get": {
        "description": "Returns HTTP 200 with the API version string if the process is alive. This endpoint has no dependencies and never returns an error; it is suitable for Kubernetes liveness probes and load-balancer health checks.",
        "operationId": "health-live",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Liveness probe",
        "tags": [
          "health"
        ]
      }
    },
    "/v1/health/ready": {
      "get": {
        "description": "Checks the health of every backend component (Postgres, Temporal, Qdrant, Dragonfly) and returns per-component status with latency. Returns HTTP 200 when all components are healthy, or HTTP 503 with status 'not_ready' when any component is degraded. Suitable for Kubernetes readiness probes.",
        "operationId": "health-ready",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReadyOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Readiness probe",
        "tags": [
          "health"
        ]
      }
    },
    "/v1/immune/anomalies": {
      "get": {
        "description": "Lists unresolved anomalies detected by the immune system for a tenant. Returns enabled=false if the immunity store is not configured. Results are limited to the specified limit (default 200, max 1000).",
        "operationId": "immune-anomalies",
        "parameters": [
          {
            "description": "Tenant context",
            "explode": false,
            "in": "query",
            "name": "tenant_id",
            "schema": {
              "description": "Tenant context",
              "type": "string"
            }
          },
          {
            "explode": false,
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 200,
              "format": "int64",
              "maximum": 1000,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetAnomaliesOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "List unresolved anomalies",
        "tags": [
          "immune"
        ]
      }
    },
    "/v1/immune/quarantine": {
      "get": {
        "description": "Lists tools currently in quarantine for a tenant. Quarantined tools are blocked from execution until manually released. Returns enabled=false if the immunity store is not configured.",
        "operationId": "immune-quarantine",
        "parameters": [
          {
            "description": "Tenant context",
            "explode": false,
            "in": "query",
            "name": "tenant_id",
            "schema": {
              "description": "Tenant context",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetQuarantineOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "List quarantined tools",
        "tags": [
          "immune"
        ]
      }
    },
    "/v1/immune/release": {
      "post": {
        "description": "Releases a quarantined tool, allowing it to be used in agent workflows again. Requires admin role. The released_by field defaults to the API caller's identity. The action is audit-logged.",
        "operationId": "immune-release",
        "parameters": [
          {
            "description": "Optional admin token for privileged operations",
            "in": "header",
            "name": "X-Cruvero-Admin-Token",
            "schema": {
              "description": "Optional admin token for privileged operations",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReleaseQuarantineInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReleaseQuarantineOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Release a quarantined tool",
        "tags": [
          "immune"
        ]
      }
    },
    "/v1/immune/vaccinate": {
      "post": {
        "description": "Resolves an anomaly by registering a vaccination procedure. The procedure is stored as a procedural memory and the anomaly is marked as resolved. Requires admin role. Returns 404 if the anomaly signature hash is not found. The action is audit-logged.",
        "operationId": "immune-vaccinate",
        "parameters": [
          {
            "description": "Optional admin token for privileged operations",
            "in": "header",
            "name": "X-Cruvero-Admin-Token",
            "schema": {
              "description": "Optional admin token for privileged operations",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VaccinateInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VaccinateOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Resolve anomaly by vaccination",
        "tags": [
          "immune"
        ]
      }
    },
    "/v1/memory": {
      "get": {
        "description": "Queries one of three memory types: 'episodic' retrieves step-level episodes by run ID, 'semantic' performs embedding-based similarity search or lists facts by namespace, and 'procedural' retrieves named procedures or lists all. Semantic queries require an embedding provider to be configured. Results can be filtered by namespace.",
        "operationId": "memory-query",
        "parameters": [
          {
            "description": "Memory type to query",
            "explode": false,
            "in": "query",
            "name": "type",
            "required": true,
            "schema": {
              "description": "Memory type to query",
              "enum": [
                "episodic",
                "semantic",
                "procedural"
              ],
              "type": "string"
            }
          },
          {
            "description": "Filter by run ID (episodic)",
            "explode": false,
            "in": "query",
            "name": "run_id",
            "schema": {
              "description": "Filter by run ID (episodic)",
              "type": "string"
            }
          },
          {
            "description": "Memory namespace",
            "explode": false,
            "in": "query",
            "name": "namespace",
            "schema": {
              "description": "Memory namespace",
              "type": "string"
            }
          },
          {
            "description": "Procedure name (procedural type only)",
            "explode": false,
            "in": "query",
            "name": "name",
            "schema": {
              "description": "Procedure name (procedural type only)",
              "type": "string"
            }
          },
          {
            "description": "Semantic search query (semantic type, uses embedding similarity)",
            "explode": false,
            "in": "query",
            "name": "query",
            "schema": {
              "description": "Semantic search query (semantic type, uses embedding similarity)",
              "type": "string"
            }
          },
          {
            "description": "Number of results for semantic search",
            "explode": false,
            "in": "query",
            "name": "k",
            "schema": {
              "default": 10,
              "description": "Number of results for semantic search",
              "format": "int64",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Max results for episodic/procedural queries",
            "explode": false,
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 100,
              "description": "Max results for episodic/procedural queries",
              "format": "int64",
              "maximum": 1000,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Tenant context",
            "explode": false,
            "in": "query",
            "name": "tenant_id",
            "schema": {
              "description": "Tenant context",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueryMemoryOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Query memory",
        "tags": [
          "memory"
        ]
      },
      "post": {
        "description": "Writes a memory entry of the specified type. Episodic memory requires a run_id, semantic memory generates a unique fact ID, and procedural memory requires a name. The write is audit-logged with the caller's identity and memory type.",
        "operationId": "memory-write",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WriteMemoryInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteMemoryOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Write memory",
        "tags": [
          "memory"
        ]
      }
    },
    "/v1/models": {
      "get": {
        "description": "Lists all models in the catalog with optional filtering by provider (openrouter, azure, openai, google) and name substring search. Results are sorted alphabetically by model name. Includes context length and per-token pricing.",
        "operationId": "models-list",
        "parameters": [
          {
            "description": "Filter by provider (single value or comma-separated list: openrouter,azure,openai,google,anthropic)",
            "explode": false,
            "in": "query",
            "name": "provider",
            "schema": {
              "description": "Filter by provider (single value or comma-separated list: openrouter,azure,openai,google,anthropic)",
              "type": "string"
            }
          },
          {
            "description": "Filter by model name substring",
            "explode": false,
            "in": "query",
            "name": "search",
            "schema": {
              "description": "Filter by model name substring",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListModelsOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "List models",
        "tags": [
          "models"
        ]
      }
    },
    "/v1/models/autocomplete": {
      "get": {
        "description": "Returns up to 10 model matches ranked by pg_trgm similarity. Supports fuzzy matching and prefix search on model name and ID. Requires the CRUVERO_SEARCH_AUTOCOMPLETE_ENABLED feature flag.",
        "operationId": "models-autocomplete",
        "parameters": [
          {
            "description": "Search query for autocomplete",
            "explode": false,
            "in": "query",
            "name": "q",
            "required": true,
            "schema": {
              "description": "Search query for autocomplete",
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AutocompleteModelsOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Autocomplete model search",
        "tags": [
          "models"
        ]
      }
    },
    "/v1/models/preferences": {
      "get": {
        "description": "Returns the ordered list of preferred models for a given namespace (default: 'default'). These preferences influence which model the agent selects when no explicit model is specified.",
        "operationId": "models-preferences-get",
        "parameters": [
          {
            "description": "Namespace for model preferences",
            "explode": false,
            "in": "query",
            "name": "namespace",
            "schema": {
              "default": "default",
              "description": "Namespace for model preferences",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetPreferencesOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Get model preferences",
        "tags": [
          "models"
        ]
      },
      "put": {
        "description": "Sets an ordered list of preferred models for a namespace. Validates that all model IDs exist in the catalog. Requires admin role. The change is audit-logged.",
        "operationId": "models-preferences-set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetPreferencesInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SetPreferencesOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Set model preferences",
        "tags": [
          "models"
        ]
      }
    },
    "/v1/models/refresh": {
      "post": {
        "description": "Fetches the latest model catalog from the specified provider (openrouter, azure, openai, or google) and upserts them into the local model store. Requires admin role. The operation is audit-logged with the count of models added.",
        "operationId": "models-refresh",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RefreshModelsInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RefreshModelsOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Refresh model catalog",
        "tags": [
          "models"
        ]
      }
    },
    "/v1/models/{id}": {
      "get": {
        "description": "Returns full detail for a single model including pricing, context length, architecture, and max output tokens. Returns 404 if the model ID is not found in the catalog.",
        "operationId": "models-get",
        "parameters": [
          {
            "description": "Model ID (e.g., openrouter/anthropic/claude-3.5-sonnet)",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "Model ID (e.g., openrouter/anthropic/claude-3.5-sonnet)",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelDetail"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Get model detail",
        "tags": [
          "models"
        ]
      }
    },
    "/v1/provenance": {
      "get": {
        "description": "Queries the provenance DAG for a run or specific node. Traversal modes: 'ancestors' follows edges backward, 'descendants' follows edges forward, and 'full' returns both directions. The depth parameter limits traversal depth (default 10, max 100). Requires either run_id or node_id.",
        "operationId": "provenance-query",
        "parameters": [
          {
            "description": "Root run ID",
            "explode": false,
            "in": "query",
            "name": "run_id",
            "schema": {
              "description": "Root run ID",
              "type": "string"
            }
          },
          {
            "description": "Specific provenance node ID",
            "explode": false,
            "in": "query",
            "name": "node_id",
            "schema": {
              "description": "Specific provenance node ID",
              "type": "string"
            }
          },
          {
            "description": "Filter by step",
            "explode": false,
            "in": "query",
            "name": "step",
            "schema": {
              "default": -1,
              "description": "Filter by step",
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "Traversal mode",
            "explode": false,
            "in": "query",
            "name": "mode",
            "schema": {
              "default": "full",
              "description": "Traversal mode",
              "enum": [
                "ancestors",
                "descendants",
                "full"
              ],
              "type": "string"
            }
          },
          {
            "description": "Max traversal depth",
            "explode": false,
            "in": "query",
            "name": "depth",
            "schema": {
              "default": 10,
              "description": "Max traversal depth",
              "format": "int64",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Tenant context",
            "explode": false,
            "in": "query",
            "name": "tenant_id",
            "schema": {
              "description": "Tenant context",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueryProvenanceOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Query provenance graph",
        "tags": [
          "provenance"
        ]
      }
    },
    "/v1/provenance/diff": {
      "get": {
        "description": "Compares the provenance graphs of two runs and returns a list of differences. Each difference entry includes the step index, change type (added, removed, or modified), and details about the differing nodes.",
        "operationId": "provenance-diff",
        "parameters": [
          {
            "description": "First run ID",
            "explode": false,
            "in": "query",
            "name": "run_id",
            "required": true,
            "schema": {
              "description": "First run ID",
              "type": "string"
            }
          },
          {
            "description": "Second run ID to compare",
            "explode": false,
            "in": "query",
            "name": "diff_run_id",
            "required": true,
            "schema": {
              "description": "Second run ID to compare",
              "type": "string"
            }
          },
          {
            "description": "Tenant context",
            "explode": false,
            "in": "query",
            "name": "tenant_id",
            "schema": {
              "description": "Tenant context",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiffProvenanceOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Diff provenance between runs",
        "tags": [
          "provenance"
        ]
      }
    },
    "/v1/quota": {
      "get": {
        "description": "Returns the current quota usage and limits for a tenant. If quota enforcement is disabled, returns enabled=false. Otherwise returns the full quota status including current counts and limits for all windows.",
        "operationId": "quota-status",
        "parameters": [
          {
            "description": "Tenant ID (defaults to requesting tenant)",
            "explode": false,
            "in": "query",
            "name": "tenant_id",
            "schema": {
              "description": "Tenant ID (defaults to requesting tenant)",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetQuotaOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Get quota status",
        "tags": [
          "quota"
        ]
      }
    },
    "/v1/quota/override": {
      "post": {
        "description": "Sets or clears a temporary quota override for a specific field (rpm, rph, tpm, tph, tpd, or cost). Overrides can have an optional expiration as a Go duration or RFC3339 timestamp. Set clear=true to remove an existing override. Requires admin role. The action is audit-logged.",
        "operationId": "quota-override",
        "parameters": [
          {
            "description": "Optional admin token for privileged operations",
            "in": "header",
            "name": "X-Cruvero-Admin-Token",
            "schema": {
              "description": "Optional admin token for privileged operations",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OverrideQuotaInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OverrideQuotaOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Set or clear quota override",
        "tags": [
          "quota"
        ]
      }
    },
    "/v1/quota/reset": {
      "post": {
        "description": "Resets the usage counters for a specific quota window (minute, hour, or day) for a tenant. Requires admin role. The reset is audit-logged. Returns 409 if quota enforcement is disabled.",
        "operationId": "quota-reset",
        "parameters": [
          {
            "description": "Optional admin token for privileged operations",
            "in": "header",
            "name": "X-Cruvero-Admin-Token",
            "schema": {
              "description": "Optional admin token for privileged operations",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResetQuotaInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResetQuotaOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Reset quota window",
        "tags": [
          "quota"
        ]
      }
    },
    "/v1/replay-compare": {
      "post": {
        "description": "Replays a workflow synchronously and compares the resulting decision log with the original. Waits up to timeout_seconds (default 600) for the replay to complete, then performs a structural comparison. Returns the match status, step counts, and any comparison error. Useful for regression testing agent behavior.",
        "operationId": "runs-replay-compare",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplayCompareInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReplayCompareOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Replay and compare decision logs",
        "tags": [
          "runs"
        ]
      }
    },
    "/v1/runs": {
      "get": {
        "description": "Lists agent workflow executions from Temporal, sorted by start time descending. Supports filtering by execution status and workflow ID prefix. Results are cursor-paginated with a configurable page size (default 20, max 100).",
        "operationId": "runs-list",
        "parameters": [
          {
            "description": "Filter by execution status",
            "explode": false,
            "in": "query",
            "name": "status",
            "schema": {
              "description": "Filter by execution status",
              "enum": [
                "Running",
                "Completed",
                "Failed",
                "Terminated",
                "Cancelled",
                "ContinuedAsNew"
              ],
              "type": "string"
            }
          },
          {
            "description": "Filter by workflow ID prefix",
            "explode": false,
            "in": "query",
            "name": "search",
            "schema": {
              "description": "Filter by workflow ID prefix",
              "type": "string"
            }
          },
          {
            "description": "Comma-separated metadata tags; filters runs by any matching tag",
            "explode": false,
            "in": "query",
            "name": "tags",
            "schema": {
              "description": "Comma-separated metadata tags; filters runs by any matching tag",
              "type": "string"
            }
          },
          {
            "description": "Items per page",
            "explode": false,
            "in": "query",
            "name": "page_size",
            "schema": {
              "default": 20,
              "description": "Items per page",
              "format": "int64",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Pagination cursor",
            "explode": false,
            "in": "query",
            "name": "page_token",
            "schema": {
              "description": "Pagination cursor",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListRunsOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "List runs",
        "tags": [
          "runs"
        ]
      },
      "post": {
        "description": "Starts a new agent workflow on Temporal. Resolves the tool registry version (defaulting to 'latest'), configures tool repair, memory refs, and routing, then dispatches the workflow. The operation is audit-logged. Returns HTTP 202 with the Temporal workflow and run IDs.",
        "operationId": "runs-start",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartRunInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StartRunOutputBody"
                }
              }
            },
            "description": "Accepted"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Start agent workflow",
        "tags": [
          "runs"
        ]
      }
    },
    "/v1/runs/{id}": {
      "get": {
        "description": "Returns the full detail for an agent run including current workflow status, agent state, complete decision log, and any pending approval requests or questions. Queries the live Temporal workflow via the 'current_state', 'decision_log', 'pending_approvals', and 'pending_questions' query handlers.",
        "operationId": "runs-get",
        "parameters": [
          {
            "description": "Workflow ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "Workflow ID",
              "type": "string"
            }
          },
          {
            "description": "Temporal run ID (optional)",
            "explode": false,
            "in": "query",
            "name": "run_id",
            "schema": {
              "description": "Temporal run ID (optional)",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetRunOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Get run detail",
        "tags": [
          "runs"
        ]
      }
    },
    "/v1/runs/{id}/answer": {
      "post": {
        "description": "Sends an answer to a workflow that is waiting on a human question gate. The request_id must match a pending QuestionRequest and the answer text is required. The action is audit-logged.",
        "operationId": "runs-answer",
        "parameters": [
          {
            "description": "Workflow ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "Workflow ID",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnswerRunInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Answer pending question",
        "tags": [
          "runs"
        ]
      }
    },
    "/v1/runs/{id}/approve": {
      "post": {
        "description": "Sends an approval or rejection signal to a workflow that is waiting on a human gate. The request_id must match a pending ApprovalRequest. An optional reason and hint can be provided. The action is audit-logged with the caller's identity.",
        "operationId": "runs-approve",
        "parameters": [
          {
            "description": "Workflow ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "Workflow ID",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApproveRunInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Approve or reject pending request",
        "tags": [
          "runs"
        ]
      }
    },
    "/v1/runs/{id}/control": {
      "post": {
        "description": "Sends a control signal to a running workflow. Supported actions: 'pause' halts after the current step, 'resume' continues a paused workflow, 'step' advances exactly one step then re-pauses. Returns 404 if the workflow is not found.",
        "operationId": "runs-control",
        "parameters": [
          {
            "description": "Workflow ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "Workflow ID",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ControlRunInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Control run execution",
        "tags": [
          "runs"
        ]
      }
    },
    "/v1/runs/{id}/cost": {
      "get": {
        "description": "Returns the cumulative cost for a workflow run by querying the current agent state. Includes both the total cost across all steps and the cost of the most recent step. Costs are derived from model pricing and token usage tracked in the workflow.",
        "operationId": "runs-cost",
        "parameters": [
          {
            "description": "Workflow ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "Workflow ID",
              "type": "string"
            }
          },
          {
            "description": "Temporal run ID (optional)",
            "explode": false,
            "in": "query",
            "name": "run_id",
            "schema": {
              "description": "Temporal run ID (optional)",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetCostOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Get run cost breakdown",
        "tags": [
          "runs"
        ]
      }
    },
    "/v1/runs/{id}/decisions": {
      "get": {
        "description": "Retrieves the full decision log from the workflow via the Temporal 'decision_log' query. Each record contains the model ID, token counts, cost, latency, hashes, and the decision itself. Pass step=-1 (default) for all steps, or a specific step index to filter.",
        "operationId": "runs-decisions",
        "parameters": [
          {
            "description": "Workflow ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "Workflow ID",
              "type": "string"
            }
          },
          {
            "description": "Temporal run ID (optional)",
            "explode": false,
            "in": "query",
            "name": "run_id",
            "schema": {
              "description": "Temporal run ID (optional)",
              "type": "string"
            }
          },
          {
            "description": "Filter to specific step (-1 for all)",
            "explode": false,
            "in": "query",
            "name": "step",
            "schema": {
              "default": -1,
              "description": "Filter to specific step (-1 for all)",
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetDecisionsOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Get run decision log",
        "tags": [
          "runs"
        ]
      }
    },
    "/v1/runs/{id}/replay": {
      "post": {
        "description": "Starts a new replay workflow that re-executes from the original run's decision log. The replay inherits the original model config, uses the specified from_step as the baseline, and accepts optional decision overrides and registry version. Returns HTTP 202 with the new workflow IDs.",
        "operationId": "runs-replay",
        "parameters": [
          {
            "description": "Original workflow ID to replay from",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "Original workflow ID to replay from",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReplayRunInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReplayRunOutputBody"
                }
              }
            },
            "description": "Accepted"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Start replay workflow",
        "tags": [
          "runs"
        ]
      }
    },
    "/v1/runs/{id}/state": {
      "get": {
        "description": "Returns the raw AgentState struct from the running or completed workflow by querying the Temporal 'current_state' handler. The response includes step index, cost totals, last observation, pending gates, and all other internal state fields.",
        "operationId": "runs-state-get",
        "parameters": [
          {
            "description": "Workflow ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "Workflow ID",
              "type": "string"
            }
          },
          {
            "description": "Temporal run ID (optional)",
            "explode": false,
            "in": "query",
            "name": "run_id",
            "schema": {
              "description": "Temporal run ID (optional)",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentState"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Get run state",
        "tags": [
          "runs"
        ]
      },
      "patch": {
        "description": "Merges the provided JSON patch into the workflow's current AgentState via the 'edit_state' Temporal signal. Fields in the patch overwrite existing values; unmentioned fields are preserved. The workflow must be running to accept the signal.",
        "operationId": "runs-state-edit",
        "parameters": [
          {
            "description": "Workflow ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "Workflow ID",
              "type": "string"
            }
          },
          {
            "description": "Temporal run ID (optional)",
            "explode": false,
            "in": "query",
            "name": "run_id",
            "schema": {
              "description": "Temporal run ID (optional)",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EditRunStateInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Edit run state",
        "tags": [
          "runs"
        ]
      }
    },
    "/v1/runs/{id}/stream": {
      "get": {
        "description": "Opens a Server-Sent Events (SSE) stream that polls the workflow at a configurable interval (default 2s, range 500ms-10s) and emits JSON snapshots of the run state, decision log, and pending gates. The stream closes automatically when the workflow reaches a terminal state (completed, failed, cancelled, terminated, or timed out).",
        "operationId": "runs-stream",
        "parameters": [
          {
            "description": "Workflow ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "Workflow ID",
              "type": "string"
            }
          },
          {
            "description": "Temporal run ID (optional)",
            "explode": false,
            "in": "query",
            "name": "run_id",
            "schema": {
              "description": "Temporal run ID (optional)",
              "type": "string"
            }
          },
          {
            "description": "Polling interval in milliseconds",
            "explode": false,
            "in": "query",
            "name": "interval_ms",
            "schema": {
              "default": 2000,
              "description": "Polling interval in milliseconds",
              "format": "int64",
              "maximum": 10000,
              "minimum": 500,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Stream run updates",
        "tags": [
          "runs"
        ]
      }
    },
    "/v1/runs/{id}/trace": {
      "get": {
        "description": "Returns the causal trace for a workflow run, showing which inputs and observations influenced each decision. When step is -1, traces for all steps are returned sorted by step index. When a specific step is given, only that step's trace is returned.",
        "operationId": "runs-trace",
        "parameters": [
          {
            "description": "Workflow ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "Workflow ID",
              "type": "string"
            }
          },
          {
            "description": "Temporal run ID (optional)",
            "explode": false,
            "in": "query",
            "name": "run_id",
            "schema": {
              "description": "Temporal run ID (optional)",
              "type": "string"
            }
          },
          {
            "description": "Filter to specific step (-1 for all)",
            "explode": false,
            "in": "query",
            "name": "step",
            "schema": {
              "default": -1,
              "description": "Filter to specific step (-1 for all)",
              "format": "int64",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetTraceOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Get run causal trace",
        "tags": [
          "runs"
        ]
      }
    },
    "/v1/security/alerts": {
      "get": {
        "description": "Returns the current security metrics snapshot from the in-process metrics collector. Optionally filters by tenant ID. Metrics include counts of blocked requests, rate limit violations, and other security-relevant events.",
        "operationId": "security-alerts",
        "parameters": [
          {
            "description": "Filter by tenant",
            "explode": false,
            "in": "query",
            "name": "tenant_id",
            "schema": {
              "description": "Filter by tenant",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetAlertsOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Get security metric snapshot",
        "tags": [
          "security"
        ]
      }
    },
    "/v1/supervisor": {
      "post": {
        "description": "Starts a multi-agent supervisor workflow on Temporal using the specified orchestration pattern (delegate, broadcast, debate, pipeline, map_reduce, voting, or saga). Each agent receives its own config and tool registry reference. The saga pattern requires saga_steps; map_reduce requires items. Returns HTTP 202 with the workflow IDs.",
        "operationId": "supervisor-start",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartSupervisorInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StartSupervisorOutputBody"
                }
              }
            },
            "description": "Accepted"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Start supervisor workflow",
        "tags": [
          "supervisor"
        ]
      }
    },
    "/v1/supervisor/{id}": {
      "get": {
        "description": "Returns the current state of a supervisor workflow. Pass full=true to get the complete state including all agent sub-states (may be large), or full=false (default) for a truncated summary.",
        "operationId": "supervisor-get",
        "parameters": [
          {
            "description": "Supervisor workflow ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "Supervisor workflow ID",
              "type": "string"
            }
          },
          {
            "description": "Return full state (may be large) vs truncated summary",
            "explode": false,
            "in": "query",
            "name": "full",
            "schema": {
              "default": false,
              "description": "Return full state (may be large) vs truncated summary",
              "type": "boolean"
            }
          },
          {
            "description": "Temporal run ID (optional)",
            "explode": false,
            "in": "query",
            "name": "run_id",
            "schema": {
              "description": "Temporal run ID (optional)",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetSupervisorOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Query supervisor state",
        "tags": [
          "supervisor"
        ]
      }
    },
    "/v1/supervisor/{id}/signal": {
      "post": {
        "description": "Sends a signal to a running supervisor workflow. Kind 'message' delivers a directed message to a specific agent (requires 'to' field). Kind 'event' publishes a topic-based event to all agents. The payload is JSON-encoded and forwarded to the workflow.",
        "operationId": "supervisor-signal",
        "parameters": [
          {
            "description": "Supervisor workflow ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "Supervisor workflow ID",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignalSupervisorInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Send supervisor message or event signal",
        "tags": [
          "supervisor"
        ]
      }
    },
    "/v1/tenants": {
      "get": {
        "description": "Lists all tenant configurations. Requires admin role or a valid X-Cruvero-Admin-Token header. Returns tenant ID, display name, namespace, and enabled status for each tenant.",
        "operationId": "tenants-list",
        "parameters": [
          {
            "description": "Optional admin token for privileged operations",
            "in": "header",
            "name": "X-Cruvero-Admin-Token",
            "schema": {
              "description": "Optional admin token for privileged operations",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListTenantsOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "List tenants",
        "tags": [
          "tenants"
        ]
      },
      "post": {
        "description": "Creates a new tenant with the specified configuration. Automatically provisions a Temporal namespace if a Temporal client is available. Validates the tenant config and returns 409 if the tenant ID already exists. Requires admin role. Returns HTTP 201 on success.",
        "operationId": "tenants-create",
        "parameters": [
          {
            "description": "Optional admin token for privileged operations",
            "in": "header",
            "name": "X-Cruvero-Admin-Token",
            "schema": {
              "description": "Optional admin token for privileged operations",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTenantInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantDetail"
                }
              }
            },
            "description": "Created"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Create tenant",
        "tags": [
          "tenants"
        ]
      }
    },
    "/v1/tenants/{id}": {
      "delete": {
        "description": "Soft-disables a tenant by setting its enabled flag to false. The tenant record is preserved but workflows will be rejected. Requires admin role. Returns 404 if the tenant does not exist.",
        "operationId": "tenants-disable",
        "parameters": [
          {
            "description": "Optional admin token for privileged operations",
            "in": "header",
            "name": "X-Cruvero-Admin-Token",
            "schema": {
              "description": "Optional admin token for privileged operations",
              "type": "string"
            }
          },
          {
            "description": "Tenant ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "Tenant ID",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DisableTenantOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Disable tenant",
        "tags": [
          "tenants"
        ]
      },
      "get": {
        "description": "Returns the full tenant configuration including rate limits, quota settings, allowed/blocked models and tools, and timestamps. Requires admin role.",
        "operationId": "tenants-get",
        "parameters": [
          {
            "description": "Optional admin token for privileged operations",
            "in": "header",
            "name": "X-Cruvero-Admin-Token",
            "schema": {
              "description": "Optional admin token for privileged operations",
              "type": "string"
            }
          },
          {
            "description": "Tenant ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "Tenant ID",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantDetail"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Get tenant details",
        "tags": [
          "tenants"
        ]
      },
      "put": {
        "description": "Partially updates a tenant configuration. Only provided fields are modified; omitted fields retain their current values. Validates the updated config and returns 409 on namespace conflicts. Requires admin role.",
        "operationId": "tenants-update",
        "parameters": [
          {
            "description": "Optional admin token for privileged operations",
            "in": "header",
            "name": "X-Cruvero-Admin-Token",
            "schema": {
              "description": "Optional admin token for privileged operations",
              "type": "string"
            }
          },
          {
            "description": "Tenant ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "description": "Tenant ID",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateTenantInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TenantDetail"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Update tenant",
        "tags": [
          "tenants"
        ]
      }
    },
    "/v1/tools": {
      "get": {
        "description": "Lists all tools in a specific registry version with their metadata, approval policies, and repair policies overlaid. Supports filtering by name substring and cursor-based pagination. Resolves 'latest' to the most recent registry version.",
        "operationId": "tools-list",
        "parameters": [
          {
            "description": "Registry ID",
            "explode": false,
            "in": "query",
            "name": "registry_id",
            "schema": {
              "default": "default",
              "description": "Registry ID",
              "type": "string"
            }
          },
          {
            "description": "Registry version (or 'latest')",
            "explode": false,
            "in": "query",
            "name": "registry_version",
            "schema": {
              "default": "latest",
              "description": "Registry version (or 'latest')",
              "type": "string"
            }
          },
          {
            "description": "Filter tools by name substring",
            "explode": false,
            "in": "query",
            "name": "search",
            "schema": {
              "description": "Filter tools by name substring",
              "type": "string"
            }
          },
          {
            "explode": false,
            "in": "query",
            "name": "page_size",
            "schema": {
              "default": 20,
              "format": "int64",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Pagination cursor",
            "explode": false,
            "in": "query",
            "name": "page_token",
            "schema": {
              "description": "Pagination cursor",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListToolsOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "List tools in a registry version",
        "tags": [
          "tools"
        ]
      }
    },
    "/v1/tools/approvals": {
      "post": {
        "description": "Sets the per-tool human approval requirement for a specific registry version. Tools mapped to true will require approval before execution within agent workflows. Requires admin role. The change is audit-logged.",
        "operationId": "tools-approvals-set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetApprovalsInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Set tool approval policies",
        "tags": [
          "tools"
        ]
      }
    },
    "/v1/tools/compose": {
      "post": {
        "description": "Registers a composite tool pipeline that chains multiple existing tools together. Validates step references, arg mappings, and checks for cycles in the composite dependency graph. Supports dry_run mode for validation without persisting. Creates a new registry version containing the composite. Requires admin role.",
        "operationId": "tools-compose",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ComposeToolInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComposeToolOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Register composite tool pipeline",
        "tags": [
          "tools"
        ]
      }
    },
    "/v1/tools/execute": {
      "post": {
        "description": "Executes a single tool with the provided arguments outside of a workflow context. Checks the tool's approval policy first and returns 403 if approval is required. Subject to a configurable execution timeout (default 30s via CRUVERO_API_TOOL_EXEC_TIMEOUT). Intended for testing and debugging.",
        "operationId": "tools-execute",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExecuteToolInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecuteToolOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Execute a tool directly for ad-hoc testing",
        "tags": [
          "tools"
        ]
      }
    },
    "/v1/tools/registries": {
      "get": {
        "description": "Returns the available registry versions for a given registry ID. Currently returns the latest version with its hash, tool count, and creation time.",
        "operationId": "tools-registries-list",
        "parameters": [
          {
            "description": "Registry ID to list versions for",
            "explode": false,
            "in": "query",
            "name": "registry_id",
            "schema": {
              "default": "default",
              "description": "Registry ID to list versions for",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListRegistriesOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "List tool registry versions",
        "tags": [
          "tools"
        ]
      },
      "post": {
        "description": "Creates a new tool registry version populated with all built-in tools, MCP bridge tools, and optionally provided composite tool definitions. Requires admin role. The operation is audit-logged. Auto-generates a version string if not provided.",
        "operationId": "tools-registries-seed",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SeedRegistryInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeedRegistryOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Seed tool registry version",
        "tags": [
          "tools"
        ]
      }
    },
    "/v1/tools/registries/refresh": {
      "post": {
        "description": "Builds the current built-in + MCP tool inventory and writes a new immutable registry version only when the toolset changed (unless force=true). Requires admin role and is audit-logged.",
        "operationId": "tools-registries-refresh",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RefreshRegistryInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RefreshRegistryOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Refresh tool registry version from runtime tool inventory",
        "tags": [
          "tools"
        ]
      }
    },
    "/v1/tools/repair": {
      "post": {
        "description": "Configures the automated repair policy for tools in a specific registry version. Each policy controls whether repair is enabled and the maximum number of repair attempts. Requires admin role. The change is audit-logged.",
        "operationId": "tools-repair-set",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetRepairInputBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Set tool repair policies",
        "tags": [
          "tools"
        ]
      }
    },
    "/v1/traces": {
      "get": {
        "description": "Queries causal traces from the trace store or database. Supports filtering by run_id, step index, tool name, and a 'latest' flag for the most recent trace per run. When a database is available, performs direct SQL queries; otherwise falls back to the trace store interface with required filters.",
        "operationId": "traces-query",
        "parameters": [
          {
            "description": "Filter by run ID",
            "explode": false,
            "in": "query",
            "name": "run_id",
            "schema": {
              "description": "Filter by run ID",
              "type": "string"
            }
          },
          {
            "description": "Filter by step index (-1 for all)",
            "explode": false,
            "in": "query",
            "name": "step",
            "schema": {
              "default": -1,
              "description": "Filter by step index (-1 for all)",
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "Filter by tool name",
            "explode": false,
            "in": "query",
            "name": "tool",
            "schema": {
              "description": "Filter by tool name",
              "type": "string"
            }
          },
          {
            "description": "Return only the latest trace per run",
            "explode": false,
            "in": "query",
            "name": "latest",
            "schema": {
              "description": "Return only the latest trace per run",
              "type": "boolean"
            }
          },
          {
            "description": "Tenant context",
            "explode": false,
            "in": "query",
            "name": "tenant_id",
            "schema": {
              "description": "Tenant context",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueryTracesOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Query traces",
        "tags": [
          "traces"
        ]
      }
    },
    "/v1/trust/{agent}": {
      "get": {
        "description": "Returns the trust profile for a specific agent, including per-capability trust scores, success/failure counts, average quality, and a weighted overall trust score.",
        "operationId": "trust-get",
        "parameters": [
          {
            "description": "Agent name",
            "in": "path",
            "name": "agent",
            "required": true,
            "schema": {
              "description": "Agent name",
              "type": "string"
            }
          },
          {
            "description": "Tenant context",
            "explode": false,
            "in": "query",
            "name": "tenant_id",
            "schema": {
              "description": "Tenant context",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetTrustOutputBody"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorModel"
                }
              }
            },
            "description": "Error"
          }
        },
        "summary": "Get trust scores for an agent",
        "tags": [
          "supervisor"
        ]
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    },
    {
      "apiKeyAuth": []
    }
  ],
  "servers": [
    {
      "description": "Same-origin API host (recommended for deployed docs).",
      "url": "/"
    },
    {
      "description": "Local development server.",
      "url": "http://localhost:8900"
    }
  ],
  "tags": [
    {
      "description": "Liveness and readiness probes.",
      "name": "health"
    },
    {
      "description": "Agent run lifecycle, control, and replay.",
      "name": "runs"
    },
    {
      "description": "Agent capabilities, trust scores, and delegation tracking.",
      "name": "agents"
    },
    {
      "description": "Multi-agent orchestration workflows and signaling.",
      "name": "supervisor"
    },
    {
      "description": "Graph workflow execution and state APIs.",
      "name": "graph"
    },
    {
      "description": "Model catalog, preferences, and refresh endpoints.",
      "name": "models"
    },
    {
      "description": "Episodic, semantic, and procedural memory endpoints.",
      "name": "memory"
    },
    {
      "description": "Tool registry management and direct tool execution APIs.",
      "name": "tools"
    },
    {
      "description": "Operational/admin-only utilities and worker controls.",
      "name": "admin"
    },
    {
      "description": "Tenant configuration and lifecycle APIs.",
      "name": "tenants"
    },
    {
      "description": "Quota usage and override controls.",
      "name": "quota"
    },
    {
      "description": "Audit query, export, and verification endpoints.",
      "name": "audit"
    },
    {
      "description": "Security alerts and policy-related endpoints.",
      "name": "security"
    },
    {
      "description": "Immune system anomaly, quarantine, and vaccination APIs.",
      "name": "immune"
    },
    {
      "description": "Provenance graph query and diff endpoints.",
      "name": "provenance"
    },
    {
      "description": "Trace exploration and analysis endpoints.",
      "name": "traces"
    },
    {
      "description": "Cost aggregation and reporting endpoints.",
      "name": "cost"
    }
  ],
  "x-tagGroups": [
    {
      "name": "Runtime",
      "tags": [
        "health",
        "runs",
        "agents",
        "supervisor",
        "graph",
        "models",
        "memory",
        "tools"
      ]
    },
    {
      "name": "Governance",
      "tags": [
        "tenants",
        "quota",
        "audit",
        "security",
        "immune",
        "provenance",
        "traces",
        "cost"
      ]
    },
    {
      "name": "Operations",
      "tags": [
        "admin"
      ]
    }
  ]
}
