{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-bedrock/json-schema/amazon-bedrock-invoke-agent-request-schema.json",
  "title": "InvokeAgentRequest",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-bedrock-operations-api-openapi.yml#/components/schemas/InvokeAgentRequest",
  "type": "object",
  "properties": {
    "sessionState": {
      "$ref": "#/$defs/SessionState"
    },
    "agentId": {
      "type": "string",
      "description": "The unique identifier of the agent to use."
    },
    "agentAliasId": {
      "type": "string",
      "description": "The alias of the agent to use."
    },
    "sessionId": {
      "type": "string",
      "description": "The unique identifier of the session. Use the same value across requests to continue the same conversation."
    },
    "endSession": {
      "type": "boolean",
      "description": "Specifies whether to end the session with the agent or not."
    },
    "enableTrace": {
      "type": "boolean",
      "description": "Specifies whether to turn on the trace or not to track the agent's reasoning process. For more information, see Trace enablement."
    },
    "inputText": {
      "type": "string",
      "description": "The prompt text to send the agent. If you include returnControlInvocationResults in the sessionState field, the inputText field will be ignored."
    },
    "memoryId": {
      "type": "string",
      "description": "The unique identifier of the agent memory."
    },
    "bedrockModelConfigurations": {
      "$ref": "#/$defs/BedrockModelConfigurations"
    },
    "streamingConfigurations": {
      "$ref": "#/$defs/StreamingConfigurations"
    },
    "promptCreationConfigurations": {
      "$ref": "#/$defs/PromptCreationConfigurations"
    },
    "sourceArn": {
      "type": "string",
      "description": "The ARN of the resource making the request."
    }
  },
  "required": [
    "agentId",
    "agentAliasId",
    "sessionId"
  ],
  "$defs": {
    "ApiResult": {
      "type": "object",
      "properties": {
        "actionGroup": {
          "type": "string",
          "description": "The action group that the API operation belongs to."
        },
        "httpMethod": {
          "type": "string",
          "description": "The HTTP method for the API operation."
        },
        "apiPath": {
          "type": "string",
          "description": "The path to the API operation."
        },
        "confirmationState": {
          "type": "string",
          "enum": [
            "CONFIRM",
            "DENY"
          ],
          "description": "Controls the API operations or functions to invoke based on the user confirmation."
        },
        "responseState": {
          "type": "string",
          "enum": [
            "FAILURE",
            "REPROMPT"
          ],
          "description": "Controls the final response state returned to end user when API/Function execution failed. When this state is FAILURE, the request would fail with dependency failure exception. When this state is REPROMPT, the API/function response will be sent to model for re-prompt"
        },
        "httpStatusCode": {
          "type": "integer",
          "description": "http status code from API execution response (for example: 200, 400, 500)."
        },
        "responseBody": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/ContentBody"
          },
          "description": "The response body from the API operation. The key of the object is the content type (currently, only TEXT is supported). The response may be returned directly or from the Lambda function."
        },
        "agentId": {
          "type": "string",
          "description": "The agent's ID."
        }
      },
      "required": [
        "actionGroup"
      ]
    },
    "BedrockAgentRuntimeContentBlock": {
      "type": "object",
      "properties": {
        "text": {
          "type": "string",
          "description": "The block's text."
        }
      },
      "description": "Exactly one member is set."
    },
    "BedrockAgentRuntimeFieldForReranking": {
      "type": "object",
      "properties": {
        "fieldName": {
          "type": "string",
          "description": "The name of a metadata field to include in or exclude from consideration when reranking."
        }
      },
      "required": [
        "fieldName"
      ]
    },
    "BedrockAgentRuntimeImplicitFilterConfiguration": {
      "type": "object",
      "properties": {
        "metadataAttributes": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/BedrockAgentRuntimeMetadataAttributeSchema"
          },
          "description": "Metadata that can be used in a filter."
        },
        "modelArn": {
          "type": "string",
          "description": "The model that generates the filter."
        }
      },
      "required": [
        "metadataAttributes",
        "modelArn"
      ]
    },
    "BedrockAgentRuntimeKnowledgeBaseConfiguration": {
      "type": "object",
      "properties": {
        "knowledgeBaseId": {
          "type": "string",
          "description": "The unique identifier for a knowledge base attached to the agent."
        },
        "retrievalConfiguration": {
          "$ref": "#/$defs/BedrockAgentRuntimeKnowledgeBaseRetrievalConfiguration"
        }
      },
      "required": [
        "knowledgeBaseId",
        "retrievalConfiguration"
      ]
    },
    "BedrockAgentRuntimeKnowledgeBaseRetrievalConfiguration": {
      "type": "object",
      "properties": {
        "vectorSearchConfiguration": {
          "$ref": "#/$defs/BedrockAgentRuntimeKnowledgeBaseVectorSearchConfiguration"
        },
        "managedSearchConfiguration": {
          "$ref": "#/$defs/ManagedSearchConfiguration"
        }
      }
    },
    "BedrockAgentRuntimeKnowledgeBaseVectorSearchConfiguration": {
      "type": "object",
      "properties": {
        "numberOfResults": {
          "type": "integer",
          "description": "The number of source chunks to retrieve."
        },
        "overrideSearchType": {
          "type": "string",
          "enum": [
            "HYBRID",
            "SEMANTIC"
          ],
          "description": "By default, Amazon Bedrock decides a search strategy for you. If you're using an Amazon OpenSearch Serverless vector store that contains a filterable text field, you can specify whether to query the knowledge base with a HYBRID search using both vector embeddings and raw text, or SEMANTIC search using only vector embeddings. For other vector store configurations, only SEMANTIC search is available. For more information, see Test a knowledge base."
        },
        "filter": {
          "$ref": "#/$defs/RetrievalFilter"
        },
        "rerankingConfiguration": {
          "$ref": "#/$defs/BedrockAgentRuntimeVectorSearchRerankingConfiguration"
        },
        "implicitFilterConfiguration": {
          "$ref": "#/$defs/BedrockAgentRuntimeImplicitFilterConfiguration"
        }
      }
    },
    "BedrockAgentRuntimeMessage": {
      "type": "object",
      "properties": {
        "role": {
          "type": "string",
          "enum": [
            "user",
            "assistant"
          ],
          "description": "The message's role."
        },
        "content": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/BedrockAgentRuntimeContentBlock"
          },
          "description": "The message's content."
        }
      },
      "required": [
        "role",
        "content"
      ]
    },
    "BedrockAgentRuntimeMetadataAttributeSchema": {
      "type": "object",
      "properties": {
        "key": {
          "type": "string",
          "description": "The attribute's key."
        },
        "type": {
          "type": "string",
          "enum": [
            "STRING",
            "NUMBER",
            "BOOLEAN",
            "STRING_LIST"
          ],
          "description": "The attribute's type."
        },
        "description": {
          "type": "string",
          "description": "The attribute's description."
        }
      },
      "required": [
        "key",
        "type",
        "description"
      ]
    },
    "BedrockAgentRuntimeMetadataConfigurationForReranking": {
      "type": "object",
      "properties": {
        "selectionMode": {
          "type": "string",
          "enum": [
            "SELECTIVE",
            "ALL"
          ],
          "description": "Specifies whether to consider all metadata when reranking, or only the metadata that you select. If you specify SELECTIVE, include the selectiveModeConfiguration field."
        },
        "selectiveModeConfiguration": {
          "$ref": "#/$defs/BedrockAgentRuntimeRerankingMetadataSelectiveModeConfiguration"
        }
      },
      "required": [
        "selectionMode"
      ]
    },
    "BedrockAgentRuntimePerformanceConfiguration": {
      "type": "object",
      "properties": {
        "latency": {
          "type": "string",
          "enum": [
            "standard",
            "optimized"
          ],
          "description": "To use a latency-optimized version of the model, set to optimized."
        }
      }
    },
    "BedrockAgentRuntimeRerankingMetadataSelectiveModeConfiguration": {
      "type": "object",
      "properties": {
        "fieldsToInclude": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/BedrockAgentRuntimeFieldForReranking"
          },
          "description": "An array of objects, each of which specifies a metadata field to include in consideration when reranking. The remaining metadata fields are ignored."
        },
        "fieldsToExclude": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/BedrockAgentRuntimeFieldForReranking"
          },
          "description": "An array of objects, each of which specifies a metadata field to exclude from consideration when reranking."
        }
      },
      "description": "Exactly one member is set."
    },
    "BedrockAgentRuntimeVectorSearchBedrockRerankingConfiguration": {
      "type": "object",
      "properties": {
        "modelConfiguration": {
          "$ref": "#/$defs/BedrockAgentRuntimeVectorSearchBedrockRerankingModelConfiguration"
        },
        "numberOfRerankedResults": {
          "type": "integer",
          "description": "The number of results to return after reranking."
        },
        "metadataConfiguration": {
          "$ref": "#/$defs/BedrockAgentRuntimeMetadataConfigurationForReranking"
        }
      },
      "required": [
        "modelConfiguration"
      ]
    },
    "BedrockAgentRuntimeVectorSearchBedrockRerankingModelConfiguration": {
      "type": "object",
      "properties": {
        "modelArn": {
          "type": "string",
          "description": "The ARN of the reranker model to use."
        },
        "additionalModelRequestFields": {
          "type": "object",
          "additionalProperties": {
            "type": "object"
          },
          "description": "A JSON object whose keys are request fields for the model and whose values are values for those fields."
        }
      },
      "required": [
        "modelArn"
      ]
    },
    "BedrockAgentRuntimeVectorSearchRerankingConfiguration": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "BEDROCK_RERANKING_MODEL"
          ],
          "description": "The type of reranker model."
        },
        "bedrockRerankingConfiguration": {
          "$ref": "#/$defs/BedrockAgentRuntimeVectorSearchBedrockRerankingConfiguration"
        }
      },
      "required": [
        "type"
      ]
    },
    "BedrockModelConfigurations": {
      "type": "object",
      "properties": {
        "performanceConfig": {
          "$ref": "#/$defs/BedrockAgentRuntimePerformanceConfiguration"
        }
      }
    },
    "ByteContentFile": {
      "type": "object",
      "properties": {
        "mediaType": {
          "type": "string",
          "description": "The MIME type of data contained in the file used for chat."
        },
        "data": {
          "type": "string",
          "format": "byte",
          "description": "The raw bytes of the file to attach. The maximum size of all files that is attached is 10MB. You can attach a maximum of 5 files."
        }
      },
      "required": [
        "mediaType",
        "data"
      ]
    },
    "ContentBody": {
      "type": "object",
      "properties": {
        "body": {
          "type": "string",
          "description": "The body of the API response."
        },
        "images": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ImageInput"
          },
          "description": "Lists details, including format and source, for the image in the response from the function call. You can specify only one image and the function in the returnControlInvocationResults must be a computer use action. For more information, see Configure an Amazon Bedrock Agent to complete tasks with computer use tools."
        }
      }
    },
    "ConversationHistory": {
      "type": "object",
      "properties": {
        "messages": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/BedrockAgentRuntimeMessage"
          },
          "description": "The conversation's messages."
        }
      }
    },
    "FileSource": {
      "type": "object",
      "properties": {
        "sourceType": {
          "type": "string",
          "enum": [
            "S3",
            "BYTE_CONTENT"
          ],
          "description": "The source type of the files to attach."
        },
        "s3Location": {
          "$ref": "#/$defs/S3ObjectFile"
        },
        "byteContent": {
          "$ref": "#/$defs/ByteContentFile"
        }
      },
      "required": [
        "sourceType"
      ]
    },
    "FilterAttribute": {
      "type": "object",
      "properties": {
        "key": {
          "type": "string",
          "description": "The name of metadata attribute/field, which must match the name in your data source/document metadata."
        },
        "value": {
          "type": "object",
          "description": "The value of the metadata attribute/field."
        }
      },
      "required": [
        "key",
        "value"
      ]
    },
    "FunctionResult": {
      "type": "object",
      "properties": {
        "actionGroup": {
          "type": "string",
          "description": "The action group that the function belongs to."
        },
        "confirmationState": {
          "type": "string",
          "enum": [
            "CONFIRM",
            "DENY"
          ],
          "description": "Contains the user confirmation information about the function that was called."
        },
        "function": {
          "type": "string",
          "description": "The name of the function that was called."
        },
        "responseBody": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/ContentBody"
          },
          "description": "The response from the function call using the parameters. The response might be returned directly or from the Lambda function. Specify TEXT or IMAGES. The key of the object is the content type. You can only specify one type. If you specify IMAGES, you can specify only one image. You can specify images only when the function in the returnControlInvocationResults is a computer use action. For more information, see Configure an Amazon Bedrock Agent to complete tasks with computer use tools."
        },
        "responseState": {
          "type": "string",
          "enum": [
            "FAILURE",
            "REPROMPT"
          ],
          "description": "Controls the final response state returned to end user when API/Function execution failed. When this state is FAILURE, the request would fail with dependency failure exception. When this state is REPROMPT, the API/function response will be sent to model for re-prompt"
        },
        "agentId": {
          "type": "string",
          "description": "The agent's ID."
        }
      },
      "required": [
        "actionGroup"
      ]
    },
    "ImageInput": {
      "type": "object",
      "properties": {
        "format": {
          "type": "string",
          "enum": [
            "png",
            "jpeg",
            "gif",
            "webp"
          ],
          "description": "The type of image in the result."
        },
        "source": {
          "$ref": "#/$defs/ImageInputSource"
        }
      },
      "required": [
        "format",
        "source"
      ]
    },
    "ImageInputSource": {
      "type": "object",
      "properties": {
        "bytes": {
          "type": "string",
          "description": "The raw image bytes for the image. If you use an Amazon Web Services SDK, you don't need to encode the image bytes in base64."
        }
      },
      "description": "Exactly one member is set."
    },
    "InputFile": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the source file."
        },
        "source": {
          "$ref": "#/$defs/FileSource"
        },
        "useCase": {
          "type": "string",
          "enum": [
            "CODE_INTERPRETER",
            "CHAT"
          ],
          "description": "Specifies how the source files will be used by the code interpreter."
        }
      },
      "required": [
        "name",
        "source",
        "useCase"
      ]
    },
    "InvocationResultMember": {
      "type": "object",
      "properties": {
        "apiResult": {
          "$ref": "#/$defs/ApiResult"
        },
        "functionResult": {
          "$ref": "#/$defs/FunctionResult"
        }
      },
      "description": "Exactly one member is set."
    },
    "ManagedSearchBedrockRerankingConfiguration": {
      "type": "object",
      "properties": {
        "modelConfiguration": {
          "$ref": "#/$defs/ManagedSearchBedrockRerankingModelConfiguration"
        },
        "numberOfRerankedResults": {
          "type": "integer",
          "description": "The number of results to return after reranking."
        },
        "metadataConfiguration": {
          "$ref": "#/$defs/BedrockAgentRuntimeMetadataConfigurationForReranking"
        }
      },
      "required": [
        "modelConfiguration"
      ]
    },
    "ManagedSearchBedrockRerankingModelConfiguration": {
      "type": "object",
      "properties": {
        "modelArn": {
          "type": "string",
          "description": "The ARN of the Bedrock reranking model."
        },
        "additionalModelRequestFields": {
          "type": "object",
          "additionalProperties": {
            "type": "object"
          },
          "description": "Additional request fields to pass to the reranking model."
        }
      },
      "required": [
        "modelArn"
      ]
    },
    "ManagedSearchConfiguration": {
      "type": "object",
      "properties": {
        "numberOfResults": {
          "type": "integer",
          "description": "The number of results to retrieve."
        },
        "filter": {
          "$ref": "#/$defs/RetrievalFilter"
        },
        "rerankingModelType": {
          "type": "string",
          "enum": [
            "CUSTOM",
            "MANAGED",
            "NONE"
          ],
          "description": "The type of reranking model to use when reranking results retrieved from the managed search. Use CUSTOM to specify a model, MANAGED to use the service default, or NONE to disable reranking."
        },
        "rerankingConfiguration": {
          "$ref": "#/$defs/ManagedSearchRerankingConfiguration"
        }
      }
    },
    "ManagedSearchRerankingConfiguration": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "BEDROCK_RERANKING_MODEL"
          ],
          "description": "The type of reranking configuration."
        },
        "bedrockRerankingConfiguration": {
          "$ref": "#/$defs/ManagedSearchBedrockRerankingConfiguration"
        }
      },
      "required": [
        "type"
      ]
    },
    "PromptCreationConfigurations": {
      "type": "object",
      "properties": {
        "previousConversationTurnsToInclude": {
          "type": "integer",
          "description": "The number of previous conversations from the ongoing agent session to include in the conversation history of the agent prompt, during the current invocation. This gives you more granular control over the context that the model is made aware of, and helps the model remove older context which is no longer useful during the ongoing agent session."
        },
        "excludePreviousThinkingSteps": {
          "type": "boolean",
          "description": "If true, the service removes any content between &lt;thinking&gt; tags from previous conversations in an agent session. The service will only remove content from already processed turns. This helps you remove content which might not be useful for current and subsequent invocations. This can reduce the input token count and potentially save costs. The default value is false."
        }
      }
    },
    "RetrievalFilter": {
      "type": "object",
      "properties": {
        "equals": {
          "$ref": "#/$defs/FilterAttribute"
        },
        "notEquals": {
          "$ref": "#/$defs/FilterAttribute"
        },
        "greaterThan": {
          "$ref": "#/$defs/FilterAttribute"
        },
        "greaterThanOrEquals": {
          "$ref": "#/$defs/FilterAttribute"
        },
        "lessThan": {
          "$ref": "#/$defs/FilterAttribute"
        },
        "lessThanOrEquals": {
          "$ref": "#/$defs/FilterAttribute"
        },
        "in": {
          "$ref": "#/$defs/FilterAttribute"
        },
        "notIn": {
          "$ref": "#/$defs/FilterAttribute"
        },
        "startsWith": {
          "$ref": "#/$defs/FilterAttribute"
        },
        "listContains": {
          "$ref": "#/$defs/FilterAttribute"
        },
        "stringContains": {
          "$ref": "#/$defs/FilterAttribute"
        },
        "andAll": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RetrievalFilter"
          },
          "description": "Knowledge base data sources are returned if their metadata attributes fulfill all the filter conditions inside this list."
        },
        "orAll": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RetrievalFilter"
          },
          "description": "Knowledge base data sources are returned if their metadata attributes fulfill at least one of the filter conditions inside this list."
        }
      },
      "description": "Exactly one member is set."
    },
    "S3ObjectFile": {
      "type": "object",
      "properties": {
        "uri": {
          "type": "string",
          "description": "The uri of the s3 object."
        }
      },
      "required": [
        "uri"
      ]
    },
    "SessionState": {
      "type": "object",
      "properties": {
        "sessionAttributes": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Contains attributes that persist across a session and the values of those attributes. If sessionAttributes are passed to a supervisor agent in multi-agent collaboration, it will be forwarded to all agent collaborators."
        },
        "promptSessionAttributes": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Contains attributes that persist across a prompt and the values of those attributes. In orchestration prompt template, these attributes replace the $prompt_session_attributes$ placeholder variable. For more information, see Prompt template placeholder variables. In multi-agent collaboration, the promptSessionAttributes will only be used by supervisor agent when $prompt_session_attributes$ is present in prompt template."
        },
        "returnControlInvocationResults": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/InvocationResultMember"
          },
          "description": "Contains information about the results from the action group invocation. For more information, see Return control to the agent developer and Control session context. If you include this field, the inputText field will be ignored."
        },
        "invocationId": {
          "type": "string",
          "description": "The identifier of the invocation of an action. This value must match the invocationId returned in the InvokeAgent response for the action whose results are provided in the returnControlInvocationResults field. For more information, see Return control to the agent developer and Control session context."
        },
        "files": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/InputFile"
          },
          "description": "Contains information about the files used by code interpreter."
        },
        "knowledgeBaseConfigurations": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/BedrockAgentRuntimeKnowledgeBaseConfiguration"
          },
          "description": "An array of configurations, each of which applies to a knowledge base attached to the agent."
        },
        "conversationHistory": {
          "$ref": "#/$defs/ConversationHistory"
        }
      }
    },
    "StreamingConfigurations": {
      "type": "object",
      "properties": {
        "streamFinalResponse": {
          "type": "boolean",
          "description": "Specifies whether to enable streaming for the final response. This is set to false by default."
        },
        "applyGuardrailInterval": {
          "type": "integer",
          "description": "The guardrail interval to apply as response is generated. By default, the guardrail interval is set to 50 characters. If a larger interval is specified, the response will be generated in larger chunks with fewer ApplyGuardrail calls. The following examples show the response generated for Hello, I am an agent input string. Example response in chunks: Interval set to 3 characters 'Hel', 'lo, ','I am', ' an', ' Age', 'nt' Each chunk has at least 3 characters except for the last chunk Example response in chunks: Interval set to 20 or more characters Hello, I am an Agent"
        }
      }
    }
  }
}