{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-bedrock/json-schema/amazon-bedrock-invoke-harness-request-schema.json",
  "title": "InvokeHarnessRequest",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-bedrock-harnesses-api-openapi.yml#/components/schemas/InvokeHarnessRequest",
  "type": "object",
  "properties": {
    "harnessArn": {
      "type": "string",
      "description": "The ARN of the harness to invoke."
    },
    "qualifier": {
      "type": "string",
      "description": "The endpoint name to invoke. If omitted, the DEFAULT endpoint is used."
    },
    "runtimeSessionId": {
      "type": "string",
      "description": "The session ID for the invocation. Use the same session ID across requests to continue a conversation."
    },
    "runtimeUserId": {
      "type": "string",
      "description": "An identifier for the end user making the request. This value is passed through to the runtime container."
    },
    "traceParent": {
      "type": "string",
      "description": "W3C trace context parent header containing version, trace ID, parent span ID, and trace flags."
    },
    "traceState": {
      "type": "string",
      "description": "W3C trace context state header for vendor-specific trace information."
    },
    "traceId": {
      "type": "string",
      "description": "Trace ID for maintaining observability through the operation."
    },
    "baggage": {
      "type": "string",
      "description": "W3C Baggage header for user-defined context propagation. Format: key1=value1,key2=value2"
    },
    "messages": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/HarnessMessage"
      },
      "description": "The messages to send to the agent."
    },
    "model": {
      "$ref": "#/$defs/HarnessModelConfiguration"
    },
    "systemPrompt": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/HarnessSystemContentBlock"
      },
      "description": "The system prompt to use for this invocation. If specified, overrides the harness default."
    },
    "tools": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/HarnessTool"
      },
      "description": "The tools available to the agent for this invocation. If specified, overrides the harness default."
    },
    "skills": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/HarnessSkill"
      },
      "description": "The skills available to the agent for this invocation. If specified, overrides the harness default."
    },
    "allowedTools": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "The tools that the agent is allowed to use for this invocation. If specified, overrides the harness default."
    },
    "maxIterations": {
      "type": "integer",
      "description": "The maximum number of iterations the agent loop can execute. If specified, overrides the harness default."
    },
    "maxTokens": {
      "type": "integer",
      "description": "The maximum number of tokens the agent can generate per iteration. If specified, overrides the harness default."
    },
    "timeoutSeconds": {
      "type": "integer",
      "description": "The maximum duration in seconds for the agent loop execution. If specified, overrides the harness default."
    },
    "actorId": {
      "type": "string",
      "description": "The actor ID for memory operations. Overrides the actor ID configured on the harness."
    }
  },
  "required": [
    "harnessArn",
    "runtimeSessionId",
    "messages"
  ],
  "$defs": {
    "HarnessAgentCoreBrowserConfig": {
      "type": "object",
      "properties": {
        "browserArn": {
          "type": "string",
          "description": "If not populated, the built-in Browser ARN is used."
        }
      }
    },
    "HarnessAgentCoreCodeInterpreterConfig": {
      "type": "object",
      "properties": {
        "codeInterpreterArn": {
          "type": "string",
          "description": "If not populated, the built-in Code Interpreter ARN is used."
        }
      }
    },
    "HarnessAgentCoreGatewayConfig": {
      "type": "object",
      "properties": {
        "gatewayArn": {
          "type": "string",
          "description": "The ARN of the desired AgentCore Gateway."
        },
        "outboundAuth": {
          "$ref": "#/$defs/HarnessGatewayOutboundAuth"
        }
      },
      "required": [
        "gatewayArn"
      ]
    },
    "HarnessBedrockModelConfig": {
      "type": "object",
      "properties": {
        "modelId": {
          "type": "string",
          "description": "The Bedrock model ID."
        },
        "maxTokens": {
          "type": "integer",
          "description": "The maximum number of tokens to allow in the generated response per iteration."
        },
        "temperature": {
          "type": "number",
          "description": "The temperature to set when calling the model."
        },
        "topP": {
          "type": "number",
          "description": "The topP set when calling the model."
        },
        "apiFormat": {
          "type": "string",
          "enum": [
            "converse_stream",
            "responses",
            "chat_completions"
          ],
          "description": "The API format to use when calling the Bedrock provider."
        },
        "additionalParams": {
          "type": "object",
          "description": "Provider-specific parameters passed through to the model provider unchanged."
        }
      },
      "required": [
        "modelId"
      ]
    },
    "HarnessContentBlock": {
      "type": "object",
      "properties": {
        "text": {
          "type": "string",
          "description": "Text content."
        },
        "toolUse": {
          "$ref": "#/$defs/HarnessToolUseBlock"
        },
        "toolResult": {
          "$ref": "#/$defs/HarnessToolResultBlock"
        },
        "reasoningContent": {
          "$ref": "#/$defs/HarnessReasoningContentBlock"
        }
      },
      "description": "Exactly one member is set."
    },
    "HarnessGatewayOutboundAuth": {
      "type": "object",
      "properties": {
        "awsIam": {
          "type": "string",
          "description": "SigV4-sign requests using the agent's execution role."
        },
        "none": {
          "type": "string",
          "description": "No authentication."
        },
        "oauth": {
          "$ref": "#/$defs/OAuthCredentialProvider"
        }
      },
      "description": "Exactly one member is set."
    },
    "HarnessGeminiModelConfig": {
      "type": "object",
      "properties": {
        "modelId": {
          "type": "string",
          "description": "The Gemini model ID."
        },
        "apiKeyArn": {
          "type": "string",
          "description": "The ARN of your Gemini API key on AgentCore Identity."
        },
        "maxTokens": {
          "type": "integer",
          "description": "The maximum number of tokens to allow in the generated response per iteration."
        },
        "temperature": {
          "type": "number",
          "description": "The temperature to set when calling the model."
        },
        "topP": {
          "type": "number",
          "description": "The topP set when calling the model."
        },
        "topK": {
          "type": "integer",
          "description": "The topK set when calling the model."
        },
        "additionalParams": {
          "type": "object",
          "description": "Provider-specific parameters passed through to the Gemini model provider unchanged."
        }
      },
      "required": [
        "modelId",
        "apiKeyArn"
      ]
    },
    "HarnessInlineFunctionConfig": {
      "type": "object",
      "properties": {
        "description": {
          "type": "string",
          "description": "Description of what the tool does, provided to the model."
        },
        "inputSchema": {
          "type": "object",
          "description": "JSON Schema describing the tool's input parameters."
        }
      },
      "required": [
        "description",
        "inputSchema"
      ]
    },
    "HarnessLiteLlmModelConfig": {
      "type": "object",
      "properties": {
        "modelId": {
          "type": "string",
          "description": "The LiteLLM model identifier (e.g., \"anthropic/claude-3-sonnet\")."
        },
        "apiKeyArn": {
          "type": "string",
          "description": "The ARN of the API key in AgentCore Identity for authenticating with the model provider."
        },
        "apiBase": {
          "type": "string",
          "description": "The base URL for the model provider's API endpoint."
        },
        "maxTokens": {
          "type": "integer",
          "description": "The maximum number of tokens to allow in the generated response per iteration."
        },
        "temperature": {
          "type": "number",
          "description": "The temperature to set when calling the model."
        },
        "topP": {
          "type": "number",
          "description": "The topP set when calling the model."
        },
        "additionalParams": {
          "type": "object",
          "description": "Provider-specific parameters passed through to the model provider unchanged."
        }
      },
      "required": [
        "modelId"
      ]
    },
    "HarnessMessage": {
      "type": "object",
      "properties": {
        "role": {
          "type": "string",
          "enum": [
            "user",
            "assistant"
          ],
          "description": "The role of the message sender."
        },
        "content": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/HarnessContentBlock"
          },
          "description": "The content blocks of the message."
        }
      },
      "required": [
        "role",
        "content"
      ]
    },
    "HarnessModelConfiguration": {
      "type": "object",
      "properties": {
        "bedrockModelConfig": {
          "$ref": "#/$defs/HarnessBedrockModelConfig"
        },
        "openAiModelConfig": {
          "$ref": "#/$defs/HarnessOpenAiModelConfig"
        },
        "geminiModelConfig": {
          "$ref": "#/$defs/HarnessGeminiModelConfig"
        },
        "liteLlmModelConfig": {
          "$ref": "#/$defs/HarnessLiteLlmModelConfig"
        }
      },
      "description": "Exactly one member is set."
    },
    "HarnessOpenAiModelConfig": {
      "type": "object",
      "properties": {
        "modelId": {
          "type": "string",
          "description": "The OpenAI model ID."
        },
        "apiKeyArn": {
          "type": "string",
          "description": "The ARN of your OpenAI API key on AgentCore Identity."
        },
        "apiBase": {
          "type": "string",
          "description": "Optional custom endpoint URL for an OpenAI-compatible endpoint."
        },
        "maxTokens": {
          "type": "integer",
          "description": "The maximum number of tokens to allow in the generated response per iteration."
        },
        "temperature": {
          "type": "number",
          "description": "The temperature to set when calling the model."
        },
        "topP": {
          "type": "number",
          "description": "The topP set when calling the model."
        },
        "apiFormat": {
          "type": "string",
          "enum": [
            "chat_completions",
            "responses"
          ],
          "description": "The API format to use when calling the OpenAI provider."
        },
        "additionalParams": {
          "type": "object",
          "description": "Provider-specific parameters passed through to the model provider unchanged."
        }
      },
      "required": [
        "modelId",
        "apiKeyArn"
      ]
    },
    "HarnessReasoningContentBlock": {
      "type": "object",
      "properties": {
        "reasoningText": {
          "$ref": "#/$defs/HarnessReasoningTextBlock"
        },
        "redactedContent": {
          "type": "string",
          "description": "Redacted reasoning content."
        }
      },
      "description": "Exactly one member is set."
    },
    "HarnessReasoningTextBlock": {
      "type": "object",
      "properties": {
        "text": {
          "type": "string",
          "description": "The reasoning text."
        },
        "signature": {
          "type": "string",
          "description": "Signature for verifying the reasoning content."
        }
      },
      "required": [
        "text"
      ]
    },
    "HarnessRemoteMcpConfig": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "description": "URL of the MCP endpoint."
        },
        "headers": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Custom headers to include when connecting to the remote MCP server."
        }
      },
      "required": [
        "url"
      ]
    },
    "HarnessSkill": {
      "type": "object",
      "properties": {
        "path": {
          "type": "string",
          "description": "The filesystem path to the skill definition."
        },
        "s3": {
          "$ref": "#/$defs/HarnessSkillS3Source"
        },
        "git": {
          "$ref": "#/$defs/HarnessSkillGitSource"
        },
        "awsSkills": {
          "$ref": "#/$defs/HarnessSkillAwsSkillsSource"
        }
      },
      "description": "Exactly one member is set."
    },
    "HarnessSkillAwsSkillsSource": {
      "type": "object",
      "properties": {
        "paths": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Optionally filter allowed skills with glob syntax, e.g., ['core-skills/*']."
        }
      }
    },
    "HarnessSkillGitAuth": {
      "type": "object",
      "properties": {
        "credentialArn": {
          "type": "string",
          "description": "The ARN of the credential in AgentCore Identity containing the password or personal access token."
        },
        "username": {
          "type": "string",
          "description": "Username for authentication. Defaults to 'oauth2' if not specified."
        }
      },
      "required": [
        "credentialArn"
      ]
    },
    "HarnessSkillGitSource": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "description": "The HTTPS URL of the git repository."
        },
        "path": {
          "type": "string",
          "description": "Subdirectory within the repository containing the skill."
        },
        "auth": {
          "$ref": "#/$defs/HarnessSkillGitAuth"
        }
      },
      "required": [
        "url"
      ]
    },
    "HarnessSkillS3Source": {
      "type": "object",
      "properties": {
        "uri": {
          "type": "string",
          "description": "The S3 URI pointing to the skill directory (e.g., s3://bucket/skills/my-skill/)."
        }
      },
      "required": [
        "uri"
      ]
    },
    "HarnessSystemContentBlock": {
      "type": "object",
      "properties": {
        "text": {
          "type": "string",
          "description": "The text content of the system prompt block."
        }
      },
      "description": "Exactly one member is set."
    },
    "HarnessTool": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "remote_mcp",
            "agentcore_browser",
            "agentcore_gateway",
            "inline_function",
            "agentcore_code_interpreter"
          ],
          "description": "The type of tool."
        },
        "name": {
          "type": "string",
          "description": "Unique name for the tool. If not provided, a name will be inferred or generated."
        },
        "config": {
          "$ref": "#/$defs/HarnessToolConfiguration"
        }
      },
      "required": [
        "type"
      ]
    },
    "HarnessToolConfiguration": {
      "type": "object",
      "properties": {
        "remoteMcp": {
          "$ref": "#/$defs/HarnessRemoteMcpConfig"
        },
        "agentCoreBrowser": {
          "$ref": "#/$defs/HarnessAgentCoreBrowserConfig"
        },
        "agentCoreGateway": {
          "$ref": "#/$defs/HarnessAgentCoreGatewayConfig"
        },
        "inlineFunction": {
          "$ref": "#/$defs/HarnessInlineFunctionConfig"
        },
        "agentCoreCodeInterpreter": {
          "$ref": "#/$defs/HarnessAgentCoreCodeInterpreterConfig"
        }
      },
      "description": "Exactly one member is set."
    },
    "HarnessToolResultBlock": {
      "type": "object",
      "properties": {
        "toolUseId": {
          "type": "string",
          "description": "The tool use ID that this result corresponds to."
        },
        "content": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/HarnessToolResultContentBlock"
          },
          "description": "The content of the tool result."
        },
        "status": {
          "type": "string",
          "enum": [
            "success",
            "error"
          ],
          "description": "The status of the tool execution."
        },
        "type": {
          "type": "string",
          "enum": [
            "tool_use",
            "server_tool_use",
            "mcp_tool_use"
          ],
          "description": "The type of tool use that produced this result."
        }
      },
      "required": [
        "toolUseId",
        "content"
      ]
    },
    "HarnessToolResultContentBlock": {
      "type": "object",
      "properties": {
        "text": {
          "type": "string",
          "description": "Text content."
        },
        "json": {
          "type": "object",
          "description": "JSON content."
        }
      },
      "description": "Exactly one member is set."
    },
    "HarnessToolUseBlock": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the tool to call."
        },
        "toolUseId": {
          "type": "string",
          "description": "The unique ID of this tool use."
        },
        "input": {
          "type": "object",
          "description": "The JSON input to pass to the tool."
        },
        "type": {
          "type": "string",
          "enum": [
            "tool_use",
            "server_tool_use",
            "mcp_tool_use"
          ],
          "description": "The type of tool use."
        },
        "serverName": {
          "type": "string",
          "description": "The name of the MCP server providing this tool."
        }
      },
      "required": [
        "name",
        "toolUseId",
        "input"
      ]
    },
    "OAuthCredentialProvider": {
      "type": "object",
      "properties": {
        "providerArn": {
          "type": "string",
          "description": "The ARN of the OAuth 2.0 credential provider in AgentCore Identity."
        },
        "scopes": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The OAuth 2.0 scopes to request when obtaining an access token."
        },
        "customParameters": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Additional custom parameters to include in the OAuth 2.0 token request."
        },
        "grantType": {
          "type": "string",
          "enum": [
            "CLIENT_CREDENTIALS",
            "AUTHORIZATION_CODE",
            "TOKEN_EXCHANGE"
          ],
          "description": "The OAuth 2.0 grant type to use for authentication."
        },
        "defaultReturnUrl": {
          "type": "string",
          "description": "The default return URL for the OAuth 2.0 authorization flow."
        }
      },
      "required": [
        "providerArn",
        "scopes"
      ]
    }
  }
}