{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/cm-com/main/json-schema/cm-com-conversation-item-schema.json",
  "title": "ConversationItem",
  "x-generated": "2026-10-13",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cm-com-halo-analytics-v1-openapi.yml#/components/schemas/ConversationItem",
  "oneOf": [
    {
      "type": "object",
      "required": [
        "User"
      ],
      "properties": {
        "User": {
          "$ref": "#/$defs/UserConversationItem"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "Assistant"
      ],
      "properties": {
        "Assistant": {
          "$ref": "#/$defs/AssistantConversationItem"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "Tool"
      ],
      "properties": {
        "Tool": {
          "$ref": "#/$defs/ToolConversationItem"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "ToolInteraction"
      ],
      "properties": {
        "ToolInteraction": {
          "$ref": "#/$defs/ToolInteractionConversationItem"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "Handover"
      ],
      "properties": {
        "Handover": {
          "$ref": "#/$defs/HandoverConversationItem"
        }
      }
    }
  ],
  "$defs": {
    "Actor": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "type"
          ],
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "msc_user"
              ]
            }
          }
        },
        {
          "type": "object",
          "required": [
            "type"
          ],
          "properties": {
            "name": {
              "type": [
                "string",
                "null"
              ]
            },
            "type": {
              "type": "string",
              "enum": [
                "msc_agent"
              ]
            }
          }
        },
        {
          "type": "object",
          "required": [
            "id",
            "name",
            "type"
          ],
          "properties": {
            "id": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "type": {
              "type": "string",
              "enum": [
                "teams"
              ]
            }
          }
        }
      ],
      "description": "Identifies the specific participant who authored a `User` or `Assistant`\nconversation item, for conversations with more than one distinct actor\non that role (e.g. MSC's end-user/agent distinction, or a Teams channel\nthread). Absent when the item's role alone identifies the author.\n\nSerializes as a tagged object (`{\"type\": \"msc_user\"}`, `{\"type\": \"teams\", ...}`,\netc). Deserialization additionally accepts the bare strings `\"End_User\"` /\n`\"Customer_Service_Agent\"` for `MscUser` / `MscAgent { name: None }` — MSC's\nlegacy `/instruction` and `/suggestion` endpoints have sent exactly those two\nstring values on the wire for years, so reading that shape can't be dropped.\nNothing produces it anymore; it's accepted, not emitted."
    },
    "AdditionalProperties": {
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "$ref": "#/$defs/JsonSchema"
        }
      ]
    },
    "AgentAnswerResult": {
      "type": "object",
      "required": [
        "temperature",
        "top_p",
        "tools",
        "tool_choice_required",
        "formatting_options",
        "agent_prompt"
      ],
      "properties": {
        "agent_prompt": {
          "type": "string"
        },
        "content": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/ContentPart"
          }
        },
        "formatting_options": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FormattingOption"
          }
        },
        "model": {
          "type": [
            "string",
            "null"
          ]
        },
        "request_type": {
          "type": "string"
        },
        "temperature": {
          "type": "number",
          "format": "double"
        },
        "tool_choice_required": {
          "type": "boolean"
        },
        "tool_uses": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/ToolUse"
          }
        },
        "tools": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ToolOption"
          }
        },
        "top_p": {
          "type": "number",
          "format": "double"
        },
        "usage": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/UsageDetails"
            }
          ]
        }
      }
    },
    "AgentHandoverDetails": {
      "type": "object",
      "description": "Agent handover details",
      "required": [
        "stop_status"
      ],
      "properties": {
        "from_agent_name": {
          "type": [
            "string",
            "null"
          ]
        },
        "from_agent_version_id": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32"
        },
        "reasoning": {
          "type": [
            "string",
            "null"
          ]
        },
        "stop_status": {
          "$ref": "#/$defs/AgentInteractionState"
        },
        "to_agent_name": {
          "type": [
            "string",
            "null"
          ]
        },
        "to_agent_version_id": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32"
        }
      }
    },
    "AgentInteractionState": {
      "type": "string",
      "description": "Agent interaction state",
      "enum": [
        "active",
        "completed",
        "breakout",
        "handover"
      ]
    },
    "AgenticPromptInjectionResult": {
      "type": "object",
      "required": [
        "input",
        "staged_output",
        "agent_instructions",
        "is_safe",
        "reasoning"
      ],
      "properties": {
        "agent_instructions": {
          "type": "string"
        },
        "input": {
          "type": "string"
        },
        "is_safe": {
          "type": "boolean"
        },
        "reasoning": {
          "type": "string"
        },
        "request_type": {
          "type": "string"
        },
        "staged_output": {
          "type": "string"
        },
        "usage": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/UsageDetails"
            }
          ]
        }
      }
    },
    "AgenticUnparkPayload": {
      "type": "object",
      "description": "Unpark payload for agentic activity - user continues conversation via orchestrator",
      "required": [
        "query"
      ],
      "properties": {
        "query": {
          "$ref": "#/$defs/UserResponse",
          "description": "User's query to continue the conversation"
        }
      }
    },
    "AnswerStyleResult": {
      "type": "object",
      "required": [
        "original_answer",
        "language"
      ],
      "properties": {
        "language": {
          "type": "string"
        },
        "original_answer": {
          "type": "string"
        },
        "request_type": {
          "type": "string"
        },
        "rewritten_answer": {
          "type": [
            "string",
            "null"
          ]
        },
        "usage": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/UsageDetails"
            }
          ]
        }
      }
    },
    "AssistantConversationItem": {
      "type": "object",
      "required": [
        "content"
      ],
      "properties": {
        "actor": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/Actor"
            }
          ]
        },
        "content": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ContentPart"
          }
        },
        "id": {
          "type": [
            "string",
            "null"
          ]
        },
        "meta": {
          "$ref": "#/$defs/AssistantConversationItemMeta"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "parent_tool_use_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "tool_uses": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/ToolUse"
          }
        }
      }
    },
    "AssistantConversationItemMeta": {
      "type": "object",
      "properties": {
        "answering_agent_id": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32"
        },
        "audio_interrupted_ms": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32",
          "minimum": 0
        },
        "contexts": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/Contexts"
            }
          ]
        },
        "conversation_ended_delay": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64"
        },
        "feedback_reasoning": {
          "type": [
            "string",
            "null"
          ]
        },
        "generation_duration_ms": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32"
        },
        "initialized": {
          "type": [
            "string",
            "null"
          ]
        },
        "language": {
          "type": [
            "string",
            "null"
          ]
        },
        "match": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "model_results": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/ModelResult"
          }
        },
        "origin": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/RequestOrigin"
            }
          ]
        },
        "provider": {
          "type": [
            "string",
            "null"
          ]
        },
        "rank": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32"
        },
        "reasoning": {
          "type": [
            "string",
            "null"
          ]
        },
        "reasoning_summary": {
          "type": [
            "string",
            "null"
          ],
          "description": "A reasoning model's concise summary of its own chain-of-thought (e.g.\nOpenAI Responses API `reasoning.summary`), surfaced for observability.\nDeliberately separate from `reasoning`, which elsewhere in the\norchestrator/analytics stack means why the system took an action\n(fallback trigger, classification, guardrail) — conflating the two\nwould surface a model's internal thinking where a business-logic\nrationale is expected."
        },
        "tokens": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32"
        },
        "used_feedback": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/Feedback"
          }
        },
        "used_knowledge": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/Knowledge"
          }
        },
        "used_media": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/MediaContentPart"
          }
        }
      }
    },
    "BasicPromptInjectionResult": {
      "type": "object",
      "required": [
        "input",
        "is_safe",
        "reasoning"
      ],
      "properties": {
        "input": {
          "type": "string"
        },
        "is_safe": {
          "type": "boolean"
        },
        "reasoning": {
          "type": "string"
        },
        "request_type": {
          "type": "string"
        },
        "usage": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/UsageDetails"
            }
          ]
        }
      }
    },
    "CandidateChunk": {
      "type": "object",
      "description": "Candidate chunk for RAG refiner/selector",
      "required": [
        "content"
      ],
      "properties": {
        "content": {
          "type": "string"
        },
        "distance": {
          "type": "number",
          "format": "double"
        },
        "id": {
          "type": "integer",
          "format": "int64"
        }
      }
    },
    "ClassifyInstructionResult": {
      "type": "object",
      "required": [
        "input",
        "is_instruction"
      ],
      "properties": {
        "input": {
          "type": "string"
        },
        "is_instruction": {
          "type": "boolean"
        },
        "request_type": {
          "type": "string"
        },
        "usage": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/UsageDetails"
            }
          ]
        }
      }
    },
    "ContentPart": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "text",
            "type"
          ],
          "properties": {
            "text": {
              "type": "string"
            },
            "type": {
              "type": "string",
              "enum": [
                "text"
              ]
            }
          }
        },
        {
          "type": "object",
          "required": [
            "text",
            "type"
          ],
          "properties": {
            "redacted": {
              "type": "boolean"
            },
            "signature": {
              "type": [
                "string",
                "null"
              ]
            },
            "text": {
              "type": "string"
            },
            "type": {
              "type": "string",
              "enum": [
                "thinking"
              ]
            }
          }
        },
        {
          "type": "object",
          "required": [
            "json_value",
            "type"
          ],
          "properties": {
            "json_value": {
              "$ref": "#/$defs/Value"
            },
            "type": {
              "type": "string",
              "enum": [
                "json"
              ]
            }
          }
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/MediaContentPart"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "media"
                  ]
                }
              }
            }
          ]
        },
        {
          "type": "object",
          "description": "OpenAI Responses API `phase: \"commentary\"` text: an intermediate\npreamble emitted before a tool call, distinct from the turn's final\nanswer. Plain assistant-authored text, not hidden reasoning like\n`Thinking`.",
          "required": [
            "text",
            "type"
          ],
          "properties": {
            "text": {
              "type": "string"
            },
            "type": {
              "type": "string",
              "enum": [
                "commentary"
              ]
            }
          }
        }
      ]
    },
    "ContextValue": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "Plain"
          ],
          "properties": {
            "Plain": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "description": "A sensitive string (masked in debug output).\n\n- `is_external: true` — the value came from an external source (e.g. user/API input)\n  No decryption is needed.\n- `is_external: false` — the value is internally managed (e.g. a database default)\n  and is stored encrypted. It must be decrypted before use.",
          "required": [
            "Secret"
          ],
          "properties": {
            "Secret": {
              "type": "object",
              "description": "A sensitive string (masked in debug output).\n\n- `is_external: true` — the value came from an external source (e.g. user/API input)\n  No decryption is needed.\n- `is_external: false` — the value is internally managed (e.g. a database default)\n  and is stored encrypted. It must be decrypted before use.",
              "required": [
                "value",
                "is_external"
              ],
              "properties": {
                "is_external": {
                  "type": "boolean"
                },
                "value": {
                  "type": "string"
                }
              }
            }
          }
        }
      ],
      "description": "Value of context\n- Plain: A non-sensitive string (media and structured data stored as JSON strings)\n- Secret: A sensitive string (not printed in debug)"
    },
    "Contexts": {
      "type": "object",
      "description": "Type alias for a mapping from strings to context values",
      "additionalProperties": {
        "$ref": "#/$defs/ContextValue"
      },
      "propertyNames": {
        "type": "string"
      }
    },
    "ConversationSummaryPurpose": {
      "type": "string",
      "description": "Conversation summary purpose",
      "enum": [
        "handover",
        "resolution",
        "general"
      ]
    },
    "CustomGuardrailResult": {
      "type": "object",
      "required": [
        "input",
        "prompt",
        "result"
      ],
      "properties": {
        "input": {
          "type": "string"
        },
        "prompt": {
          "type": "string"
        },
        "request_type": {
          "type": "string"
        },
        "result": {
          "$ref": "#/$defs/CustomGuardrailResultType"
        },
        "rewritten_input": {
          "type": [
            "string",
            "null"
          ]
        },
        "usage": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/UsageDetails"
            }
          ]
        }
      }
    },
    "CustomGuardrailResultType": {
      "type": "string",
      "description": "Custom guardrail result type",
      "enum": [
        "continue",
        "stop",
        "rewrite"
      ]
    },
    "DematerializedMediaContentPart": {
      "type": "object",
      "required": [
        "mime_type",
        "data_uri",
        "data_hash"
      ],
      "properties": {
        "data_hash": {
          "type": "string"
        },
        "data_uri": {
          "$ref": "#/$defs/MediaDataUri"
        },
        "metadata": {
          "$ref": "#/$defs/Value"
        },
        "mime_type": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "DetectedLanguage": {
      "type": "object",
      "description": "Detected language with probability",
      "required": [
        "language",
        "language_iso",
        "probability"
      ],
      "properties": {
        "language": {
          "type": "string"
        },
        "language_iso": {
          "type": "string"
        },
        "probability": {
          "type": "number",
          "format": "double"
        }
      }
    },
    "DoNotAnswerResult": {
      "type": "object",
      "required": [
        "should_answer"
      ],
      "properties": {
        "request_type": {
          "type": "string"
        },
        "should_answer": {
          "type": "boolean"
        },
        "usage": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/UsageDetails"
            }
          ]
        }
      }
    },
    "FallbackAnswerResult": {
      "type": "object",
      "required": [
        "account_name",
        "language",
        "fallback_prompt",
        "fallback_answer"
      ],
      "properties": {
        "account_name": {
          "type": "string"
        },
        "fallback_answer": {
          "type": "string"
        },
        "fallback_prompt": {
          "type": "string"
        },
        "language": {
          "type": "string"
        },
        "request_type": {
          "type": "string"
        },
        "usage": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/UsageDetails"
            }
          ]
        }
      }
    },
    "Feedback": {
      "type": "object",
      "required": [
        "feedback_id",
        "profile_id",
        "account_id",
        "conversation_id",
        "interaction_id",
        "original_answer",
        "feedback",
        "distance",
        "feedback_reason"
      ],
      "properties": {
        "account_id": {
          "type": "string",
          "format": "uuid"
        },
        "conversation_id": {
          "type": "string",
          "format": "uuid"
        },
        "distance": {
          "type": "number",
          "format": "double"
        },
        "feedback": {
          "type": "string"
        },
        "feedback_id": {
          "$ref": "#/$defs/i64"
        },
        "feedback_reason": {
          "$ref": "#/$defs/FeedbackReason"
        },
        "interaction_id": {
          "type": "string",
          "format": "uuid"
        },
        "original_answer": {
          "type": "string"
        },
        "profile_id": {
          "$ref": "#/$defs/i64"
        }
      }
    },
    "FeedbackReason": {
      "type": "string",
      "enum": [
        "wrongly-formulated",
        "incorrect",
        "do-not-answer"
      ]
    },
    "FeedbackResult": {
      "type": "object",
      "required": [
        "original_answer"
      ],
      "properties": {
        "original_answer": {
          "type": "string"
        },
        "reasoning": {
          "type": [
            "string",
            "null"
          ]
        },
        "request_type": {
          "type": "string"
        },
        "rewritten_answer": {
          "type": [
            "string",
            "null"
          ]
        },
        "usage": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/UsageDetails"
            }
          ]
        }
      }
    },
    "FlowToolDefinition": {
      "allOf": [
        {
          "$ref": "#/$defs/FunctionDefinition"
        },
        {
          "type": "object",
          "required": [
            "tool_id"
          ],
          "properties": {
            "tool_id": {
              "type": "integer",
              "format": "int32"
            }
          }
        }
      ],
      "description": "Flow-based tool definition with a mandatory tool ID."
    },
    "FormattingOption": {
      "type": "string",
      "description": "Formatting option for agent answer",
      "enum": [
        "buttons",
        "carousel",
        "show_feedback"
      ]
    },
    "FunctionDefinition": {
      "type": "object",
      "description": "Common function shape: name, description, and parameters.\nRe-used by `ToolOption::Function` and `ToolOption::Routing`.",
      "required": [
        "name",
        "description"
      ],
      "properties": {
        "description": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "parameters": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FunctionOptionParameter"
          }
        }
      }
    },
    "FunctionOptionParameter": {
      "type": "object",
      "required": [
        "name",
        "required",
        "schema"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "required": {
          "type": "boolean"
        },
        "schema": {
          "$ref": "#/$defs/JsonSchema"
        }
      }
    },
    "FunctionUseArgument": {
      "type": "object",
      "required": [
        "parameter",
        "value"
      ],
      "properties": {
        "parameter": {
          "type": "string"
        },
        "value": {
          "$ref": "#/$defs/Value"
        }
      }
    },
    "HandoverConversationItem": {
      "type": "object",
      "required": [
        "content"
      ],
      "properties": {
        "content": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ContentPart"
          }
        },
        "from_id": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32"
        },
        "from_type": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/HandoverEntityType"
            }
          ]
        },
        "id": {
          "type": [
            "string",
            "null"
          ]
        },
        "meta": {
          "$ref": "#/$defs/HandoverConversationItemMeta"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "to_id": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32"
        },
        "to_type": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/HandoverEntityType"
            }
          ]
        }
      }
    },
    "HandoverConversationItemMeta": {
      "type": "object",
      "properties": {
        "contexts": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/Contexts"
            }
          ]
        },
        "conversation_ended_delay": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64"
        },
        "handover_details": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/HandoverDetails"
            }
          ]
        },
        "initialized": {
          "type": [
            "string",
            "null"
          ]
        },
        "model_results": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/ModelResult"
          }
        },
        "origin": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/RequestOrigin"
            }
          ]
        },
        "rank": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32"
        },
        "tokens": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32"
        }
      }
    },
    "HandoverDetails": {
      "oneOf": [
        {
          "allOf": [
            {
              "$ref": "#/$defs/AgentHandoverDetails"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "agent"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/TextRouterHandoverDetails"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "text_router_v2"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/TextMscHandoverDetails"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "text_msc"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/TextMarketplaceHandoverDetails"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "text_marketplace"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/TextLoggingHandoverDetails"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "text_logging"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/VoiceMscHandoverDetails"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "voice_msc"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/VoiceForwardHandoverDetails"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "voice_forward"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/VoiceTransferHandoverDetails"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "voice_transfer"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/VoiceCustomHandoverDetails"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "voice_custom"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/VoiceLoggingHandoverDetails"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "voice_logging"
                  ]
                }
              }
            }
          ]
        }
      ],
      "description": "Handover details variants"
    },
    "HandoverEntityType": {
      "type": "string",
      "enum": [
        "USER_DEFINED_AGENT",
        "BUILTIN_AGENT",
        "EXTERNAL"
      ]
    },
    "JsonSchema": {
      "allOf": [
        {
          "type": [
            "object",
            "null"
          ],
          "description": "any remaining JSON Schema keywords we don't model explicitly. catch-all\nfor things like `pattern`, `format`, `minLength`, etc. — keywords that\nstrict-mode openai rejects and that we deliberately don't surface as\ntyped fields, but pass through for non-strict consumers.",
          "additionalProperties": {
            "$ref": "#/$defs/Value"
          },
          "propertyNames": {
            "type": "string"
          }
        },
        {
          "type": "object",
          "properties": {
            "$defs": {
              "type": [
                "object",
                "null"
              ],
              "description": "`$defs`: named subschemas usable from `$ref`. accepts the legacy\n`definitions` key as an alias on input.",
              "additionalProperties": {
                "$ref": "#/$defs/JsonSchema"
              },
              "propertyNames": {
                "type": "string"
              }
            },
            "$ref": {
              "type": [
                "string",
                "null"
              ],
              "description": "`$ref`: pointer to a definition (e.g. `#/$defs/Name`)."
            },
            "additionalItems": {
              "oneOf": [
                {
                  "type": "null"
                },
                {
                  "$ref": "#/$defs/JsonSchema",
                  "description": "`additionalItems`: schema for items beyond the tuple defined by `items`."
                }
              ]
            },
            "additionalProperties": {
              "oneOf": [
                {
                  "type": "null"
                },
                {
                  "$ref": "#/$defs/AdditionalProperties",
                  "description": "For objects: allow/deny extra keys"
                }
              ]
            },
            "anyOf": {
              "type": [
                "array",
                "null"
              ],
              "items": {
                "$ref": "#/$defs/JsonSchema"
              },
              "description": "`anyOf`: a tagged union of acceptable schemas."
            },
            "const": {
              "oneOf": [
                {
                  "type": "null"
                },
                {
                  "$ref": "#/$defs/Value",
                  "description": "`const`: a single allowed value. spec is type-agnostic."
                }
              ]
            },
            "description": {
              "type": [
                "string",
                "null"
              ]
            },
            "enum": {
              "type": [
                "array",
                "null"
              ],
              "items": {
                "$ref": "#/$defs/Value"
              },
              "description": "`enum`: any allowed values. spec is type-agnostic, hence `JsonValue`."
            },
            "exclusiveMaximum": {
              "type": [
                "number",
                "null"
              ],
              "format": "double",
              "description": "`exclusiveMaximum`: numbers/integers strictly less than this."
            },
            "exclusiveMinimum": {
              "type": [
                "number",
                "null"
              ],
              "format": "double",
              "description": "`exclusiveMinimum`: numbers/integers strictly greater than this."
            },
            "items": {
              "oneOf": [
                {
                  "type": "null"
                },
                {
                  "$ref": "#/$defs/JsonSchema",
                  "description": "For arrays: a schema for the items"
                }
              ]
            },
            "properties": {
              "type": [
                "object",
                "null"
              ],
              "description": "For objects: property-name -> schema",
              "additionalProperties": {
                "$ref": "#/$defs/JsonSchema"
              },
              "propertyNames": {
                "type": "string"
              }
            },
            "required": {
              "type": [
                "array",
                "null"
              ],
              "items": {
                "type": "string"
              },
              "description": "For objects: names of required properties"
            },
            "title": {
              "type": [
                "string",
                "null"
              ],
              "description": "`title`: human-readable label."
            },
            "type": {
              "oneOf": [
                {
                  "type": "null"
                },
                {
                  "$ref": "#/$defs/JsonTypeSpec"
                }
              ]
            }
          }
        }
      ]
    },
    "JsonType": {
      "type": "string",
      "enum": [
        "object",
        "array",
        "string",
        "number",
        "integer",
        "boolean",
        "null"
      ]
    },
    "JsonTypeSpec": {
      "oneOf": [
        {
          "$ref": "#/$defs/JsonType"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/JsonType"
          }
        }
      ],
      "description": "JSON Schema `type` field: either a single type (`\"string\"`) or a union (`[\"array\", \"null\"]`)."
    },
    "Knowledge": {
      "type": "object",
      "required": [
        "id",
        "source_id",
        "chunk_id",
        "content",
        "metadata",
        "distance"
      ],
      "properties": {
        "chunk_id": {
          "type": "string"
        },
        "content": {
          "type": "string"
        },
        "distance": {
          "type": "number",
          "format": "double"
        },
        "id": {
          "$ref": "#/$defs/i64"
        },
        "metadata": {
          "type": "object",
          "additionalProperties": {},
          "propertyNames": {
            "type": "string"
          }
        },
        "source": {
          "type": "string"
        },
        "source_id": {
          "$ref": "#/$defs/i64"
        },
        "source_reference": {
          "type": "string"
        }
      }
    },
    "LanguageDetectionResult": {
      "type": "object",
      "required": [
        "input",
        "languages"
      ],
      "properties": {
        "input": {
          "type": "string"
        },
        "languages": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DetectedLanguage"
          }
        },
        "request_type": {
          "type": "string"
        },
        "usage": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/UsageDetails"
            }
          ]
        }
      }
    },
    "LanguageTranslationResult": {
      "type": "object",
      "required": [
        "input",
        "language",
        "translation"
      ],
      "properties": {
        "current_language": {
          "type": [
            "string",
            "null"
          ]
        },
        "input": {
          "$ref": "#/$defs/TranslationContent"
        },
        "language": {
          "type": "string"
        },
        "lexicon": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "type": "string"
          },
          "propertyNames": {
            "type": "string"
          }
        },
        "request_type": {
          "type": "string"
        },
        "translation": {
          "$ref": "#/$defs/TranslationContent"
        },
        "usage": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/UsageDetails"
            }
          ]
        }
      }
    },
    "MaterializedMediaContentPart": {
      "type": "object",
      "required": [
        "mime_type",
        "data",
        "data_uri",
        "data_hash",
        "metadata"
      ],
      "properties": {
        "data": {
          "type": "string"
        },
        "data_hash": {
          "type": "string"
        },
        "data_uri": {
          "$ref": "#/$defs/MediaDataUri"
        },
        "metadata": {
          "$ref": "#/$defs/Value"
        },
        "mime_type": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "McpToolDefinition": {
      "allOf": [
        {
          "$ref": "#/$defs/FunctionDefinition"
        },
        {
          "type": "object",
          "required": [
            "mcp_server_id"
          ],
          "properties": {
            "mcp_server_id": {
              "$ref": "#/$defs/i32"
            }
          }
        }
      ],
      "description": "MCP-based tool definition with a mandatory server ID."
    },
    "MediaContentPart": {
      "oneOf": [
        {
          "type": "object",
          "description": "A new media content part which is not yet uploaded into HALO",
          "required": [
            "Transient"
          ],
          "properties": {
            "Transient": {
              "$ref": "#/$defs/TransientMediaContentPart",
              "description": "A new media content part which is not yet uploaded into HALO"
            }
          }
        },
        {
          "type": "object",
          "description": "A media content part with data, and can be dematerialized",
          "required": [
            "Materialized"
          ],
          "properties": {
            "Materialized": {
              "$ref": "#/$defs/MaterializedMediaContentPart",
              "description": "A media content part with data, and can be dematerialized"
            }
          }
        },
        {
          "type": "object",
          "description": "A media content part without data, but it can be downloaded",
          "required": [
            "Dematerialized"
          ],
          "properties": {
            "Dematerialized": {
              "$ref": "#/$defs/DematerializedMediaContentPart",
              "description": "A media content part without data, but it can be downloaded"
            }
          }
        }
      ]
    },
    "MediaDataUri": {
      "type": "string"
    },
    "MessageList": {
      "type": "object",
      "description": "Language translation message",
      "required": [
        "message_id",
        "content"
      ],
      "properties": {
        "content": {
          "type": "string"
        },
        "message_id": {
          "type": "string"
        }
      }
    },
    "ModelResult": {
      "oneOf": [
        {
          "allOf": [
            {
              "$ref": "#/$defs/ClassifyInstructionResult"
            },
            {
              "type": "object",
              "required": [
                "request_type"
              ],
              "properties": {
                "request_type": {
                  "type": "string",
                  "enum": [
                    "classify_instruction"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/QueryClassificationResult"
            },
            {
              "type": "object",
              "required": [
                "request_type"
              ],
              "properties": {
                "request_type": {
                  "type": "string",
                  "enum": [
                    "query_classification"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/PromptInjectionResult"
            },
            {
              "type": "object",
              "required": [
                "request_type"
              ],
              "properties": {
                "request_type": {
                  "type": "string",
                  "enum": [
                    "prompt_injection"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/SummarizeConversationResult"
            },
            {
              "type": "object",
              "required": [
                "request_type"
              ],
              "properties": {
                "request_type": {
                  "type": "string",
                  "enum": [
                    "summarize_conversation"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/BasicPromptInjectionResult"
            },
            {
              "type": "object",
              "required": [
                "request_type"
              ],
              "properties": {
                "request_type": {
                  "type": "string",
                  "enum": [
                    "basic_prompt_injection"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/AgenticPromptInjectionResult"
            },
            {
              "type": "object",
              "required": [
                "request_type"
              ],
              "properties": {
                "request_type": {
                  "type": "string",
                  "enum": [
                    "agentic_prompt_injection"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/CustomGuardrailResult"
            },
            {
              "type": "object",
              "required": [
                "request_type"
              ],
              "properties": {
                "request_type": {
                  "type": "string",
                  "enum": [
                    "custom_guardrail"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/AnswerStyleResult"
            },
            {
              "type": "object",
              "required": [
                "request_type"
              ],
              "properties": {
                "request_type": {
                  "type": "string",
                  "enum": [
                    "answer_style"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/FeedbackResult"
            },
            {
              "type": "object",
              "required": [
                "request_type"
              ],
              "properties": {
                "request_type": {
                  "type": "string",
                  "enum": [
                    "feedback"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/DoNotAnswerResult"
            },
            {
              "type": "object",
              "required": [
                "request_type"
              ],
              "properties": {
                "request_type": {
                  "type": "string",
                  "enum": [
                    "do_not_answer"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/FallbackAnswerResult"
            },
            {
              "type": "object",
              "required": [
                "request_type"
              ],
              "properties": {
                "request_type": {
                  "type": "string",
                  "enum": [
                    "fallback_answer"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/RagRewriteResult"
            },
            {
              "type": "object",
              "required": [
                "request_type"
              ],
              "properties": {
                "request_type": {
                  "type": "string",
                  "enum": [
                    "rag_rewrite"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/RagPlannerResult"
            },
            {
              "type": "object",
              "required": [
                "request_type"
              ],
              "properties": {
                "request_type": {
                  "type": "string",
                  "enum": [
                    "rag_planner"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/RagRefinerResult"
            },
            {
              "type": "object",
              "required": [
                "request_type"
              ],
              "properties": {
                "request_type": {
                  "type": "string",
                  "enum": [
                    "rag_refiner"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/RagSelectorResult"
            },
            {
              "type": "object",
              "required": [
                "request_type"
              ],
              "properties": {
                "request_type": {
                  "type": "string",
                  "enum": [
                    "rag_selector"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/AgentAnswerResult"
            },
            {
              "type": "object",
              "required": [
                "request_type"
              ],
              "properties": {
                "request_type": {
                  "type": "string",
                  "enum": [
                    "agent_answer"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/RagAnswerResult"
            },
            {
              "type": "object",
              "required": [
                "request_type"
              ],
              "properties": {
                "request_type": {
                  "type": "string",
                  "enum": [
                    "rag_answer"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/RagAnswerSubagentResult"
            },
            {
              "type": "object",
              "required": [
                "request_type"
              ],
              "properties": {
                "request_type": {
                  "type": "string",
                  "enum": [
                    "rag_answer_subagent"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/LanguageDetectionResult"
            },
            {
              "type": "object",
              "required": [
                "request_type"
              ],
              "properties": {
                "request_type": {
                  "type": "string",
                  "enum": [
                    "language_detection"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/LanguageTranslationResult"
            },
            {
              "type": "object",
              "required": [
                "request_type"
              ],
              "properties": {
                "request_type": {
                  "type": "string",
                  "enum": [
                    "language_translation"
                  ]
                }
              }
            }
          ]
        }
      ],
      "description": "Model result discriminated union - matches Python ModelResult type"
    },
    "PromptInjectionResult": {
      "type": "object",
      "required": [
        "input",
        "is_safe",
        "reasoning"
      ],
      "properties": {
        "input": {
          "type": "string"
        },
        "is_safe": {
          "type": "boolean"
        },
        "reasoning": {
          "type": "string"
        },
        "request_type": {
          "type": "string"
        },
        "usage": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/UsageDetails"
            }
          ]
        }
      }
    },
    "Provider": {
      "type": "string",
      "enum": [
        "anthropic",
        "openai",
        "gemini"
      ]
    },
    "QueryClassificationResult": {
      "type": "object",
      "required": [
        "input",
        "classification"
      ],
      "properties": {
        "classification": {
          "type": "string"
        },
        "input": {
          "type": "string"
        },
        "request_type": {
          "type": "string"
        },
        "usage": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/UsageDetails"
            }
          ]
        }
      }
    },
    "RagAnswerResult": {
      "type": "object",
      "required": [
        "knowledge_chunks",
        "language",
        "account_name",
        "answer"
      ],
      "properties": {
        "account_name": {
          "type": "string"
        },
        "answer": {
          "type": "string"
        },
        "knowledge_chunks": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RagChunk"
          }
        },
        "language": {
          "type": "string"
        },
        "media": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/MediaContentPart"
          }
        },
        "request_type": {
          "type": "string"
        },
        "usage": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/UsageDetails"
            }
          ]
        }
      }
    },
    "RagAnswerSubagentResult": {
      "type": "object",
      "required": [
        "knowledge_contents",
        "status",
        "reasoning",
        "source_ids"
      ],
      "properties": {
        "answer": {
          "type": [
            "string",
            "null"
          ]
        },
        "knowledge_chunks": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/RagChunk"
          }
        },
        "knowledge_contents": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "media": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/MediaContentPart"
          }
        },
        "reasoning": {
          "type": "string"
        },
        "request_type": {
          "type": "string"
        },
        "source_ids": {
          "type": "array",
          "items": {
            "type": "integer",
            "format": "int64"
          }
        },
        "status": {
          "$ref": "#/$defs/RagAnswerSubagentStatus"
        },
        "usage": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/UsageDetails"
            }
          ]
        }
      }
    },
    "RagAnswerSubagentStatus": {
      "type": "string",
      "enum": [
        "answer",
        "clarifying_question",
        "no_answer"
      ]
    },
    "RagChunk": {
      "type": "object",
      "description": "RAG chunk for knowledge retrieval results",
      "required": [
        "type",
        "content",
        "chunk_id",
        "source_id",
        "source_name"
      ],
      "properties": {
        "chunk_id": {
          "type": "string"
        },
        "content": {
          "type": "string"
        },
        "source_id": {
          "type": "integer",
          "format": "int64"
        },
        "source_name": {
          "type": "string"
        },
        "type": {
          "type": "string"
        }
      }
    },
    "RagPlannerResult": {
      "type": "object",
      "required": [
        "searchable_ask",
        "seed_queries"
      ],
      "properties": {
        "request_type": {
          "type": "string"
        },
        "searchable_ask": {
          "type": "string"
        },
        "seed_queries": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "usage": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/UsageDetails"
            }
          ]
        }
      }
    },
    "RagRefinerResult": {
      "type": "object",
      "required": [
        "candidate_chunks",
        "searchable_ask",
        "seed_queries",
        "best_ids",
        "retrieval_complete",
        "refined_queries"
      ],
      "properties": {
        "best_ids": {
          "type": "array",
          "items": {
            "type": "integer",
            "format": "int64"
          }
        },
        "candidate_chunks": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CandidateChunk"
          }
        },
        "refined_queries": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "request_type": {
          "type": "string"
        },
        "retrieval_complete": {
          "type": "boolean"
        },
        "searchable_ask": {
          "type": "string"
        },
        "seed_queries": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "usage": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/UsageDetails"
            }
          ]
        }
      }
    },
    "RagRewriteResult": {
      "type": "object",
      "required": [
        "input",
        "rewritten_input"
      ],
      "properties": {
        "input": {
          "type": "string"
        },
        "request_type": {
          "type": "string"
        },
        "rewritten_input": {
          "type": "string"
        },
        "usage": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/UsageDetails"
            }
          ]
        }
      }
    },
    "RagSelectorResult": {
      "type": "object",
      "required": [
        "searchable_ask",
        "candidate_chunks",
        "best_ids"
      ],
      "properties": {
        "best_ids": {
          "type": "array",
          "items": {
            "type": "integer",
            "format": "int64"
          }
        },
        "candidate_chunks": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CandidateChunk"
          }
        },
        "request_type": {
          "type": "string"
        },
        "searchable_ask": {
          "type": "string"
        },
        "usage": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/UsageDetails"
            }
          ]
        }
      }
    },
    "RequestOrigin": {
      "type": "string",
      "enum": [
        "AVA",
        "CPAAS",
        "WEBCONVERSATIONS",
        "HALO_GENERATED",
        "HALO_TEST_CENTER",
        "NATIVE_VOICE",
        "SEAMLY",
        "CAIC",
        "MOBILE_SERVICE_CLOUD_QA",
        "INSPIRE",
        "PRODUCT_FEED",
        "SUGGESTION",
        "INSTRUCTION",
        "CHAT",
        "MICROSOFT_TEAMS",
        "Unknown"
      ]
    },
    "ServerToolDefinition": {
      "allOf": [
        {
          "$ref": "#/$defs/FunctionDefinition"
        },
        {
          "type": "object",
          "required": [
            "server_tool_type"
          ],
          "properties": {
            "server_tool_type": {
              "type": "string"
            }
          }
        }
      ],
      "description": "Server-side tool definition (e.g. Anthropic web search)."
    },
    "SummarizeConversationResult": {
      "type": "object",
      "required": [
        "summary"
      ],
      "properties": {
        "purpose": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/ConversationSummaryPurpose"
            }
          ]
        },
        "request_type": {
          "type": "string"
        },
        "summary": {
          "type": "string"
        },
        "usage": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/UsageDetails"
            }
          ]
        }
      }
    },
    "TextLoggingHandoverDetails": {
      "type": "object",
      "description": "Text logging handover details"
    },
    "TextMarketplaceHandoverDetails": {
      "type": "object",
      "description": "Text Marketplace handover details",
      "required": [
        "adapter_id",
        "messaging_adapter_id"
      ],
      "properties": {
        "adapter_id": {
          "type": "string"
        },
        "context": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "type": "string"
          },
          "propertyNames": {
            "type": "string"
          }
        },
        "messaging_adapter_id": {
          "type": "string"
        },
        "routing": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "TextMscHandoverDetails": {
      "type": "object",
      "description": "Text MSC handover details",
      "required": [
        "adapter_id",
        "messaging_adapter_id",
        "name",
        "email"
      ],
      "properties": {
        "adapter_id": {
          "type": "string"
        },
        "email": {
          "type": "string"
        },
        "messaging_adapter_id": {
          "type": "string"
        },
        "msc_profile": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "type": "string"
          },
          "propertyNames": {
            "type": "string"
          }
        },
        "name": {
          "type": "string"
        },
        "phone_number": {
          "type": [
            "string",
            "null"
          ]
        },
        "routing_keywords": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          }
        },
        "web_store_referrer": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "TextRouterHandoverDetails": {
      "type": "object",
      "description": "Text Router V2 handover details",
      "required": [
        "target_state_name_id",
        "context"
      ],
      "properties": {
        "context": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "propertyNames": {
            "type": "string"
          }
        },
        "target_state_name_id": {
          "type": "string",
          "format": "uuid"
        }
      }
    },
    "TimerUnparkPayload": {
      "type": "object",
      "description": "Unpark payload for timer (empty - no data needed when timer fires)"
    },
    "ToolCallUnparkPayload": {
      "type": "object",
      "description": "Unpark payload for tool",
      "required": [
        "nested_unpark_token",
        "nested_unpark_payload"
      ],
      "properties": {
        "nested_unpark_payload": {
          "$ref": "#/$defs/UnparkPayload"
        },
        "nested_unpark_token": {
          "type": "string"
        }
      }
    },
    "ToolConversationItem": {
      "type": "object",
      "required": [
        "content",
        "tool_use_id"
      ],
      "properties": {
        "content": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ContentPart"
          }
        },
        "id": {
          "type": [
            "string",
            "null"
          ]
        },
        "media": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/MediaContentPart"
          }
        },
        "meta": {
          "$ref": "#/$defs/ToolConversationItemMeta"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "parent_tool_use_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "tool_use_id": {
          "type": "string"
        }
      }
    },
    "ToolConversationItemMeta": {
      "type": "object",
      "properties": {
        "contexts": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/Contexts"
            }
          ]
        },
        "conversation_ended_delay": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64"
        },
        "initialized": {
          "type": [
            "string",
            "null"
          ]
        },
        "model_results": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/ModelResult"
          }
        },
        "origin": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/RequestOrigin"
            }
          ]
        },
        "rank": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32"
        },
        "tokens": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32"
        },
        "tool_use_details": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/ToolUseDetails"
            }
          ]
        }
      }
    },
    "ToolInteractionConversationItem": {
      "type": "object",
      "required": [
        "content",
        "tool_use_id"
      ],
      "properties": {
        "content": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ContentPart"
          }
        },
        "id": {
          "type": [
            "string",
            "null"
          ]
        },
        "meta": {
          "$ref": "#/$defs/ToolInteractionConversationItemMeta"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "tool_use_id": {
          "type": "string"
        }
      }
    },
    "ToolInteractionConversationItemMeta": {
      "type": "object",
      "properties": {
        "contexts": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/Contexts"
            }
          ]
        },
        "conversation_ended_delay": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64"
        },
        "initialized": {
          "type": [
            "string",
            "null"
          ]
        },
        "interaction_type": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/ToolInteractionType"
            }
          ]
        },
        "match": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "model_results": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/ModelResult"
          }
        },
        "origin": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/RequestOrigin"
            }
          ]
        },
        "rank": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32"
        },
        "tokens": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32"
        }
      }
    },
    "ToolInteractionType": {
      "type": "string",
      "enum": [
        "user",
        "agentic"
      ]
    },
    "ToolOption": {
      "oneOf": [
        {
          "allOf": [
            {
              "$ref": "#/$defs/FunctionDefinition"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "function"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/FlowToolDefinition"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "flow_tool"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/McpToolDefinition"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "mcp_tool"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/ServerToolDefinition"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "server_tool"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/FunctionDefinition"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "routing"
                  ]
                }
              }
            }
          ]
        }
      ]
    },
    "ToolState": {
      "type": "string",
      "description": "Unified tool state that covers both Flow and MCP tool states",
      "enum": [
        "running",
        "parked",
        "completed",
        "terminated"
      ]
    },
    "ToolUse": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "id",
            "name",
            "arguments",
            "type"
          ],
          "properties": {
            "arguments": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/FunctionUseArgument"
              }
            },
            "id": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "type": {
              "type": "string",
              "enum": [
                "function"
              ]
            }
          }
        },
        {
          "type": "object",
          "required": [
            "id",
            "name",
            "arguments",
            "tool_id",
            "type"
          ],
          "properties": {
            "arguments": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/FunctionUseArgument"
              }
            },
            "id": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "tool_id": {
              "$ref": "#/$defs/i32"
            },
            "type": {
              "type": "string",
              "enum": [
                "flow_tool"
              ]
            }
          }
        },
        {
          "type": "object",
          "required": [
            "id",
            "name",
            "arguments",
            "mcp_server_id",
            "type"
          ],
          "properties": {
            "arguments": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/FunctionUseArgument"
              }
            },
            "id": {
              "type": "string"
            },
            "mcp_server_id": {
              "$ref": "#/$defs/i32"
            },
            "name": {
              "type": "string"
            },
            "type": {
              "type": "string",
              "enum": [
                "mcp_tool"
              ]
            }
          }
        },
        {
          "type": "object",
          "required": [
            "id",
            "name",
            "arguments",
            "type"
          ],
          "properties": {
            "arguments": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/FunctionUseArgument"
              }
            },
            "id": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "type": {
              "type": "string",
              "enum": [
                "routing"
              ]
            }
          }
        },
        {
          "type": "object",
          "required": [
            "id",
            "name",
            "input",
            "type"
          ],
          "properties": {
            "id": {
              "type": "string"
            },
            "input": {
              "$ref": "#/$defs/Value"
            },
            "name": {
              "type": "string"
            },
            "provider": {
              "oneOf": [
                {
                  "type": "null"
                },
                {
                  "$ref": "#/$defs/Provider"
                }
              ]
            },
            "type": {
              "type": "string",
              "enum": [
                "server_tool"
              ]
            }
          }
        }
      ]
    },
    "ToolUseDetails": {
      "type": "object",
      "description": "Details about a tool execution",
      "required": [
        "tool_name",
        "started",
        "finished"
      ],
      "properties": {
        "execution_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "finished": {
          "type": "string"
        },
        "started": {
          "type": "string"
        },
        "state": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/ToolState"
            }
          ]
        },
        "tool_id": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32"
        },
        "tool_name": {
          "type": "string"
        },
        "trace": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/ToolUseTrace"
          }
        },
        "version_id": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32"
        }
      }
    },
    "ToolUseTrace": {
      "type": "object",
      "description": "Trace information for a tool use execution step",
      "required": [
        "id",
        "state",
        "started"
      ],
      "properties": {
        "attributes": {
          "type": [
            "object",
            "null"
          ]
        },
        "finished": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "id": {
          "type": "integer",
          "format": "int32"
        },
        "media": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "$ref": "#/$defs/DematerializedMediaContentPart"
          },
          "propertyNames": {
            "type": "string"
          }
        },
        "node_type": {
          "type": [
            "string",
            "null"
          ]
        },
        "output": {
          "type": [
            "object",
            "null"
          ]
        },
        "started": {
          "type": "string",
          "format": "date-time"
        },
        "state": {
          "$ref": "#/$defs/ToolUseTraceState"
        },
        "trace": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/ToolUseTrace"
          }
        },
        "unpark_payload": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/UnparkPayload"
            }
          ]
        },
        "variables": {
          "type": [
            "object",
            "null"
          ]
        }
      }
    },
    "ToolUseTraceState": {
      "type": "string",
      "description": "State of a tool use trace step",
      "enum": [
        "parked",
        "unparked",
        "completed",
        "terminated"
      ]
    },
    "TransientMediaContentPart": {
      "type": "object",
      "required": [
        "mime_type",
        "data",
        "data_hash"
      ],
      "properties": {
        "data": {
          "type": "string"
        },
        "data_hash": {
          "type": "string"
        },
        "metadata": {
          "$ref": "#/$defs/Value"
        },
        "mime_type": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "TranslationContent": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/MessageList"
          }
        }
      ],
      "description": "Translation input content (either text or message list)"
    },
    "UnparkPayload": {
      "oneOf": [
        {
          "allOf": [
            {
              "$ref": "#/$defs/TimerUnparkPayload"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "timer"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/UserInteractionUnparkPayload"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "user_interaction"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/AgenticUnparkPayload"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "agentic"
                  ]
                }
              }
            }
          ]
        },
        {
          "allOf": [
            {
              "$ref": "#/$defs/ToolCallUnparkPayload"
            },
            {
              "type": "object",
              "required": [
                "type"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "tool"
                  ]
                }
              }
            }
          ]
        }
      ],
      "description": "Enum type for unparking"
    },
    "UsageDetails": {
      "type": "object",
      "properties": {
        "cache_creation_input_tokens": {
          "type": "integer",
          "format": "int32",
          "default": 0,
          "minimum": 0
        },
        "cache_read_input_tokens": {
          "type": "integer",
          "format": "int32",
          "default": 0,
          "minimum": 0
        },
        "completion_tokens": {
          "type": "integer",
          "format": "int32",
          "default": 0,
          "minimum": 0
        },
        "prompt_tokens": {
          "type": "integer",
          "format": "int32",
          "default": 0,
          "minimum": 0
        },
        "total_tokens": {
          "type": "integer",
          "format": "int32",
          "default": 0,
          "minimum": 0
        }
      }
    },
    "UserConversationItem": {
      "type": "object",
      "required": [
        "content"
      ],
      "properties": {
        "actor": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/Actor"
            }
          ]
        },
        "content": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ContentPart"
          }
        },
        "id": {
          "type": [
            "string",
            "null"
          ]
        },
        "meta": {
          "$ref": "#/$defs/UserConversationItemMeta"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "tool_interaction_item_id": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "UserConversationItemMeta": {
      "type": "object",
      "properties": {
        "contexts": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/Contexts"
            }
          ]
        },
        "conversation_ended_delay": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64"
        },
        "initialized": {
          "type": [
            "string",
            "null"
          ]
        },
        "model_results": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/ModelResult"
          }
        },
        "origin": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/RequestOrigin"
            }
          ]
        },
        "original_query": {
          "type": [
            "string",
            "null"
          ]
        },
        "rank": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32"
        },
        "tokens": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int32"
        }
      }
    },
    "UserInteractionUnparkPayload": {
      "type": "object",
      "description": "Unpark payload for user interaction",
      "required": [
        "user_response"
      ],
      "properties": {
        "user_response": {
          "$ref": "#/$defs/UserResponse"
        }
      }
    },
    "UserResponse": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "$ref": "#/$defs/MediaContentPart"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ContentPart"
          },
          "description": "Mixed content (e.g. user replied with both text and an image).\nCarries the full ordered list of content parts so the agentic LLM\ncan reason over both the text query and the media together."
        }
      ],
      "description": "User response in an unpark payload`."
    },
    "Value": {},
    "VoiceCustomHandoverDetails": {
      "type": "object",
      "description": "Voice custom handover details",
      "required": [
        "custom_type",
        "custom_config"
      ],
      "properties": {
        "custom_config": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "propertyNames": {
            "type": "string"
          }
        },
        "custom_type": {
          "type": "string"
        }
      }
    },
    "VoiceForwardHandoverDetails": {
      "type": "object",
      "description": "Voice forward handover details",
      "required": [
        "callee_id"
      ],
      "properties": {
        "anonymous": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "callee_id": {
          "type": "string"
        },
        "caller_id": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "VoiceLoggingHandoverDetails": {
      "type": "object",
      "description": "Voice logging handover details"
    },
    "VoiceMscHandoverDetails": {
      "type": "object",
      "description": "Voice MSC handover details",
      "required": [
        "environment",
        "web_store_referrer",
        "routing_keywords"
      ],
      "properties": {
        "environment": {
          "type": "string"
        },
        "routing_keywords": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "web_store_referrer": {
          "type": "string"
        }
      }
    },
    "VoiceTransferHandoverDetails": {
      "type": "object",
      "description": "Voice transfer handover details",
      "required": [
        "distribution_group",
        "distribution_group_algorithm"
      ],
      "properties": {
        "cm_context_variables": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {},
          "propertyNames": {
            "type": "string"
          }
        },
        "distribution_group": {
          "type": "string"
        },
        "distribution_group_algorithm": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "i32": {
      "type": "integer",
      "format": "int32"
    },
    "i64": {
      "type": "integer",
      "format": "int64"
    }
  }
}