{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/letta__schemas__agent_file__MessageSchema",
  "title": "MessageSchema",
  "properties": {
    "type": {
      "anyOf": [
        {
          "type": "string",
          "const": "message"
        },
        {
          "type": "null"
        }
      ],
      "title": "Type",
      "description": "The message type to be created.",
      "default": "message"
    },
    "otid": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Otid",
      "description": "The offline threading id (OTID). Set by the client to deduplicate requests. Used for idempotency in background streaming mode \u2014 each message in a request must have a unique OTID. Retries of the same request should reuse the same OTIDs."
    },
    "group_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Group Id",
      "description": "The multi-agent group that the message was sent in"
    },
    "role": {
      "$ref": "#/components/schemas/MessageRole",
      "description": "The role of the participant."
    },
    "content": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/components/schemas/LettaMessageContentUnion"
          },
          "type": "array"
        },
        {
          "type": "string"
        }
      ],
      "title": "Content",
      "description": "The content of the message."
    },
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Name",
      "description": "The name of the participant."
    },
    "sender_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Sender Id",
      "description": "The id of the sender of the message, can be an identity id or agent id"
    },
    "batch_item_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Batch Item Id",
      "description": "The id of the LLMBatchItem that this message is associated with"
    },
    "id": {
      "type": "string",
      "title": "Id",
      "description": "Human-readable identifier for this message in the file"
    },
    "model": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Model",
      "description": "The model used to make the function call"
    },
    "agent_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Agent Id",
      "description": "The unique identifier of the agent"
    },
    "tool_calls": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/components/schemas/ChatCompletionMessageFunctionToolCall-Input"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Tool Calls",
      "description": "The list of tool calls requested. Only applicable for role assistant."
    },
    "tool_call_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Tool Call Id",
      "description": "The ID of the tool call. Only applicable for role tool."
    },
    "tool_returns": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/components/schemas/letta__schemas__message__ToolReturn-Input"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Tool Returns",
      "description": "Tool execution return information for prior tool calls"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At",
      "description": "The timestamp when the object was created."
    },
    "approve": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Approve",
      "description": "Whether the tool has been approved"
    },
    "approval_request_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Approval Request Id",
      "description": "The message ID of the approval request"
    },
    "denial_reason": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Denial Reason",
      "description": "An optional explanation for the provided approval status"
    },
    "approvals": {
      "anyOf": [
        {
          "items": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ApprovalReturn"
              },
              {
                "$ref": "#/components/schemas/letta__schemas__message__ToolReturn-Input"
              }
            ]
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Approvals",
      "description": "Approval returns for the message"
    }
  },
  "type": "object",
  "required": [
    "role",
    "content",
    "id"
  ],
  "description": "Message with human-readable ID for agent file"
}