AgentsforBedrockRuntime / Client / invoke_agent
invoke_agent¶
- AgentsforBedrockRuntime.Client.invoke_agent(**kwargs)¶
- Sends a prompt for the agent to process and respond to. Note the following fields for the request: - To continue the same conversation with an agent, use the same - sessionIdvalue in the request.
- To activate trace enablement, turn - enableTraceto- true. Trace enablement helps you follow the agent’s reasoning process that led it to the information it processed, the actions it took, and the final result it yielded. For more information, see Trace enablement.
- End a conversation by setting - endSessionto- true.
- In the - sessionStateobject, you can include attributes for the session or prompt or, if you configured an action group to return control, results from invocation of the action group.
 - The response contains both chunk and trace attributes. - The final response is returned in the - bytesfield of the- chunkobject. The- InvokeAgentreturns one chunk for the entire interaction.- The - attributionobject contains citations for parts of the response.
- If you set - enableTraceto- truein the request, you can trace the agent’s steps and reasoning process that led it to the response.
- If the action predicted was configured to return control, the response returns parameters for the action, elicited from the user, in the - returnControlfield.
- Errors are also surfaced in the response. 
 - See also: AWS API Documentation - Request Syntax- response = client.invoke_agent( sessionState={ 'sessionAttributes': { 'string': 'string' }, 'promptSessionAttributes': { 'string': 'string' }, 'returnControlInvocationResults': [ { 'apiResult': { 'actionGroup': 'string', 'httpMethod': 'string', 'apiPath': 'string', 'confirmationState': 'CONFIRM'|'DENY', 'responseState': 'FAILURE'|'REPROMPT', 'httpStatusCode': 123, 'responseBody': { 'string': { 'body': 'string', 'images': [ { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes' } }, ] } }, 'agentId': 'string' }, 'functionResult': { 'actionGroup': 'string', 'confirmationState': 'CONFIRM'|'DENY', 'function': 'string', 'responseBody': { 'string': { 'body': 'string', 'images': [ { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes' } }, ] } }, 'responseState': 'FAILURE'|'REPROMPT', 'agentId': 'string' } }, ], 'invocationId': 'string', 'files': [ { 'name': 'string', 'source': { 'sourceType': 'S3'|'BYTE_CONTENT', 's3Location': { 'uri': 'string' }, 'byteContent': { 'mediaType': 'string', 'data': b'bytes' } }, 'useCase': 'CODE_INTERPRETER'|'CHAT' }, ], 'knowledgeBaseConfigurations': [ { 'knowledgeBaseId': 'string', 'retrievalConfiguration': { 'vectorSearchConfiguration': { 'numberOfResults': 123, 'overrideSearchType': 'HYBRID'|'SEMANTIC', 'filter': { 'equals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'notEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'greaterThan': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'greaterThanOrEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'lessThan': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'lessThanOrEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'in': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'notIn': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'startsWith': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'listContains': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'stringContains': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'andAll': [ {'... recursive ...'}, ], 'orAll': [ {'... recursive ...'}, ] }, 'rerankingConfiguration': { 'type': 'BEDROCK_RERANKING_MODEL', 'bedrockRerankingConfiguration': { 'modelConfiguration': { 'modelArn': 'string', 'additionalModelRequestFields': { 'string': {...}|[...]|123|123.4|'string'|True|None } }, 'numberOfRerankedResults': 123, 'metadataConfiguration': { 'selectionMode': 'SELECTIVE'|'ALL', 'selectiveModeConfiguration': { 'fieldsToInclude': [ { 'fieldName': 'string' }, ], 'fieldsToExclude': [ { 'fieldName': 'string' }, ] } } } }, 'implicitFilterConfiguration': { 'metadataAttributes': [ { 'key': 'string', 'type': 'STRING'|'NUMBER'|'BOOLEAN'|'STRING_LIST', 'description': 'string' }, ], 'modelArn': 'string' } } } }, ], 'conversationHistory': { 'messages': [ { 'role': 'user'|'assistant', 'content': [ { 'text': 'string' }, ] }, ] } }, agentId='string', agentAliasId='string', sessionId='string', endSession=True|False, enableTrace=True|False, inputText='string', memoryId='string', bedrockModelConfigurations={ 'performanceConfig': { 'latency': 'standard'|'optimized' } }, streamingConfigurations={ 'streamFinalResponse': True|False, 'applyGuardrailInterval': 123 }, promptCreationConfigurations={ 'previousConversationTurnsToInclude': 123, 'excludePreviousThinkingSteps': True|False }, sourceArn='string' ) - Parameters:
- sessionState (dict) – - Contains parameters that specify various attributes of the session. For more information, see Control session context. - Note- If you include - returnControlInvocationResultsin the- sessionStatefield, the- inputTextfield will be ignored.- sessionAttributes (dict) – - Contains attributes that persist across a session and the values of those attributes. If - sessionAttributesare passed to a supervisor agent in multi-agent collaboration, it will be forwarded to all agent collaborators.- (string) – - (string) – 
 
 
- promptSessionAttributes (dict) – - 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 - promptSessionAttributeswill only be used by supervisor agent when $prompt_session_attributes$ is present in prompt template.
 - (string) – - (string) – 
 
 
- returnControlInvocationResults (list) – - Contains information about the results from the action group invocation. For more information, see Return control to the agent developer and Control session context. - Note- If you include this field, the - inputTextfield will be ignored.- (dict) – - A result from the invocation of an action. For more information, see Return control to the agent developer and Control session context. - This data type is used in the following API operations: - Note- This is a Tagged Union structure. Only one of the following top level keys can be set: - apiResult,- functionResult.- apiResult (dict) – - The result from the API response from the action group invocation. - actionGroup (string) – [REQUIRED] - The action group that the API operation belongs to. 
- httpMethod (string) – - The HTTP method for the API operation. 
- apiPath (string) – - The path to the API operation. 
- confirmationState (string) – - Controls the API operations or functions to invoke based on the user confirmation. 
- responseState (string) – - 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 (integer) – - http status code from API execution response (for example: 200, 400, 500). 
- responseBody (dict) – - The response body from the API operation. The key of the object is the content type (currently, only - TEXTis supported). The response may be returned directly or from the Lambda function.- (string) – - (dict) – - Contains the body of the API response. - This data type is used in the following API operations: - In the - returnControlInvocationResultsfield of the InvokeAgent request
 - body (string) – - The body of the API response. 
- images (list) – - 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 - returnControlInvocationResultsmust be a computer use action. For more information, see Configure an Amazon Bedrock Agent to complete tasks with computer use tools.- (dict) – - Details about an image in the result from a function in the action group invocation. You can specify images only when the function is a computer use action. For more information, see Configure an Amazon Bedrock Agent to complete tasks with computer use tools. - format (string) – [REQUIRED] - The type of image in the result. 
- source (dict) – [REQUIRED] - The source of the image in the result. - Note- This is a Tagged Union structure. Only one of the following top level keys can be set: - bytes.- bytes (bytes) – - 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. 
 
 
 
 
 
 
- agentId (string) – - The agent’s ID. 
 
- functionResult (dict) – - The result from the function from the action group invocation. - actionGroup (string) – [REQUIRED] - The action group that the function belongs to. 
- confirmationState (string) – - Contains the user confirmation information about the function that was called. 
- function (string) – - The name of the function that was called. 
- responseBody (dict) – - The response from the function call using the parameters. The response might be returned directly or from the Lambda function. Specify - TEXTor- 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- returnControlInvocationResultsis a computer use action. For more information, see Configure an Amazon Bedrock Agent to complete tasks with computer use tools.- (string) – - (dict) – - Contains the body of the API response. - This data type is used in the following API operations: - In the - returnControlInvocationResultsfield of the InvokeAgent request
 - body (string) – - The body of the API response. 
- images (list) – - 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 - returnControlInvocationResultsmust be a computer use action. For more information, see Configure an Amazon Bedrock Agent to complete tasks with computer use tools.- (dict) – - Details about an image in the result from a function in the action group invocation. You can specify images only when the function is a computer use action. For more information, see Configure an Amazon Bedrock Agent to complete tasks with computer use tools. - format (string) – [REQUIRED] - The type of image in the result. 
- source (dict) – [REQUIRED] - The source of the image in the result. - Note- This is a Tagged Union structure. Only one of the following top level keys can be set: - bytes.- bytes (bytes) – - 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. 
 
 
 
 
 
 
- responseState (string) – - 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 (string) – - The agent’s ID. 
 
 
 
- invocationId (string) – - The identifier of the invocation of an action. This value must match the - invocationIdreturned in the- InvokeAgentresponse for the action whose results are provided in the- returnControlInvocationResultsfield. For more information, see Return control to the agent developer and Control session context.
- files (list) – - Contains information about the files used by code interpreter. - (dict) – - Contains details of the source files. - name (string) – [REQUIRED] - The name of the source file. 
- source (dict) – [REQUIRED] - Specifies where the files are located. - sourceType (string) – [REQUIRED] - The source type of the files to attach. 
- s3Location (dict) – - The s3 location of the files to attach. - uri (string) – [REQUIRED] - The uri of the s3 object. 
 
- byteContent (dict) – - The data and the text of the attached files. - mediaType (string) – [REQUIRED] - The MIME type of data contained in the file used for chat. 
- data (bytes) – [REQUIRED] - 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. 
 
 
- useCase (string) – [REQUIRED] - Specifies how the source files will be used by the code interpreter. 
 
 
- knowledgeBaseConfigurations (list) – - An array of configurations, each of which applies to a knowledge base attached to the agent. - (dict) – - Configurations to apply to a knowledge base attached to the agent during query. For more information, see Knowledge base retrieval configurations. - knowledgeBaseId (string) – [REQUIRED] - The unique identifier for a knowledge base attached to the agent. 
- retrievalConfiguration (dict) – [REQUIRED] - The configurations to apply to the knowledge base during query. For more information, see Query configurations. - vectorSearchConfiguration (dict) – [REQUIRED] - Contains details about how the results from the vector search should be returned. For more information, see Query configurations. - numberOfResults (integer) – - The number of source chunks to retrieve. 
- overrideSearchType (string) – - 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 - HYBRIDsearch using both vector embeddings and raw text, or- SEMANTICsearch using only vector embeddings. For other vector store configurations, only- SEMANTICsearch is available. For more information, see Test a knowledge base.
- filter (dict) – - Specifies the filters to use on the metadata in the knowledge base data sources before returning results. For more information, see Query configurations. - Note- This is a Tagged Union structure. Only one of the following top level keys can be set: - equals,- notEquals,- greaterThan,- greaterThanOrEquals,- lessThan,- lessThanOrEquals,- in,- notIn,- startsWith,- listContains,- stringContains,- andAll,- orAll.- equals (dict) – - Knowledge base data sources are returned if they contain a metadata attribute whose name matches the - keyand whose value matches the- valuein this object.- The following example would return data sources with an - animalattribute whose value is- cat:- "equals": { "key": "animal", "value": "cat" }- key (string) – [REQUIRED] - The name that the metadata attribute must match. 
- value (document) – [REQUIRED] - The value to whcih to compare the value of the metadata attribute. 
 
- notEquals (dict) – - Knowledge base data sources are returned when: - It contains a metadata attribute whose name matches the - keyand whose value doesn’t match the- valuein this object.
- The key is not present in the document. 
 - The following example would return data sources that don’t contain an - animalattribute whose value is- cat.- "notEquals": { "key": "animal", "value": "cat" }- key (string) – [REQUIRED] - The name that the metadata attribute must match. 
- value (document) – [REQUIRED] - The value to whcih to compare the value of the metadata attribute. 
 
- greaterThan (dict) – - Knowledge base data sources are returned if they contain a metadata attribute whose name matches the - keyand whose value is greater than the- valuein this object.- The following example would return data sources with an - yearattribute whose value is greater than- 1989:- "greaterThan": { "key": "year", "value": 1989 }- key (string) – [REQUIRED] - The name that the metadata attribute must match. 
- value (document) – [REQUIRED] - The value to whcih to compare the value of the metadata attribute. 
 
- greaterThanOrEquals (dict) – - Knowledge base data sources are returned if they contain a metadata attribute whose name matches the - keyand whose value is greater than or equal to the- valuein this object.- The following example would return data sources with an - yearattribute whose value is greater than or equal to- 1989:- "greaterThanOrEquals": { "key": "year", "value": 1989 }- key (string) – [REQUIRED] - The name that the metadata attribute must match. 
- value (document) – [REQUIRED] - The value to whcih to compare the value of the metadata attribute. 
 
- lessThan (dict) – - Knowledge base data sources are returned if they contain a metadata attribute whose name matches the - keyand whose value is less than the- valuein this object.- The following example would return data sources with an - yearattribute whose value is less than to- 1989.- "lessThan": { "key": "year", "value": 1989 }- key (string) – [REQUIRED] - The name that the metadata attribute must match. 
- value (document) – [REQUIRED] - The value to whcih to compare the value of the metadata attribute. 
 
- lessThanOrEquals (dict) – - Knowledge base data sources are returned if they contain a metadata attribute whose name matches the - keyand whose value is less than or equal to the- valuein this object.- The following example would return data sources with an - yearattribute whose value is less than or equal to- 1989.- "lessThanOrEquals": { "key": "year", "value": 1989 }- key (string) – [REQUIRED] - The name that the metadata attribute must match. 
- value (document) – [REQUIRED] - The value to whcih to compare the value of the metadata attribute. 
 
- in (dict) – - Knowledge base data sources are returned if they contain a metadata attribute whose name matches the - keyand whose value is in the list specified in the- valuein this object.- The following example would return data sources with an - animalattribute that is either- cator- dog:- "in": { "key": "animal", "value": ["cat", "dog"] }- key (string) – [REQUIRED] - The name that the metadata attribute must match. 
- value (document) – [REQUIRED] - The value to whcih to compare the value of the metadata attribute. 
 
- notIn (dict) – - Knowledge base data sources are returned if they contain a metadata attribute whose name matches the - keyand whose value isn’t in the list specified in the- valuein this object.- The following example would return data sources whose - animalattribute is neither- catnor- dog.- "notIn": { "key": "animal", "value": ["cat", "dog"] }- key (string) – [REQUIRED] - The name that the metadata attribute must match. 
- value (document) – [REQUIRED] - The value to whcih to compare the value of the metadata attribute. 
 
- startsWith (dict) – - Knowledge base data sources are returned if they contain a metadata attribute whose name matches the - keyand whose value starts with the- valuein this object. This filter is currently only supported for Amazon OpenSearch Serverless vector stores.- The following example would return data sources with an - animalattribute starts with- ca(for example,- cator- camel).- "startsWith": { "key": "animal", "value": "ca" }- key (string) – [REQUIRED] - The name that the metadata attribute must match. 
- value (document) – [REQUIRED] - The value to whcih to compare the value of the metadata attribute. 
 
- listContains (dict) – - Knowledge base data sources are returned if they contain a metadata attribute whose name matches the - keyand whose value is a list that contains the- valueas one of its members.- The following example would return data sources with an - animalsattribute that is a list containing a- catmember (for example- ["dog", "cat"]).- "listContains": { "key": "animals", "value": "cat" }- key (string) – [REQUIRED] - The name that the metadata attribute must match. 
- value (document) – [REQUIRED] - The value to whcih to compare the value of the metadata attribute. 
 
- stringContains (dict) – - Knowledge base data sources are returned if they contain a metadata attribute whose name matches the - keyand whose value is one of the following:- A string that contains the - valueas a substring. The following example would return data sources with an- animalattribute that contains the substring- at(for example- cat).- "stringContains": { "key": "animal", "value": "at" }
- A list with a member that contains the - valueas a substring. The following example would return data sources with an- animalsattribute that is a list containing a member that contains the substring- at(for example- ["dog", "cat"]).- "stringContains": { "key": "animals", "value": "at" }
 - key (string) – [REQUIRED] - The name that the metadata attribute must match. 
- value (document) – [REQUIRED] - The value to whcih to compare the value of the metadata attribute. 
 
- andAll (list) – - Knowledge base data sources are returned if their metadata attributes fulfill all the filter conditions inside this list. - (dict) – - Specifies the filters to use on the metadata attributes in the knowledge base data sources before returning results. For more information, see Query configurations. See the examples below to see how to use these filters. - This data type is used in the following API operations: - Retrieve request – in the - filterfield
- RetrieveAndGenerate request – in the - filterfield
 - Note- This is a Tagged Union structure. Only one of the following top level keys can be set: - equals,- notEquals,- greaterThan,- greaterThanOrEquals,- lessThan,- lessThanOrEquals,- in,- notIn,- startsWith,- listContains,- stringContains,- andAll,- orAll.
 
- orAll (list) – - Knowledge base data sources are returned if their metadata attributes fulfill at least one of the filter conditions inside this list. - (dict) – - Specifies the filters to use on the metadata attributes in the knowledge base data sources before returning results. For more information, see Query configurations. See the examples below to see how to use these filters. - This data type is used in the following API operations: - Retrieve request – in the - filterfield
- RetrieveAndGenerate request – in the - filterfield
 - Note- This is a Tagged Union structure. Only one of the following top level keys can be set: - equals,- notEquals,- greaterThan,- greaterThanOrEquals,- lessThan,- lessThanOrEquals,- in,- notIn,- startsWith,- listContains,- stringContains,- andAll,- orAll.
 
 
- rerankingConfiguration (dict) – - Contains configurations for reranking the retrieved results. For more information, see Improve the relevance of query responses with a reranker model. - type (string) – [REQUIRED] - The type of reranker model. 
- bedrockRerankingConfiguration (dict) – - Contains configurations for an Amazon Bedrock reranker model. - modelConfiguration (dict) – [REQUIRED] - Contains configurations for the reranker model. - modelArn (string) – [REQUIRED] - The ARN of the reranker model to use. 
- additionalModelRequestFields (dict) – - A JSON object whose keys are request fields for the model and whose values are values for those fields. - (string) – - (document) – 
 
 
 
- numberOfRerankedResults (integer) – - The number of results to return after reranking. 
- metadataConfiguration (dict) – - Contains configurations for the metadata to use in reranking. - selectionMode (string) – [REQUIRED] - Specifies whether to consider all metadata when reranking, or only the metadata that you select. If you specify - SELECTIVE, include the- selectiveModeConfigurationfield.
- selectiveModeConfiguration (dict) – - Contains configurations for the metadata fields to include or exclude when considering reranking. - Note- This is a Tagged Union structure. Only one of the following top level keys can be set: - fieldsToInclude,- fieldsToExclude.- fieldsToInclude (list) – - An array of objects, each of which specifies a metadata field to include in consideration when reranking. The remaining metadata fields are ignored. - (dict) – - Contains information for a metadata field to include in or exclude from consideration when reranking. - fieldName (string) – [REQUIRED] - The name of a metadata field to include in or exclude from consideration when reranking. 
 
 
- fieldsToExclude (list) – - An array of objects, each of which specifies a metadata field to exclude from consideration when reranking. - (dict) – - Contains information for a metadata field to include in or exclude from consideration when reranking. - fieldName (string) – [REQUIRED] - The name of a metadata field to include in or exclude from consideration when reranking. 
 
 
 
 
 
 
- implicitFilterConfiguration (dict) – - Settings for implicit filtering. - metadataAttributes (list) – [REQUIRED] - Metadata that can be used in a filter. - (dict) – - Details about a metadata attribute. - key (string) – [REQUIRED] - The attribute’s key. 
- type (string) – [REQUIRED] - The attribute’s type. 
- description (string) – [REQUIRED] - The attribute’s description. 
 
 
- modelArn (string) – [REQUIRED] - The model that generates the filter. 
 
 
 
 
 
- conversationHistory (dict) – - The state’s conversation history. - messages (list) – - The conversation’s messages. - (dict) – - Details about a message. - role (string) – [REQUIRED] - The message’s role. 
- content (list) – [REQUIRED] - The message’s content. - (dict) – - A content block. - Note- This is a Tagged Union structure. Only one of the following top level keys can be set: - text.- text (string) – - The block’s text. 
 
 
 
 
 
 
- agentId (string) – - [REQUIRED] - The unique identifier of the agent to use. 
- agentAliasId (string) – - [REQUIRED] - The alias of the agent to use. 
- sessionId (string) – - [REQUIRED] - The unique identifier of the session. Use the same value across requests to continue the same conversation. 
- endSession (boolean) – Specifies whether to end the session with the agent or not. 
- enableTrace (boolean) – Specifies whether to turn on the trace or not to track the agent’s reasoning process. For more information, see Trace enablement. 
- inputText (string) – - The prompt text to send the agent. - Note- If you include - returnControlInvocationResultsin the- sessionStatefield, the- inputTextfield will be ignored.
- memoryId (string) – The unique identifier of the agent memory. 
- bedrockModelConfigurations (dict) – - Model performance settings for the request. - performanceConfig (dict) – - The performance configuration for the model. - latency (string) – - To use a latency-optimized version of the model, set to - optimized.
 
 
- streamingConfigurations (dict) – - Specifies the configurations for streaming. - Note- To use agent streaming, you need permissions to perform the - bedrock:InvokeModelWithResponseStreamaction.- streamFinalResponse (boolean) – - Specifies whether to enable streaming for the final response. This is set to - falseby default.
- applyGuardrailInterval (integer) – - 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 - ApplyGuardrailcalls. 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
 
- promptCreationConfigurations (dict) – - Specifies parameters that control how the service populates the agent prompt for an - InvokeAgentrequest. You can control which aspects of previous invocations in the same agent session the service uses to populate the agent prompt. This gives you more granular control over the contextual history that is used to process the current request.- previousConversationTurnsToInclude (integer) – - 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 (boolean) – - If - true, the service removes any content between- <thinking>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.
 
- sourceArn (string) – The ARN of the resource making the request. 
 
- Return type:
- dict 
- Returns:
- The response of this operation contains an - EventStreammember. When iterated the- EventStreamwill yield events based on the structure below, where only one of the top level keys will be present for any given event.- Response Syntax- { 'completion': EventStream({ 'chunk': { 'bytes': b'bytes', 'attribution': { 'citations': [ { 'generatedResponsePart': { 'textResponsePart': { 'text': 'string', 'span': { 'start': 123, 'end': 123 } } }, 'retrievedReferences': [ { 'content': { 'type': 'TEXT'|'IMAGE'|'ROW', 'text': 'string', 'byteContent': 'string', 'row': [ { 'columnName': 'string', 'columnValue': 'string', 'type': 'BLOB'|'BOOLEAN'|'DOUBLE'|'NULL'|'LONG'|'STRING' }, ] }, 'location': { 'type': 'S3'|'WEB'|'CONFLUENCE'|'SALESFORCE'|'SHAREPOINT'|'CUSTOM'|'KENDRA'|'SQL', 's3Location': { 'uri': 'string' }, 'webLocation': { 'url': 'string' }, 'confluenceLocation': { 'url': 'string' }, 'salesforceLocation': { 'url': 'string' }, 'sharePointLocation': { 'url': 'string' }, 'customDocumentLocation': { 'id': 'string' }, 'kendraDocumentLocation': { 'uri': 'string' }, 'sqlLocation': { 'query': 'string' } }, 'metadata': { 'string': {...}|[...]|123|123.4|'string'|True|None } }, ] }, ] } }, 'trace': { 'sessionId': 'string', 'trace': { 'guardrailTrace': { 'action': 'INTERVENED'|'NONE', 'traceId': 'string', 'inputAssessments': [ { 'topicPolicy': { 'topics': [ { 'name': 'string', 'type': 'DENY', 'action': 'BLOCKED' }, ] }, 'contentPolicy': { 'filters': [ { 'type': 'INSULTS'|'HATE'|'SEXUAL'|'VIOLENCE'|'MISCONDUCT'|'PROMPT_ATTACK', 'confidence': 'NONE'|'LOW'|'MEDIUM'|'HIGH', 'action': 'BLOCKED' }, ] }, 'wordPolicy': { 'customWords': [ { 'match': 'string', 'action': 'BLOCKED' }, ], 'managedWordLists': [ { 'match': 'string', 'type': 'PROFANITY', 'action': 'BLOCKED' }, ] }, 'sensitiveInformationPolicy': { 'piiEntities': [ { 'type': 'ADDRESS'|'AGE'|'AWS_ACCESS_KEY'|'AWS_SECRET_KEY'|'CA_HEALTH_NUMBER'|'CA_SOCIAL_INSURANCE_NUMBER'|'CREDIT_DEBIT_CARD_CVV'|'CREDIT_DEBIT_CARD_EXPIRY'|'CREDIT_DEBIT_CARD_NUMBER'|'DRIVER_ID'|'EMAIL'|'INTERNATIONAL_BANK_ACCOUNT_NUMBER'|'IP_ADDRESS'|'LICENSE_PLATE'|'MAC_ADDRESS'|'NAME'|'PASSWORD'|'PHONE'|'PIN'|'SWIFT_CODE'|'UK_NATIONAL_HEALTH_SERVICE_NUMBER'|'UK_NATIONAL_INSURANCE_NUMBER'|'UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER'|'URL'|'USERNAME'|'US_BANK_ACCOUNT_NUMBER'|'US_BANK_ROUTING_NUMBER'|'US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER'|'US_PASSPORT_NUMBER'|'US_SOCIAL_SECURITY_NUMBER'|'VEHICLE_IDENTIFICATION_NUMBER', 'match': 'string', 'action': 'BLOCKED'|'ANONYMIZED' }, ], 'regexes': [ { 'name': 'string', 'regex': 'string', 'match': 'string', 'action': 'BLOCKED'|'ANONYMIZED' }, ] } }, ], 'outputAssessments': [ { 'topicPolicy': { 'topics': [ { 'name': 'string', 'type': 'DENY', 'action': 'BLOCKED' }, ] }, 'contentPolicy': { 'filters': [ { 'type': 'INSULTS'|'HATE'|'SEXUAL'|'VIOLENCE'|'MISCONDUCT'|'PROMPT_ATTACK', 'confidence': 'NONE'|'LOW'|'MEDIUM'|'HIGH', 'action': 'BLOCKED' }, ] }, 'wordPolicy': { 'customWords': [ { 'match': 'string', 'action': 'BLOCKED' }, ], 'managedWordLists': [ { 'match': 'string', 'type': 'PROFANITY', 'action': 'BLOCKED' }, ] }, 'sensitiveInformationPolicy': { 'piiEntities': [ { 'type': 'ADDRESS'|'AGE'|'AWS_ACCESS_KEY'|'AWS_SECRET_KEY'|'CA_HEALTH_NUMBER'|'CA_SOCIAL_INSURANCE_NUMBER'|'CREDIT_DEBIT_CARD_CVV'|'CREDIT_DEBIT_CARD_EXPIRY'|'CREDIT_DEBIT_CARD_NUMBER'|'DRIVER_ID'|'EMAIL'|'INTERNATIONAL_BANK_ACCOUNT_NUMBER'|'IP_ADDRESS'|'LICENSE_PLATE'|'MAC_ADDRESS'|'NAME'|'PASSWORD'|'PHONE'|'PIN'|'SWIFT_CODE'|'UK_NATIONAL_HEALTH_SERVICE_NUMBER'|'UK_NATIONAL_INSURANCE_NUMBER'|'UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER'|'URL'|'USERNAME'|'US_BANK_ACCOUNT_NUMBER'|'US_BANK_ROUTING_NUMBER'|'US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER'|'US_PASSPORT_NUMBER'|'US_SOCIAL_SECURITY_NUMBER'|'VEHICLE_IDENTIFICATION_NUMBER', 'match': 'string', 'action': 'BLOCKED'|'ANONYMIZED' }, ], 'regexes': [ { 'name': 'string', 'regex': 'string', 'match': 'string', 'action': 'BLOCKED'|'ANONYMIZED' }, ] } }, ], 'metadata': { 'startTime': datetime(2015, 1, 1), 'endTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'operationTotalTimeMs': 123, 'clientRequestId': 'string', 'usage': { 'inputTokens': 123, 'outputTokens': 123 } } }, 'preProcessingTrace': { 'modelInvocationInput': { 'traceId': 'string', 'text': 'string', 'type': 'PRE_PROCESSING'|'ORCHESTRATION'|'KNOWLEDGE_BASE_RESPONSE_GENERATION'|'POST_PROCESSING'|'ROUTING_CLASSIFIER', 'overrideLambda': 'string', 'promptCreationMode': 'DEFAULT'|'OVERRIDDEN', 'inferenceConfiguration': { 'temperature': ..., 'topP': ..., 'topK': 123, 'maximumLength': 123, 'stopSequences': [ 'string', ] }, 'parserMode': 'DEFAULT'|'OVERRIDDEN', 'foundationModel': 'string' }, 'modelInvocationOutput': { 'traceId': 'string', 'parsedResponse': { 'rationale': 'string', 'isValid': True|False }, 'rawResponse': { 'content': 'string' }, 'metadata': { 'startTime': datetime(2015, 1, 1), 'endTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'operationTotalTimeMs': 123, 'clientRequestId': 'string', 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'reasoningContent': { 'reasoningText': { 'text': 'string', 'signature': 'string' }, 'redactedContent': b'bytes' } } }, 'orchestrationTrace': { 'rationale': { 'traceId': 'string', 'text': 'string' }, 'invocationInput': { 'traceId': 'string', 'invocationType': 'ACTION_GROUP'|'KNOWLEDGE_BASE'|'FINISH'|'ACTION_GROUP_CODE_INTERPRETER'|'AGENT_COLLABORATOR', 'actionGroupInvocationInput': { 'actionGroupName': 'string', 'verb': 'string', 'apiPath': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ], 'requestBody': { 'content': { 'string': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } }, 'function': 'string', 'executionType': 'LAMBDA'|'RETURN_CONTROL', 'invocationId': 'string' }, 'knowledgeBaseLookupInput': { 'text': 'string', 'knowledgeBaseId': 'string' }, 'codeInterpreterInvocationInput': { 'code': 'string', 'files': [ 'string', ] }, 'agentCollaboratorInvocationInput': { 'agentCollaboratorName': 'string', 'agentCollaboratorAliasArn': 'string', 'input': { 'type': 'TEXT'|'RETURN_CONTROL', 'text': 'string', 'returnControlResults': { 'invocationId': 'string', 'returnControlInvocationResults': [ { 'apiResult': { 'actionGroup': 'string', 'httpMethod': 'string', 'apiPath': 'string', 'confirmationState': 'CONFIRM'|'DENY', 'responseState': 'FAILURE'|'REPROMPT', 'httpStatusCode': 123, 'responseBody': { 'string': { 'body': 'string', 'images': [ { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes' } }, ] } }, 'agentId': 'string' }, 'functionResult': { 'actionGroup': 'string', 'confirmationState': 'CONFIRM'|'DENY', 'function': 'string', 'responseBody': { 'string': { 'body': 'string', 'images': [ { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes' } }, ] } }, 'responseState': 'FAILURE'|'REPROMPT', 'agentId': 'string' } }, ] } } } }, 'observation': { 'traceId': 'string', 'type': 'ACTION_GROUP'|'AGENT_COLLABORATOR'|'KNOWLEDGE_BASE'|'FINISH'|'ASK_USER'|'REPROMPT', 'actionGroupInvocationOutput': { 'text': 'string', 'metadata': { 'startTime': datetime(2015, 1, 1), 'endTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'operationTotalTimeMs': 123, 'clientRequestId': 'string', 'usage': { 'inputTokens': 123, 'outputTokens': 123 } } }, 'agentCollaboratorInvocationOutput': { 'agentCollaboratorName': 'string', 'agentCollaboratorAliasArn': 'string', 'output': { 'type': 'TEXT'|'RETURN_CONTROL', 'text': 'string', 'returnControlPayload': { 'invocationInputs': [ { 'apiInvocationInput': { 'actionGroup': 'string', 'httpMethod': 'string', 'apiPath': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ], 'requestBody': { 'content': { 'string': { 'properties': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } } }, 'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT', 'agentId': 'string', 'collaboratorName': 'string' }, 'functionInvocationInput': { 'actionGroup': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ], 'function': 'string', 'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT', 'agentId': 'string', 'collaboratorName': 'string' } }, ], 'invocationId': 'string' } }, 'metadata': { 'startTime': datetime(2015, 1, 1), 'endTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'operationTotalTimeMs': 123, 'clientRequestId': 'string', 'usage': { 'inputTokens': 123, 'outputTokens': 123 } } }, 'knowledgeBaseLookupOutput': { 'retrievedReferences': [ { 'content': { 'type': 'TEXT'|'IMAGE'|'ROW', 'text': 'string', 'byteContent': 'string', 'row': [ { 'columnName': 'string', 'columnValue': 'string', 'type': 'BLOB'|'BOOLEAN'|'DOUBLE'|'NULL'|'LONG'|'STRING' }, ] }, 'location': { 'type': 'S3'|'WEB'|'CONFLUENCE'|'SALESFORCE'|'SHAREPOINT'|'CUSTOM'|'KENDRA'|'SQL', 's3Location': { 'uri': 'string' }, 'webLocation': { 'url': 'string' }, 'confluenceLocation': { 'url': 'string' }, 'salesforceLocation': { 'url': 'string' }, 'sharePointLocation': { 'url': 'string' }, 'customDocumentLocation': { 'id': 'string' }, 'kendraDocumentLocation': { 'uri': 'string' }, 'sqlLocation': { 'query': 'string' } }, 'metadata': { 'string': {...}|[...]|123|123.4|'string'|True|None } }, ], 'metadata': { 'startTime': datetime(2015, 1, 1), 'endTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'operationTotalTimeMs': 123, 'clientRequestId': 'string', 'usage': { 'inputTokens': 123, 'outputTokens': 123 } } }, 'finalResponse': { 'text': 'string', 'metadata': { 'startTime': datetime(2015, 1, 1), 'endTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'operationTotalTimeMs': 123, 'clientRequestId': 'string', 'usage': { 'inputTokens': 123, 'outputTokens': 123 } } }, 'repromptResponse': { 'text': 'string', 'source': 'ACTION_GROUP'|'KNOWLEDGE_BASE'|'PARSER' }, 'codeInterpreterInvocationOutput': { 'executionOutput': 'string', 'executionError': 'string', 'files': [ 'string', ], 'executionTimeout': True|False, 'metadata': { 'startTime': datetime(2015, 1, 1), 'endTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'operationTotalTimeMs': 123, 'clientRequestId': 'string', 'usage': { 'inputTokens': 123, 'outputTokens': 123 } } } }, 'modelInvocationInput': { 'traceId': 'string', 'text': 'string', 'type': 'PRE_PROCESSING'|'ORCHESTRATION'|'KNOWLEDGE_BASE_RESPONSE_GENERATION'|'POST_PROCESSING'|'ROUTING_CLASSIFIER', 'overrideLambda': 'string', 'promptCreationMode': 'DEFAULT'|'OVERRIDDEN', 'inferenceConfiguration': { 'temperature': ..., 'topP': ..., 'topK': 123, 'maximumLength': 123, 'stopSequences': [ 'string', ] }, 'parserMode': 'DEFAULT'|'OVERRIDDEN', 'foundationModel': 'string' }, 'modelInvocationOutput': { 'traceId': 'string', 'rawResponse': { 'content': 'string' }, 'metadata': { 'startTime': datetime(2015, 1, 1), 'endTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'operationTotalTimeMs': 123, 'clientRequestId': 'string', 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'reasoningContent': { 'reasoningText': { 'text': 'string', 'signature': 'string' }, 'redactedContent': b'bytes' } } }, 'postProcessingTrace': { 'modelInvocationInput': { 'traceId': 'string', 'text': 'string', 'type': 'PRE_PROCESSING'|'ORCHESTRATION'|'KNOWLEDGE_BASE_RESPONSE_GENERATION'|'POST_PROCESSING'|'ROUTING_CLASSIFIER', 'overrideLambda': 'string', 'promptCreationMode': 'DEFAULT'|'OVERRIDDEN', 'inferenceConfiguration': { 'temperature': ..., 'topP': ..., 'topK': 123, 'maximumLength': 123, 'stopSequences': [ 'string', ] }, 'parserMode': 'DEFAULT'|'OVERRIDDEN', 'foundationModel': 'string' }, 'modelInvocationOutput': { 'traceId': 'string', 'parsedResponse': { 'text': 'string' }, 'rawResponse': { 'content': 'string' }, 'metadata': { 'startTime': datetime(2015, 1, 1), 'endTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'operationTotalTimeMs': 123, 'clientRequestId': 'string', 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'reasoningContent': { 'reasoningText': { 'text': 'string', 'signature': 'string' }, 'redactedContent': b'bytes' } } }, 'routingClassifierTrace': { 'invocationInput': { 'traceId': 'string', 'invocationType': 'ACTION_GROUP'|'KNOWLEDGE_BASE'|'FINISH'|'ACTION_GROUP_CODE_INTERPRETER'|'AGENT_COLLABORATOR', 'actionGroupInvocationInput': { 'actionGroupName': 'string', 'verb': 'string', 'apiPath': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ], 'requestBody': { 'content': { 'string': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } }, 'function': 'string', 'executionType': 'LAMBDA'|'RETURN_CONTROL', 'invocationId': 'string' }, 'knowledgeBaseLookupInput': { 'text': 'string', 'knowledgeBaseId': 'string' }, 'codeInterpreterInvocationInput': { 'code': 'string', 'files': [ 'string', ] }, 'agentCollaboratorInvocationInput': { 'agentCollaboratorName': 'string', 'agentCollaboratorAliasArn': 'string', 'input': { 'type': 'TEXT'|'RETURN_CONTROL', 'text': 'string', 'returnControlResults': { 'invocationId': 'string', 'returnControlInvocationResults': [ { 'apiResult': { 'actionGroup': 'string', 'httpMethod': 'string', 'apiPath': 'string', 'confirmationState': 'CONFIRM'|'DENY', 'responseState': 'FAILURE'|'REPROMPT', 'httpStatusCode': 123, 'responseBody': { 'string': { 'body': 'string', 'images': [ { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes' } }, ] } }, 'agentId': 'string' }, 'functionResult': { 'actionGroup': 'string', 'confirmationState': 'CONFIRM'|'DENY', 'function': 'string', 'responseBody': { 'string': { 'body': 'string', 'images': [ { 'format': 'png'|'jpeg'|'gif'|'webp', 'source': { 'bytes': b'bytes' } }, ] } }, 'responseState': 'FAILURE'|'REPROMPT', 'agentId': 'string' } }, ] } } } }, 'observation': { 'traceId': 'string', 'type': 'ACTION_GROUP'|'AGENT_COLLABORATOR'|'KNOWLEDGE_BASE'|'FINISH'|'ASK_USER'|'REPROMPT', 'actionGroupInvocationOutput': { 'text': 'string', 'metadata': { 'startTime': datetime(2015, 1, 1), 'endTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'operationTotalTimeMs': 123, 'clientRequestId': 'string', 'usage': { 'inputTokens': 123, 'outputTokens': 123 } } }, 'agentCollaboratorInvocationOutput': { 'agentCollaboratorName': 'string', 'agentCollaboratorAliasArn': 'string', 'output': { 'type': 'TEXT'|'RETURN_CONTROL', 'text': 'string', 'returnControlPayload': { 'invocationInputs': [ { 'apiInvocationInput': { 'actionGroup': 'string', 'httpMethod': 'string', 'apiPath': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ], 'requestBody': { 'content': { 'string': { 'properties': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } } }, 'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT', 'agentId': 'string', 'collaboratorName': 'string' }, 'functionInvocationInput': { 'actionGroup': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ], 'function': 'string', 'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT', 'agentId': 'string', 'collaboratorName': 'string' } }, ], 'invocationId': 'string' } }, 'metadata': { 'startTime': datetime(2015, 1, 1), 'endTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'operationTotalTimeMs': 123, 'clientRequestId': 'string', 'usage': { 'inputTokens': 123, 'outputTokens': 123 } } }, 'knowledgeBaseLookupOutput': { 'retrievedReferences': [ { 'content': { 'type': 'TEXT'|'IMAGE'|'ROW', 'text': 'string', 'byteContent': 'string', 'row': [ { 'columnName': 'string', 'columnValue': 'string', 'type': 'BLOB'|'BOOLEAN'|'DOUBLE'|'NULL'|'LONG'|'STRING' }, ] }, 'location': { 'type': 'S3'|'WEB'|'CONFLUENCE'|'SALESFORCE'|'SHAREPOINT'|'CUSTOM'|'KENDRA'|'SQL', 's3Location': { 'uri': 'string' }, 'webLocation': { 'url': 'string' }, 'confluenceLocation': { 'url': 'string' }, 'salesforceLocation': { 'url': 'string' }, 'sharePointLocation': { 'url': 'string' }, 'customDocumentLocation': { 'id': 'string' }, 'kendraDocumentLocation': { 'uri': 'string' }, 'sqlLocation': { 'query': 'string' } }, 'metadata': { 'string': {...}|[...]|123|123.4|'string'|True|None } }, ], 'metadata': { 'startTime': datetime(2015, 1, 1), 'endTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'operationTotalTimeMs': 123, 'clientRequestId': 'string', 'usage': { 'inputTokens': 123, 'outputTokens': 123 } } }, 'finalResponse': { 'text': 'string', 'metadata': { 'startTime': datetime(2015, 1, 1), 'endTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'operationTotalTimeMs': 123, 'clientRequestId': 'string', 'usage': { 'inputTokens': 123, 'outputTokens': 123 } } }, 'repromptResponse': { 'text': 'string', 'source': 'ACTION_GROUP'|'KNOWLEDGE_BASE'|'PARSER' }, 'codeInterpreterInvocationOutput': { 'executionOutput': 'string', 'executionError': 'string', 'files': [ 'string', ], 'executionTimeout': True|False, 'metadata': { 'startTime': datetime(2015, 1, 1), 'endTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'operationTotalTimeMs': 123, 'clientRequestId': 'string', 'usage': { 'inputTokens': 123, 'outputTokens': 123 } } } }, 'modelInvocationInput': { 'traceId': 'string', 'text': 'string', 'type': 'PRE_PROCESSING'|'ORCHESTRATION'|'KNOWLEDGE_BASE_RESPONSE_GENERATION'|'POST_PROCESSING'|'ROUTING_CLASSIFIER', 'overrideLambda': 'string', 'promptCreationMode': 'DEFAULT'|'OVERRIDDEN', 'inferenceConfiguration': { 'temperature': ..., 'topP': ..., 'topK': 123, 'maximumLength': 123, 'stopSequences': [ 'string', ] }, 'parserMode': 'DEFAULT'|'OVERRIDDEN', 'foundationModel': 'string' }, 'modelInvocationOutput': { 'traceId': 'string', 'rawResponse': { 'content': 'string' }, 'metadata': { 'startTime': datetime(2015, 1, 1), 'endTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'operationTotalTimeMs': 123, 'clientRequestId': 'string', 'usage': { 'inputTokens': 123, 'outputTokens': 123 } } } }, 'failureTrace': { 'traceId': 'string', 'failureReason': 'string', 'failureCode': 123, 'metadata': { 'startTime': datetime(2015, 1, 1), 'endTime': datetime(2015, 1, 1), 'totalTimeMs': 123, 'operationTotalTimeMs': 123, 'clientRequestId': 'string', 'usage': { 'inputTokens': 123, 'outputTokens': 123 } } }, 'customOrchestrationTrace': { 'traceId': 'string', 'event': { 'text': 'string' } } }, 'callerChain': [ { 'agentAliasArn': 'string' }, ], 'eventTime': datetime(2015, 1, 1), 'collaboratorName': 'string', 'agentId': 'string', 'agentAliasId': 'string', 'agentVersion': 'string' }, 'returnControl': { 'invocationInputs': [ { 'apiInvocationInput': { 'actionGroup': 'string', 'httpMethod': 'string', 'apiPath': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ], 'requestBody': { 'content': { 'string': { 'properties': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } } }, 'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT', 'agentId': 'string', 'collaboratorName': 'string' }, 'functionInvocationInput': { 'actionGroup': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ], 'function': 'string', 'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT', 'agentId': 'string', 'collaboratorName': 'string' } }, ], 'invocationId': 'string' }, 'internalServerException': { 'message': 'string', 'reason': 'string' }, 'validationException': { 'message': 'string' }, 'resourceNotFoundException': { 'message': 'string' }, 'serviceQuotaExceededException': { 'message': 'string' }, 'throttlingException': { 'message': 'string' }, 'accessDeniedException': { 'message': 'string' }, 'conflictException': { 'message': 'string' }, 'dependencyFailedException': { 'message': 'string', 'resourceName': 'string' }, 'badGatewayException': { 'message': 'string', 'resourceName': 'string' }, 'modelNotReadyException': { 'message': 'string' }, 'files': { 'files': [ { 'name': 'string', 'type': 'string', 'bytes': b'bytes' }, ] } }), 'contentType': 'string', 'sessionId': 'string', 'memoryId': 'string' } - Response Structure- # This section is too large to render. # Please see the AWS API Documentation linked below. 
 - Exceptions- AgentsforBedrockRuntime.Client.exceptions.ModelNotReadyException
- AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundException
- AgentsforBedrockRuntime.Client.exceptions.ValidationException
- AgentsforBedrockRuntime.Client.exceptions.InternalServerException
- AgentsforBedrockRuntime.Client.exceptions.DependencyFailedException
- AgentsforBedrockRuntime.Client.exceptions.BadGatewayException
- AgentsforBedrockRuntime.Client.exceptions.ThrottlingException
- AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException
- AgentsforBedrockRuntime.Client.exceptions.ServiceQuotaExceededException