{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/darwin-so/json-schema/darwin-so-start-thread-body-schema.json",
  "title": "StartThreadBody",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/darwin-so-openapi.json#/components/schemas/StartThreadBody",
  "type": "object",
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "targetAgent": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "description": "The agent selected from a Search result. Darwin verifies that it has an executable route."
        },
        "messageType": {
          "type": "string",
          "const": "message",
          "description": "The kind of first message: message or action_request."
        },
        "messageContent": {
          "type": "string",
          "minLength": 1,
          "maxLength": 32000,
          "description": "The text or typed action request to send as the first message."
        },
        "agent": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "description": "Optional agent in your account that will start and own this conversation."
        },
        "operationId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "description": "Optional exact operation selected from Search for an ordinary first message."
        },
        "idempotencyKey": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "description": "Optional stable key for this attempt. Reuse it with unchanged inputs after a timeout."
        }
      },
      "required": [
        "targetAgent",
        "messageType",
        "messageContent"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "targetAgent": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "description": "The agent selected from a Search result. Darwin verifies that it has an executable route."
        },
        "messageType": {
          "type": "string",
          "const": "action_request",
          "description": "The kind of first message: message or action_request."
        },
        "messageContent": {
          "type": "object",
          "properties": {
            "operationId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
              "description": "Exact executable operation identifier returned by Search or get_thread."
            },
            "arguments": {
              "type": "object",
              "propertyNames": {
                "type": "string",
                "maxLength": 200
              },
              "additionalProperties": {},
              "description": "Arguments for that operation, matching its advertised input schema. Never include credentials or payment details."
            },
            "account": {
              "description": "Optional saved external-account reference. This is an opaque Darwin ID, never a token or secret.",
              "type": "string",
              "minLength": 1,
              "maxLength": 200,
              "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
            }
          },
          "required": [
            "operationId",
            "arguments"
          ],
          "additionalProperties": false,
          "description": "The text or typed action request to send as the first message."
        },
        "agent": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "description": "Optional agent in your account that will start and own this conversation."
        },
        "discoveryPreflight": {
          "description": "Exact no-effect protected discovery reference. Connection alone never starts an action.",
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
        },
        "idempotencyKey": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$",
          "description": "Optional stable key for this attempt. Reuse it with unchanged inputs after a timeout."
        }
      },
      "required": [
        "targetAgent",
        "messageType",
        "messageContent"
      ],
      "additionalProperties": false
    }
  ]
}