AgentsforBedrockRuntime / Client / invoke_inline_agent
invoke_inline_agent#
- AgentsforBedrockRuntime.Client.invoke_inline_agent(**kwargs)#
Invokes an inline Amazon Bedrock agent using the configurations you provide with the request.
Specify the following fields for security purposes.
(Optional)
customerEncryptionKeyArn
– The Amazon Resource Name (ARN) of a KMS key to encrypt the creation of the agent.(Optional)
idleSessionTTLinSeconds
– Specify the number of seconds for which the agent should maintain session information. After this time expires, the subsequentInvokeInlineAgent
request begins a new session.
To override the default prompt behavior for agent orchestration and to use advanced prompts, include a
promptOverrideConfiguration
object. For more information, see Advanced prompts.The agent instructions will not be honored if your agent has only one knowledge base, uses default prompts, has no action group, and user input is disabled.
Note
The CLI doesn’t support streaming operations in Amazon Bedrock, including
InvokeInlineAgent
.See also: AWS API Documentation
Request Syntax
response = client.invoke_inline_agent( actionGroups=[ { 'actionGroupExecutor': { 'customControl': 'RETURN_CONTROL', 'lambda': 'string' }, 'actionGroupName': 'string', 'apiSchema': { 'payload': 'string', 's3': { 's3BucketName': 'string', 's3ObjectKey': 'string' } }, 'description': 'string', 'functionSchema': { 'functions': [ { 'description': 'string', 'name': 'string', 'parameters': { 'string': { 'description': 'string', 'required': True|False, 'type': 'string'|'number'|'integer'|'boolean'|'array' } }, 'requireConfirmation': 'ENABLED'|'DISABLED' }, ] }, 'parentActionGroupSignature': 'AMAZON.UserInput'|'AMAZON.CodeInterpreter' }, ], customerEncryptionKeyArn='string', enableTrace=True|False, endSession=True|False, foundationModel='string', guardrailConfiguration={ 'guardrailIdentifier': 'string', 'guardrailVersion': 'string' }, idleSessionTTLInSeconds=123, inlineSessionState={ 'files': [ { 'name': 'string', 'source': { 'byteContent': { 'data': b'bytes', 'mediaType': 'string' }, 's3Location': { 'uri': 'string' }, 'sourceType': 'S3'|'BYTE_CONTENT' }, 'useCase': 'CODE_INTERPRETER'|'CHAT' }, ], 'invocationId': 'string', 'promptSessionAttributes': { 'string': 'string' }, 'returnControlInvocationResults': [ { 'apiResult': { 'actionGroup': 'string', 'apiPath': 'string', 'confirmationState': 'CONFIRM'|'DENY', 'httpMethod': 'string', 'httpStatusCode': 123, 'responseBody': { 'string': { 'body': 'string' } }, 'responseState': 'FAILURE'|'REPROMPT' }, 'functionResult': { 'actionGroup': 'string', 'confirmationState': 'CONFIRM'|'DENY', 'function': 'string', 'responseBody': { 'string': { 'body': 'string' } }, 'responseState': 'FAILURE'|'REPROMPT' } }, ], 'sessionAttributes': { 'string': 'string' } }, inputText='string', instruction='string', knowledgeBases=[ { 'description': 'string', 'knowledgeBaseId': 'string', 'retrievalConfiguration': { 'vectorSearchConfiguration': { 'filter': { 'andAll': [ {'... recursive ...'}, ], 'equals': { '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 }, 'in': { '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 }, 'listContains': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'notEquals': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'notIn': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'orAll': [ {'... recursive ...'}, ], 'startsWith': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None }, 'stringContains': { 'key': 'string', 'value': {...}|[...]|123|123.4|'string'|True|None } }, 'numberOfResults': 123, 'overrideSearchType': 'HYBRID'|'SEMANTIC' } } }, ], promptOverrideConfiguration={ 'overrideLambda': 'string', 'promptConfigurations': [ { 'basePromptTemplate': 'string', 'inferenceConfiguration': { 'maximumLength': 123, 'stopSequences': [ 'string', ], 'temperature': ..., 'topK': 123, 'topP': ... }, 'parserMode': 'DEFAULT'|'OVERRIDDEN', 'promptCreationMode': 'DEFAULT'|'OVERRIDDEN', 'promptState': 'ENABLED'|'DISABLED', 'promptType': 'PRE_PROCESSING'|'ORCHESTRATION'|'KNOWLEDGE_BASE_RESPONSE_GENERATION'|'POST_PROCESSING'|'ROUTING_CLASSIFIER' }, ] }, sessionId='string' )
- Parameters:
actionGroups (list) –
A list of action groups with each action group defining the action the inline agent needs to carry out.
(dict) –
Contains details of the inline agent’s action group.
actionGroupExecutor (dict) –
The Amazon Resource Name (ARN) of the Lambda function containing the business logic that is carried out upon invoking the action or the custom control method for handling the information elicited from the user.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
customControl
,lambda
.customControl (string) –
To return the action group invocation results directly in the
InvokeInlineAgent
response, specifyRETURN_CONTROL
.lambda (string) –
The Amazon Resource Name (ARN) of the Lambda function containing the business logic that is carried out upon invoking the action.
actionGroupName (string) – [REQUIRED]
The name of the action group.
apiSchema (dict) –
Contains either details about the S3 object containing the OpenAPI schema for the action group or the JSON or YAML-formatted payload defining the schema. For more information, see Action group OpenAPI schemas.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
payload
,s3
.payload (string) –
The JSON or YAML-formatted payload defining the OpenAPI schema for the action group.
s3 (dict) –
Contains details about the S3 object containing the OpenAPI schema for the action group.
s3BucketName (string) –
The name of the S3 bucket.
s3ObjectKey (string) –
The S3 object key for the S3 resource.
description (string) –
A description of the action group.
functionSchema (dict) –
Contains details about the function schema for the action group or the JSON or YAML-formatted payload defining the schema.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
functions
.functions (list) –
A list of functions that each define an action in the action group.
(dict) –
Defines parameters that the agent needs to invoke from the user to complete the function. Corresponds to an action in an action group.
description (string) –
A description of the function and its purpose.
name (string) – [REQUIRED]
A name for the function.
parameters (dict) –
The parameters that the agent elicits from the user to fulfill the function.
(string) –
(dict) –
Contains details about a parameter in a function for an action group.
description (string) –
A description of the parameter. Helps the foundation model determine how to elicit the parameters from the user.
required (boolean) –
Whether the parameter is required for the agent to complete the function for action group invocation.
type (string) – [REQUIRED]
The data type of the parameter.
requireConfirmation (string) –
Contains information if user confirmation is required to invoke the function.
parentActionGroupSignature (string) –
To allow your agent to request the user for additional information when trying to complete a task, set this field to
AMAZON.UserInput
. You must leave thedescription
,apiSchema
, andactionGroupExecutor
fields blank for this action group.To allow your agent to generate, run, and troubleshoot code when trying to complete a task, set this field to
AMAZON.CodeInterpreter
. You must leave thedescription
,apiSchema
, andactionGroupExecutor
fields blank for this action group.During orchestration, if your agent determines that it needs to invoke an API in an action group, but doesn’t have enough information to complete the API request, it will invoke this action group instead and return an Observation reprompting the user for more information.
customerEncryptionKeyArn (string) – The Amazon Resource Name (ARN) of the Amazon Web Services KMS key to use to encrypt your inline agent.
enableTrace (boolean) – Specifies whether to turn on the trace or not to track the agent’s reasoning process. For more information, see Using trace.
</p>
endSession (boolean) – Specifies whether to end the session with the inline agent or not.
foundationModel (string) –
[REQUIRED]
The model identifier (ID) of the model to use for orchestration by the inline agent. For example,
meta.llama3-1-70b-instruct-v1:0
.guardrailConfiguration (dict) –
The guardrails to assign to the inline agent.
guardrailIdentifier (string) – [REQUIRED]
The unique identifier for the guardrail.
guardrailVersion (string) – [REQUIRED]
The version of the guardrail.
idleSessionTTLInSeconds (integer) –
The number of seconds for which the inline agent should maintain session information. After this time expires, the subsequent
InvokeInlineAgent
request begins a new session.A user interaction remains active for the amount of time specified. If no conversation occurs during this time, the session expires and the data provided before the timeout is deleted.
inlineSessionState (dict) –
Parameters that specify the various attributes of a sessions. 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. For more information, see Control session context.
Note
If you include
returnControlInvocationResults
in thesessionState
field, theinputText
field will be ignored.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.
byteContent (dict) –
The data and the text of the attached files.
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.
mediaType (string) – [REQUIRED]
The MIME type of data contained in the file used for chat.
s3Location (dict) –
The s3 location of the files to attach.
uri (string) – [REQUIRED]
The uri of the s3 object.
sourceType (string) – [REQUIRED]
The source type of the files to attach.
useCase (string) – [REQUIRED]
Specifies how the source files will be used by the code interpreter.
invocationId (string) –
The identifier of the invocation of an action. This value must match the
invocationId
returned in theInvokeInlineAgent
response for the action whose results are provided in thereturnControlInvocationResults
field. For more information, see Return control to the agent developer.promptSessionAttributes (dict) –
Contains attributes that persist across a session and the values of those attributes.
(string) –
(string) –
returnControlInvocationResults (list) –
Contains information about the results from the action group invocation. For more information, see Return control to the agent developer.
Note
If you include this field in the
sessionState
field, theinputText
field 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.
apiPath (string) –
The path to the API operation.
confirmationState (string) –
Controls the API operations or functions to invoke based on the user confirmation.
httpMethod (string) –
The HTTP method for the API operation.
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
TEXT
is 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
returnControlInvocationResults
field of the InvokeAgent request
body (string) –
The body of the API response.
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
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 key of the object is the content type (currently, only
TEXT
is 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
returnControlInvocationResults
field of the InvokeAgent request
body (string) –
The body of the API response.
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
sessionAttributes (dict) –
Contains attributes that persist across a session and the values of those attributes.
(string) –
(string) –
inputText (string) –
The prompt text to send to the agent.
Note
If you include
returnControlInvocationResults
in thesessionState
field, theinputText
field will be ignored.instruction (string) –
[REQUIRED]
The instructions that tell the inline agent what it should do and how it should interact with users.
knowledgeBases (list) –
Contains information of the knowledge bases to associate with.
(dict) –
Details of the knowledge base associated withe inline agent.
description (string) – [REQUIRED]
The description of the knowledge base associated with the inline agent.
knowledgeBaseId (string) – [REQUIRED]
The unique identifier for a knowledge base associated with the inline agent.
retrievalConfiguration (dict) –
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.
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:
andAll
,equals
,greaterThan
,greaterThanOrEquals
,in
,lessThan
,lessThanOrEquals
,listContains
,notEquals
,notIn
,orAll
,startsWith
,stringContains
.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
filter
fieldRetrieveAndGenerate request – in the
filter
field
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
andAll
,equals
,greaterThan
,greaterThanOrEquals
,in
,lessThan
,lessThanOrEquals
,listContains
,notEquals
,notIn
,orAll
,startsWith
,stringContains
.
equals (dict) –
Knowledge base data sources are returned if they contain a metadata attribute whose name matches the
key
and whose value matches thevalue
in this object.The following example would return data sources with an
animal
attribute whose value iscat
:"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.
greaterThan (dict) –
Knowledge base data sources are returned if they contain a metadata attribute whose name matches the
key
and whose value is greater than thevalue
in this object.The following example would return data sources with an
year
attribute whose value is greater than1989
:"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
key
and whose value is greater than or equal to thevalue
in this object.The following example would return data sources with an
year
attribute whose value is greater than or equal to1989
:"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.
in (dict) –
Knowledge base data sources are returned if they contain a metadata attribute whose name matches the
key
and whose value is in the list specified in thevalue
in this object.The following example would return data sources with an
animal
attribute that is eithercat
ordog
:"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.
lessThan (dict) –
Knowledge base data sources are returned if they contain a metadata attribute whose name matches the
key
and whose value is less than thevalue
in this object.The following example would return data sources with an
year
attribute whose value is less than to1989
."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
key
and whose value is less than or equal to thevalue
in this object.The following example would return data sources with an
year
attribute whose value is less than or equal to1989
."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.
listContains (dict) –
Knowledge base data sources are returned if they contain a metadata attribute whose name matches the
key
and whose value is a list that contains thevalue
as one of its members.The following example would return data sources with an
animals
attribute that is a list containing acat
member (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.
notEquals (dict) –
Knowledge base data sources that contain a metadata attribute whose name matches the
key
and whose value doesn’t match thevalue
in this object are returned.The following example would return data sources that don’t contain an
animal
attribute whose value iscat
."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.
notIn (dict) –
Knowledge base data sources are returned if they contain a metadata attribute whose name matches the
key
and whose value isn’t in the list specified in thevalue
in this object.The following example would return data sources whose
animal
attribute is neithercat
nordog
."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.
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
filter
fieldRetrieveAndGenerate request – in the
filter
field
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
andAll
,equals
,greaterThan
,greaterThanOrEquals
,in
,lessThan
,lessThanOrEquals
,listContains
,notEquals
,notIn
,orAll
,startsWith
,stringContains
.
startsWith (dict) –
Knowledge base data sources are returned if they contain a metadata attribute whose name matches the
key
and whose value starts with thevalue
in this object. This filter is currently only supported for Amazon OpenSearch Serverless vector stores.The following example would return data sources with an
animal
attribute starts withca
(for example,cat
orcamel
)."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.
stringContains (dict) –
Knowledge base data sources are returned if they contain a metadata attribute whose name matches the
key
and whose value is one of the following:A string that contains the
value
as a substring. The following example would return data sources with ananimal
attribute that contains the substringat
(for examplecat
)."stringContains": { "key": "animal", "value": "at" }
A list with a member that contains the
value
as a substring. The following example would return data sources with ananimals
attribute that is a list containing a member that contains the substringat
(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.
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
HYBRID
search using both vector embeddings and raw text, orSEMANTIC
search using only vector embeddings. For other vector store configurations, onlySEMANTIC
search is available. For more information, see Test a knowledge base.
promptOverrideConfiguration (dict) –
Configurations for advanced prompts used to override the default prompts to enhance the accuracy of the inline agent.
overrideLambda (string) –
The ARN of the Lambda function to use when parsing the raw foundation model output in parts of the agent sequence. If you specify this field, at least one of the
promptConfigurations
must contain aparserMode
value that is set toOVERRIDDEN
. For more information, see Parser Lambda function in Amazon Bedrock Agents.promptConfigurations (list) – [REQUIRED]
Contains configurations to override a prompt template in one part of an agent sequence. For more information, see Advanced prompts.
(dict) –
Contains configurations to override a prompt template in one part of an agent sequence. For more information, see Advanced prompts.
basePromptTemplate (string) –
Defines the prompt template with which to replace the default prompt template. You can use placeholder variables in the base prompt template to customize the prompt. For more information, see Prompt template placeholder variables. For more information, see Configure the prompt templates.
inferenceConfiguration (dict) –
Contains inference parameters to use when the agent invokes a foundation model in the part of the agent sequence defined by the
promptType
. For more information, see Inference parameters for foundation models.maximumLength (integer) –
The maximum number of tokens allowed in the generated response.
stopSequences (list) –
A list of stop sequences. A stop sequence is a sequence of characters that causes the model to stop generating the response.
(string) –
temperature (float) –
The likelihood of the model selecting higher-probability options while generating a response. A lower value makes the model more likely to choose higher-probability options, while a higher value makes the model more likely to choose lower-probability options.
topK (integer) –
While generating a response, the model determines the probability of the following token at each point of generation. The value that you set for
topK
is the number of most-likely candidates from which the model chooses the next token in the sequence. For example, if you settopK
to 50, the model selects the next token from among the top 50 most likely choices.topP (float) –
While generating a response, the model determines the probability of the following token at each point of generation. The value that you set for
Top P
determines the number of most-likely candidates from which the model chooses the next token in the sequence. For example, if you settopP
to 0.8, the model only selects the next token from the top 80% of the probability distribution of next tokens.
parserMode (string) –
Specifies whether to override the default parser Lambda function when parsing the raw foundation model output in the part of the agent sequence defined by the
promptType
. If you set the field asOVERRIDEN
, theoverrideLambda
field in the PromptOverrideConfiguration must be specified with the ARN of a Lambda function.promptCreationMode (string) –
Specifies whether to override the default prompt template for this
promptType
. Set this value toOVERRIDDEN
to use the prompt that you provide in thebasePromptTemplate
. If you leave it asDEFAULT
, the agent uses a default prompt template.promptState (string) –
Specifies whether to allow the inline agent to carry out the step specified in the
promptType
. If you set this value toDISABLED
, the agent skips that step. The default state for eachpromptType
is as follows.PRE_PROCESSING
–ENABLED
ORCHESTRATION
–ENABLED
KNOWLEDGE_BASE_RESPONSE_GENERATION
–ENABLED
POST_PROCESSING
–DISABLED
promptType (string) –
The step in the agent sequence that this prompt configuration applies to.
sessionId (string) –
[REQUIRED]
The unique identifier of the session. Use the same value across requests to continue the same conversation.
- Return type:
dict
- Returns:
The response of this operation contains an
EventStream
member. When iterated theEventStream
will 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({ 'accessDeniedException': { 'message': 'string' }, 'badGatewayException': { 'message': 'string', 'resourceName': 'string' }, 'chunk': { 'attribution': { 'citations': [ { 'generatedResponsePart': { 'textResponsePart': { 'span': { 'end': 123, 'start': 123 }, 'text': 'string' } }, 'retrievedReferences': [ { 'content': { 'text': 'string' }, 'location': { 'confluenceLocation': { 'url': 'string' }, 's3Location': { 'uri': 'string' }, 'salesforceLocation': { 'url': 'string' }, 'sharePointLocation': { 'url': 'string' }, 'type': 'S3'|'WEB'|'CONFLUENCE'|'SALESFORCE'|'SHAREPOINT', 'webLocation': { 'url': 'string' } }, 'metadata': { 'string': {...}|[...]|123|123.4|'string'|True|None } }, ] }, ] }, 'bytes': b'bytes' }, 'conflictException': { 'message': 'string' }, 'dependencyFailedException': { 'message': 'string', 'resourceName': 'string' }, 'files': { 'files': [ { 'bytes': b'bytes', 'name': 'string', 'type': 'string' }, ] }, 'internalServerException': { 'message': 'string' }, 'resourceNotFoundException': { 'message': 'string' }, 'returnControl': { 'invocationId': 'string', 'invocationInputs': [ { 'apiInvocationInput': { 'actionGroup': 'string', 'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT', 'apiPath': 'string', 'httpMethod': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ], 'requestBody': { 'content': { 'string': { 'properties': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } } } }, 'functionInvocationInput': { 'actionGroup': 'string', 'actionInvocationType': 'RESULT'|'USER_CONFIRMATION'|'USER_CONFIRMATION_AND_RESULT', 'function': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } }, ] }, 'serviceQuotaExceededException': { 'message': 'string' }, 'throttlingException': { 'message': 'string' }, 'trace': { 'sessionId': 'string', 'trace': { 'failureTrace': { 'failureReason': 'string', 'traceId': 'string' }, 'guardrailTrace': { 'action': 'INTERVENED'|'NONE', 'inputAssessments': [ { 'contentPolicy': { 'filters': [ { 'action': 'BLOCKED', 'confidence': 'NONE'|'LOW'|'MEDIUM'|'HIGH', 'type': 'INSULTS'|'HATE'|'SEXUAL'|'VIOLENCE'|'MISCONDUCT'|'PROMPT_ATTACK' }, ] }, 'sensitiveInformationPolicy': { 'piiEntities': [ { 'action': 'BLOCKED'|'ANONYMIZED', 'match': 'string', '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' }, ], 'regexes': [ { 'action': 'BLOCKED'|'ANONYMIZED', 'match': 'string', 'name': 'string', 'regex': 'string' }, ] }, 'topicPolicy': { 'topics': [ { 'action': 'BLOCKED', 'name': 'string', 'type': 'DENY' }, ] }, 'wordPolicy': { 'customWords': [ { 'action': 'BLOCKED', 'match': 'string' }, ], 'managedWordLists': [ { 'action': 'BLOCKED', 'match': 'string', 'type': 'PROFANITY' }, ] } }, ], 'outputAssessments': [ { 'contentPolicy': { 'filters': [ { 'action': 'BLOCKED', 'confidence': 'NONE'|'LOW'|'MEDIUM'|'HIGH', 'type': 'INSULTS'|'HATE'|'SEXUAL'|'VIOLENCE'|'MISCONDUCT'|'PROMPT_ATTACK' }, ] }, 'sensitiveInformationPolicy': { 'piiEntities': [ { 'action': 'BLOCKED'|'ANONYMIZED', 'match': 'string', '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' }, ], 'regexes': [ { 'action': 'BLOCKED'|'ANONYMIZED', 'match': 'string', 'name': 'string', 'regex': 'string' }, ] }, 'topicPolicy': { 'topics': [ { 'action': 'BLOCKED', 'name': 'string', 'type': 'DENY' }, ] }, 'wordPolicy': { 'customWords': [ { 'action': 'BLOCKED', 'match': 'string' }, ], 'managedWordLists': [ { 'action': 'BLOCKED', 'match': 'string', 'type': 'PROFANITY' }, ] } }, ], 'traceId': 'string' }, 'orchestrationTrace': { 'invocationInput': { 'actionGroupInvocationInput': { 'actionGroupName': 'string', 'apiPath': 'string', 'executionType': 'LAMBDA'|'RETURN_CONTROL', 'function': 'string', 'invocationId': 'string', 'parameters': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ], 'requestBody': { 'content': { 'string': [ { 'name': 'string', 'type': 'string', 'value': 'string' }, ] } }, 'verb': 'string' }, 'codeInterpreterInvocationInput': { 'code': 'string', 'files': [ 'string', ] }, 'invocationType': 'ACTION_GROUP'|'KNOWLEDGE_BASE'|'FINISH'|'ACTION_GROUP_CODE_INTERPRETER', 'knowledgeBaseLookupInput': { 'knowledgeBaseId': 'string', 'text': 'string' }, 'traceId': 'string' }, 'modelInvocationInput': { 'inferenceConfiguration': { 'maximumLength': 123, 'stopSequences': [ 'string', ], 'temperature': ..., 'topK': 123, 'topP': ... }, 'overrideLambda': 'string', 'parserMode': 'DEFAULT'|'OVERRIDDEN', 'promptCreationMode': 'DEFAULT'|'OVERRIDDEN', 'text': 'string', 'traceId': 'string', 'type': 'PRE_PROCESSING'|'ORCHESTRATION'|'KNOWLEDGE_BASE_RESPONSE_GENERATION'|'POST_PROCESSING'|'ROUTING_CLASSIFIER' }, 'modelInvocationOutput': { 'metadata': { 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'rawResponse': { 'content': 'string' }, 'traceId': 'string' }, 'observation': { 'actionGroupInvocationOutput': { 'text': 'string' }, 'codeInterpreterInvocationOutput': { 'executionError': 'string', 'executionOutput': 'string', 'executionTimeout': True|False, 'files': [ 'string', ] }, 'finalResponse': { 'text': 'string' }, 'knowledgeBaseLookupOutput': { 'retrievedReferences': [ { 'content': { 'text': 'string' }, 'location': { 'confluenceLocation': { 'url': 'string' }, 's3Location': { 'uri': 'string' }, 'salesforceLocation': { 'url': 'string' }, 'sharePointLocation': { 'url': 'string' }, 'type': 'S3'|'WEB'|'CONFLUENCE'|'SALESFORCE'|'SHAREPOINT', 'webLocation': { 'url': 'string' } }, 'metadata': { 'string': {...}|[...]|123|123.4|'string'|True|None } }, ] }, 'repromptResponse': { 'source': 'ACTION_GROUP'|'KNOWLEDGE_BASE'|'PARSER', 'text': 'string' }, 'traceId': 'string', 'type': 'ACTION_GROUP'|'KNOWLEDGE_BASE'|'FINISH'|'ASK_USER'|'REPROMPT' }, 'rationale': { 'text': 'string', 'traceId': 'string' } }, 'postProcessingTrace': { 'modelInvocationInput': { 'inferenceConfiguration': { 'maximumLength': 123, 'stopSequences': [ 'string', ], 'temperature': ..., 'topK': 123, 'topP': ... }, 'overrideLambda': 'string', 'parserMode': 'DEFAULT'|'OVERRIDDEN', 'promptCreationMode': 'DEFAULT'|'OVERRIDDEN', 'text': 'string', 'traceId': 'string', 'type': 'PRE_PROCESSING'|'ORCHESTRATION'|'KNOWLEDGE_BASE_RESPONSE_GENERATION'|'POST_PROCESSING'|'ROUTING_CLASSIFIER' }, 'modelInvocationOutput': { 'metadata': { 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'parsedResponse': { 'text': 'string' }, 'rawResponse': { 'content': 'string' }, 'traceId': 'string' } }, 'preProcessingTrace': { 'modelInvocationInput': { 'inferenceConfiguration': { 'maximumLength': 123, 'stopSequences': [ 'string', ], 'temperature': ..., 'topK': 123, 'topP': ... }, 'overrideLambda': 'string', 'parserMode': 'DEFAULT'|'OVERRIDDEN', 'promptCreationMode': 'DEFAULT'|'OVERRIDDEN', 'text': 'string', 'traceId': 'string', 'type': 'PRE_PROCESSING'|'ORCHESTRATION'|'KNOWLEDGE_BASE_RESPONSE_GENERATION'|'POST_PROCESSING'|'ROUTING_CLASSIFIER' }, 'modelInvocationOutput': { 'metadata': { 'usage': { 'inputTokens': 123, 'outputTokens': 123 } }, 'parsedResponse': { 'isValid': True|False, 'rationale': 'string' }, 'rawResponse': { 'content': 'string' }, 'traceId': 'string' } } } }, 'validationException': { 'message': 'string' } }), 'contentType': 'string', 'sessionId': 'string' }
Response Structure
(dict) –
completion (
EventStream
) –</p>
accessDeniedException (dict) –
The request is denied because of missing access permissions. Check your permissions and retry your request.
message (string) –
badGatewayException (dict) –
There was an issue with a dependency due to a server issue. Retry your request.
message (string) –
resourceName (string) –
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or STS.
chunk (dict) –
Contains a part of an agent response and citations for it.
attribution (dict) –
Contains citations for a part of an agent response.
citations (list) –
A list of citations and related information for a part of an agent response.
(dict) –
An object containing a segment of the generated response that is based on a source in the knowledge base, alongside information about the source.
This data type is used in the following API operations:
InvokeAgent response – in the
citations
fieldRetrieveAndGenerate response – in the
citations
field
generatedResponsePart (dict) –
Contains the generated response and metadata
textResponsePart (dict) –
Contains metadata about a textual part of the generated response that is accompanied by a citation.
span (dict) –
Contains information about where the text with a citation begins and ends in the generated output.
end (integer) –
Where the text with a citation ends in the generated output.
start (integer) –
Where the text with a citation starts in the generated output.
text (string) –
The part of the generated text that contains a citation.
retrievedReferences (list) –
Contains metadata about the sources cited for the generated response.
(dict) –
Contains metadata about a source cited for the generated response.
This data type is used in the following API operations:
RetrieveAndGenerate response – in the
retrievedReferences
fieldInvokeAgent response – in the
retrievedReferences
field
content (dict) –
Contains the cited text from the data source.
text (string) –
The cited text from the data source.
location (dict) –
Contains information about the location of the data source.
confluenceLocation (dict) –
The Confluence data source location.
url (string) –
The Confluence host URL for the data source location.
s3Location (dict) –
The S3 data source location.
uri (string) –
The S3 URI for the data source location.
salesforceLocation (dict) –
The Salesforce data source location.
url (string) –
The Salesforce host URL for the data source location.
sharePointLocation (dict) –
The SharePoint data source location.
url (string) –
The SharePoint site URL for the data source location.
type (string) –
The type of data source location.
webLocation (dict) –
The web URL/URLs data source location.
url (string) –
The web URL/URLs for the data source location.
metadata (dict) –
Contains metadata attributes and their values for the file in the data source. For more information, see Metadata and filtering.
(string) –
(document) –
bytes (bytes) –
A part of the agent response in bytes.
conflictException (dict) –
There was a conflict performing an operation. Resolve the conflict and retry your request.
message (string) –
dependencyFailedException (dict) –
There was an issue with a dependency. Check the resource configurations and retry the request.
message (string) –
resourceName (string) –
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or STS.
files (dict) –
Contains intermediate response for code interpreter if any files have been generated.
files (list) –
Files containing intermediate response for the user.
(dict) –
Contains details of the response from code interpreter.
bytes (bytes) –
The byte count of files that contains response from code interpreter.
name (string) –
The name of the file containing response from code interpreter.
type (string) –
The type of file that contains response from the code interpreter.
internalServerException (dict) –
An internal server error occurred. Retry your request.
message (string) –
resourceNotFoundException (dict) –
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
message (string) –
returnControl (dict) –
Contains the parameters and information that the agent elicited from the customer to carry out an action. This information is returned to the system and can be used in your own setup for fulfilling the action.
invocationId (string) –
The identifier of the action group invocation.
invocationInputs (list) –
A list of objects that contain information about the parameters and inputs that need to be sent into the API operation or function, based on what the agent determines from its session with the user.
(dict) –
Contains details about the API operation or function that the agent predicts should be called.
This data type is used in the following API operations:
In the
returnControl
field of the InvokeAgent response
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
apiInvocationInput
,functionInvocationInput
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
apiInvocationInput (dict) –
Contains information about the API operation that the agent predicts should be called.
actionGroup (string) –
The action group that the API operation belongs to.
actionInvocationType (string) –
Contains information about the API operation to invoke.
apiPath (string) –
The path to the API operation.
httpMethod (string) –
The HTTP method of the API operation.
parameters (list) –
The parameters to provide for the API request, as the agent elicited from the user.
(dict) –
Information about a parameter to provide to the API request.
This data type is used in the following API operations:
name (string) –
The name of the parameter.
type (string) –
The data type for the parameter.
value (string) –
The value of the parameter.
requestBody (dict) –
The request body to provide for the API request, as the agent elicited from the user.
content (dict) –
The content of the request body. The key of the object in this field is a media type defining the format of the request body.
(string) –
(dict) –
Contains the parameters in the request body.
properties (list) –
A list of parameters in the request body.
(dict) –
A parameter for the API request or function.
name (string) –
The name of the parameter.
type (string) –
The type of the parameter.
value (string) –
The value of the parameter.
functionInvocationInput (dict) –
Contains information about the function that the agent predicts should be called.
actionGroup (string) –
The action group that the function belongs to.
actionInvocationType (string) –
Contains information about the function to invoke,
function (string) –
The name of the function.
parameters (list) –
A list of parameters of the function.
(dict) –
Contains information about a parameter of the function.
This data type is used in the following API operations:
In the
returnControl
field of the InvokeAgent response
name (string) –
The name of the parameter.
type (string) –
The data type of the parameter.
value (string) –
The value of the parameter.
serviceQuotaExceededException (dict) –
The number of requests exceeds the service quota. Resubmit your request later.
message (string) –
throttlingException (dict) –
The number of requests exceeds the limit. Resubmit your request later.
message (string) –
trace (dict) –
Contains information about the agent and session, alongside the agent’s reasoning process and results from calling actions and querying knowledge bases and metadata about the trace. You can use the trace to understand how the agent arrived at the response it provided the customer. For more information, see Trace events.
sessionId (string) –
The unique identifier of the session with the agent.
trace (dict) –
Contains one part of the agent’s reasoning process and results from calling API actions and querying knowledge bases. You can use the trace to understand how the agent arrived at the response it provided the customer. For more information, see Trace enablement.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
failureTrace
,guardrailTrace
,orchestrationTrace
,postProcessingTrace
,preProcessingTrace
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
failureTrace (dict) –
Contains information about the failure of the interaction.
failureReason (string) –
The reason the interaction failed.
traceId (string) –
The unique identifier of the trace.
guardrailTrace (dict) –
The trace details for a trace defined in the Guardrail filter.
action (string) –
The trace action details used with the Guardrail.
inputAssessments (list) –
The details of the input assessments used in the Guardrail Trace.
(dict) –
Assessment details of the content analyzed by Guardrails.
contentPolicy (dict) –
Content policy details of the Guardrail.
filters (list) –
The filter details of the policy assessment used in the Guardrails filter.
(dict) –
Details of the content filter used in the Guardrail.
action (string) –
The action placed on the content by the Guardrail filter.
confidence (string) –
The confidence level regarding the content detected in the filter by the Guardrail.
type (string) –
The type of content detected in the filter by the Guardrail.
sensitiveInformationPolicy (dict) –
Sensitive Information policy details of Guardrail.
piiEntities (list) –
The details of the PII entities used in the sensitive policy assessment for the Guardrail.
(dict) –
The Guardrail filter to identify and remove personally identifiable information (PII).
action (string) –
The action of the Guardrail filter to identify and remove PII.
match (string) –
The match to settings in the Guardrail filter to identify and remove PII.
type (string) –
The type of PII the Guardrail filter has identified and removed.
regexes (list) –
The details of the regexes used in the sensitive policy assessment for the Guardrail.
(dict) –
The details for the regex filter used in the Guardrail.
action (string) –
The action details for the regex filter used in the Guardrail.
match (string) –
The match details for the regex filter used in the Guardrail.
name (string) –
The name details for the regex filter used in the Guardrail.
regex (string) –
The regex details for the regex filter used in the Guardrail.
topicPolicy (dict) –
Topic policy details of the Guardrail.
topics (list) –
The topic details of the policy assessment used in the Guardrail.
(dict) –
The details for a specific topic defined in the Guardrail.
action (string) –
The action details on a specific topic in the Guardrail.
name (string) –
The name details on a specific topic in the Guardrail.
type (string) –
The type details on a specific topic in the Guardrail.
wordPolicy (dict) –
Word policy details of the Guardrail.
customWords (list) –
The custom word details for words defined in the Guardrail filter.
(dict) –
The custom word details for the filter in the Guardrail.
action (string) –
The action details for the custom word filter in the Guardrail.
match (string) –
The match details for the custom word filter in the Guardrail.
managedWordLists (list) –
The managed word lists for words defined in the Guardrail filter.
(dict) –
The managed word details for the filter in the Guardrail.
action (string) –
The action details for the managed word filter in the Guardrail.
match (string) –
The match details for the managed word filter in the Guardrail.
type (string) –
The type details for the managed word filter in the Guardrail.
outputAssessments (list) –
The details of the output assessments used in the Guardrail Trace.
(dict) –
Assessment details of the content analyzed by Guardrails.
contentPolicy (dict) –
Content policy details of the Guardrail.
filters (list) –
The filter details of the policy assessment used in the Guardrails filter.
(dict) –
Details of the content filter used in the Guardrail.
action (string) –
The action placed on the content by the Guardrail filter.
confidence (string) –
The confidence level regarding the content detected in the filter by the Guardrail.
type (string) –
The type of content detected in the filter by the Guardrail.
sensitiveInformationPolicy (dict) –
Sensitive Information policy details of Guardrail.
piiEntities (list) –
The details of the PII entities used in the sensitive policy assessment for the Guardrail.
(dict) –
The Guardrail filter to identify and remove personally identifiable information (PII).
action (string) –
The action of the Guardrail filter to identify and remove PII.
match (string) –
The match to settings in the Guardrail filter to identify and remove PII.
type (string) –
The type of PII the Guardrail filter has identified and removed.
regexes (list) –
The details of the regexes used in the sensitive policy assessment for the Guardrail.
(dict) –
The details for the regex filter used in the Guardrail.
action (string) –
The action details for the regex filter used in the Guardrail.
match (string) –
The match details for the regex filter used in the Guardrail.
name (string) –
The name details for the regex filter used in the Guardrail.
regex (string) –
The regex details for the regex filter used in the Guardrail.
topicPolicy (dict) –
Topic policy details of the Guardrail.
topics (list) –
The topic details of the policy assessment used in the Guardrail.
(dict) –
The details for a specific topic defined in the Guardrail.
action (string) –
The action details on a specific topic in the Guardrail.
name (string) –
The name details on a specific topic in the Guardrail.
type (string) –
The type details on a specific topic in the Guardrail.
wordPolicy (dict) –
Word policy details of the Guardrail.
customWords (list) –
The custom word details for words defined in the Guardrail filter.
(dict) –
The custom word details for the filter in the Guardrail.
action (string) –
The action details for the custom word filter in the Guardrail.
match (string) –
The match details for the custom word filter in the Guardrail.
managedWordLists (list) –
The managed word lists for words defined in the Guardrail filter.
(dict) –
The managed word details for the filter in the Guardrail.
action (string) –
The action details for the managed word filter in the Guardrail.
match (string) –
The match details for the managed word filter in the Guardrail.
type (string) –
The type details for the managed word filter in the Guardrail.
traceId (string) –
The details of the trace Id used in the Guardrail Trace.
orchestrationTrace (dict) –
Details about the orchestration step, in which the agent determines the order in which actions are executed and which knowledge bases are retrieved.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
invocationInput
,modelInvocationInput
,modelInvocationOutput
,observation
,rationale
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
invocationInput (dict) –
Contains information pertaining to the action group or knowledge base that is being invoked.
actionGroupInvocationInput (dict) –
Contains information about the action group to be invoked.
actionGroupName (string) –
The name of the action group.
apiPath (string) –
The path to the API to call, based off the action group.
executionType (string) –
How fulfillment of the action is handled. For more information, see Handling fulfillment of the action.
function (string) –
The function in the action group to call.
invocationId (string) –
The unique identifier of the invocation. Only returned if the
executionType
isRETURN_CONTROL
.parameters (list) –
The parameters in the Lambda input event.
(dict) –
A parameter for the API request or function.
name (string) –
The name of the parameter.
type (string) –
The type of the parameter.
value (string) –
The value of the parameter.
requestBody (dict) –
The parameters in the request body for the Lambda input event.
content (dict) –
The content in the request body.
(string) –
(list) –
(dict) –
A parameter for the API request or function.
name (string) –
The name of the parameter.
type (string) –
The type of the parameter.
value (string) –
The value of the parameter.
verb (string) –
The API method being used, based off the action group.
codeInterpreterInvocationInput (dict) –
Contains information about the code interpreter to be invoked.
code (string) –
The code for the code interpreter to use.
files (list) –
Files that are uploaded for code interpreter to use.
(string) –
invocationType (string) –
Specifies whether the agent is invoking an action group or a knowledge base.
knowledgeBaseLookupInput (dict) –
Contains details about the knowledge base to look up and the query to be made.
knowledgeBaseId (string) –
The unique identifier of the knowledge base to look up.
text (string) –
The query made to the knowledge base.
traceId (string) –
The unique identifier of the trace.
modelInvocationInput (dict) –
The input for the orchestration step.
The
type
isORCHESTRATION
.The
text
contains the prompt.The
inferenceConfiguration
,parserMode
, andoverrideLambda
values are set in the PromptOverrideConfiguration object that was set when the agent was created or updated.
inferenceConfiguration (dict) –
Specifications about the inference parameters that were provided alongside the prompt. These are specified in the PromptOverrideConfiguration object that was set when the agent was created or updated. For more information, see Inference parameters for foundation models.
maximumLength (integer) –
The maximum number of tokens allowed in the generated response.
stopSequences (list) –
A list of stop sequences. A stop sequence is a sequence of characters that causes the model to stop generating the response.
(string) –
temperature (float) –
The likelihood of the model selecting higher-probability options while generating a response. A lower value makes the model more likely to choose higher-probability options, while a higher value makes the model more likely to choose lower-probability options.
topK (integer) –
While generating a response, the model determines the probability of the following token at each point of generation. The value that you set for
topK
is the number of most-likely candidates from which the model chooses the next token in the sequence. For example, if you settopK
to 50, the model selects the next token from among the top 50 most likely choices.topP (float) –
While generating a response, the model determines the probability of the following token at each point of generation. The value that you set for
Top P
determines the number of most-likely candidates from which the model chooses the next token in the sequence. For example, if you settopP
to 0.8, the model only selects the next token from the top 80% of the probability distribution of next tokens.
overrideLambda (string) –
The ARN of the Lambda function to use when parsing the raw foundation model output in parts of the agent sequence.
parserMode (string) –
Specifies whether to override the default parser Lambda function when parsing the raw foundation model output in the part of the agent sequence defined by the
promptType
.promptCreationMode (string) –
Specifies whether the default prompt template was
OVERRIDDEN
. If it was, thebasePromptTemplate
that was set in the PromptOverrideConfiguration object when the agent was created or updated is used instead.text (string) –
The text that prompted the agent at this step.
traceId (string) –
The unique identifier of the trace.
type (string) –
The step in the agent sequence.
modelInvocationOutput (dict) –
Contains information pertaining to the output from the foundation model that is being invoked.
metadata (dict) –
Contains information about the foundation model output from the orchestration step.
usage (dict) –
Contains details of the foundation model usage.
inputTokens (integer) –
Contains information about the input tokens from the foundation model usage.
outputTokens (integer) –
Contains information about the output tokens from the foundation model usage.
rawResponse (dict) –
Contains details of the raw response from the foundation model output.
content (string) –
The foundation model’s raw output content.
traceId (string) –
The unique identifier of the trace.
observation (dict) –
Details about the observation (the output of the action group Lambda or knowledge base) made by the agent.
actionGroupInvocationOutput (dict) –
Contains the JSON-formatted string returned by the API invoked by the action group.
text (string) –
The JSON-formatted string returned by the API invoked by the action group.
codeInterpreterInvocationOutput (dict) –
Contains the JSON-formatted string returned by the API invoked by the code interpreter.
executionError (string) –
Contains the error returned from code execution.
executionOutput (string) –
Contains the successful output returned from code execution
executionTimeout (boolean) –
Indicates if the execution of the code timed out.
files (list) –
Contains output files, if generated by code execution.
(string) –
finalResponse (dict) –
Contains details about the response to the user.
text (string) –
The text in the response to the user.
knowledgeBaseLookupOutput (dict) –
Contains details about the results from looking up the knowledge base.
retrievedReferences (list) –
Contains metadata about the sources cited for the generated response.
(dict) –
Contains metadata about a source cited for the generated response.
This data type is used in the following API operations:
RetrieveAndGenerate response – in the
retrievedReferences
fieldInvokeAgent response – in the
retrievedReferences
field
content (dict) –
Contains the cited text from the data source.
text (string) –
The cited text from the data source.
location (dict) –
Contains information about the location of the data source.
confluenceLocation (dict) –
The Confluence data source location.
url (string) –
The Confluence host URL for the data source location.
s3Location (dict) –
The S3 data source location.
uri (string) –
The S3 URI for the data source location.
salesforceLocation (dict) –
The Salesforce data source location.
url (string) –
The Salesforce host URL for the data source location.
sharePointLocation (dict) –
The SharePoint data source location.
url (string) –
The SharePoint site URL for the data source location.
type (string) –
The type of data source location.
webLocation (dict) –
The web URL/URLs data source location.
url (string) –
The web URL/URLs for the data source location.
metadata (dict) –
Contains metadata attributes and their values for the file in the data source. For more information, see Metadata and filtering.
(string) –
(document) –
repromptResponse (dict) –
Contains details about the response to reprompt the input.
source (string) –
Specifies what output is prompting the agent to reprompt the input.
text (string) –
The text reprompting the input.
traceId (string) –
The unique identifier of the trace.
type (string) –
Specifies what kind of information the agent returns in the observation. The following values are possible.
ACTION_GROUP
– The agent returns the result of an action group.KNOWLEDGE_BASE
– The agent returns information from a knowledge base.FINISH
– The agent returns a final response to the user with no follow-up.ASK_USER
– The agent asks the user a question.REPROMPT
– The agent prompts the user again for the same information.
rationale (dict) –
Details about the reasoning, based on the input, that the agent uses to justify carrying out an action group or getting information from a knowledge base.
text (string) –
The reasoning or thought process of the agent, based on the input.
traceId (string) –
The unique identifier of the trace step.
postProcessingTrace (dict) –
Details about the post-processing step, in which the agent shapes the response..
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
modelInvocationInput
,modelInvocationOutput
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
modelInvocationInput (dict) –
The input for the post-processing step.
The
type
isPOST_PROCESSING
.The
text
contains the prompt.The
inferenceConfiguration
,parserMode
, andoverrideLambda
values are set in the PromptOverrideConfiguration object that was set when the agent was created or updated.
inferenceConfiguration (dict) –
Specifications about the inference parameters that were provided alongside the prompt. These are specified in the PromptOverrideConfiguration object that was set when the agent was created or updated. For more information, see Inference parameters for foundation models.
maximumLength (integer) –
The maximum number of tokens allowed in the generated response.
stopSequences (list) –
A list of stop sequences. A stop sequence is a sequence of characters that causes the model to stop generating the response.
(string) –
temperature (float) –
The likelihood of the model selecting higher-probability options while generating a response. A lower value makes the model more likely to choose higher-probability options, while a higher value makes the model more likely to choose lower-probability options.
topK (integer) –
While generating a response, the model determines the probability of the following token at each point of generation. The value that you set for
topK
is the number of most-likely candidates from which the model chooses the next token in the sequence. For example, if you settopK
to 50, the model selects the next token from among the top 50 most likely choices.topP (float) –
While generating a response, the model determines the probability of the following token at each point of generation. The value that you set for
Top P
determines the number of most-likely candidates from which the model chooses the next token in the sequence. For example, if you settopP
to 0.8, the model only selects the next token from the top 80% of the probability distribution of next tokens.
overrideLambda (string) –
The ARN of the Lambda function to use when parsing the raw foundation model output in parts of the agent sequence.
parserMode (string) –
Specifies whether to override the default parser Lambda function when parsing the raw foundation model output in the part of the agent sequence defined by the
promptType
.promptCreationMode (string) –
Specifies whether the default prompt template was
OVERRIDDEN
. If it was, thebasePromptTemplate
that was set in the PromptOverrideConfiguration object when the agent was created or updated is used instead.text (string) –
The text that prompted the agent at this step.
traceId (string) –
The unique identifier of the trace.
type (string) –
The step in the agent sequence.
modelInvocationOutput (dict) –
The foundation model output from the post-processing step.
metadata (dict) –
Contains information about the foundation model output from the post-processing step.
usage (dict) –
Contains details of the foundation model usage.
inputTokens (integer) –
Contains information about the input tokens from the foundation model usage.
outputTokens (integer) –
Contains information about the output tokens from the foundation model usage.
parsedResponse (dict) –
Details about the response from the Lambda parsing of the output of the post-processing step.
text (string) –
The text returned by the parser.
rawResponse (dict) –
Details of the raw response from the foundation model output.
content (string) –
The foundation model’s raw output content.
traceId (string) –
The unique identifier of the trace.
preProcessingTrace (dict) –
Details about the pre-processing step, in which the agent contextualizes and categorizes user inputs.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
modelInvocationInput
,modelInvocationOutput
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
modelInvocationInput (dict) –
The input for the pre-processing step.
The
type
isPRE_PROCESSING
.The
text
contains the prompt.The
inferenceConfiguration
,parserMode
, andoverrideLambda
values are set in the PromptOverrideConfiguration object that was set when the agent was created or updated.
inferenceConfiguration (dict) –
Specifications about the inference parameters that were provided alongside the prompt. These are specified in the PromptOverrideConfiguration object that was set when the agent was created or updated. For more information, see Inference parameters for foundation models.
maximumLength (integer) –
The maximum number of tokens allowed in the generated response.
stopSequences (list) –
A list of stop sequences. A stop sequence is a sequence of characters that causes the model to stop generating the response.
(string) –
temperature (float) –
The likelihood of the model selecting higher-probability options while generating a response. A lower value makes the model more likely to choose higher-probability options, while a higher value makes the model more likely to choose lower-probability options.
topK (integer) –
While generating a response, the model determines the probability of the following token at each point of generation. The value that you set for
topK
is the number of most-likely candidates from which the model chooses the next token in the sequence. For example, if you settopK
to 50, the model selects the next token from among the top 50 most likely choices.topP (float) –
While generating a response, the model determines the probability of the following token at each point of generation. The value that you set for
Top P
determines the number of most-likely candidates from which the model chooses the next token in the sequence. For example, if you settopP
to 0.8, the model only selects the next token from the top 80% of the probability distribution of next tokens.
overrideLambda (string) –
The ARN of the Lambda function to use when parsing the raw foundation model output in parts of the agent sequence.
parserMode (string) –
Specifies whether to override the default parser Lambda function when parsing the raw foundation model output in the part of the agent sequence defined by the
promptType
.promptCreationMode (string) –
Specifies whether the default prompt template was
OVERRIDDEN
. If it was, thebasePromptTemplate
that was set in the PromptOverrideConfiguration object when the agent was created or updated is used instead.text (string) –
The text that prompted the agent at this step.
traceId (string) –
The unique identifier of the trace.
type (string) –
The step in the agent sequence.
modelInvocationOutput (dict) –
The foundation model output from the pre-processing step.
metadata (dict) –
Contains information about the foundation model output from the pre-processing step.
usage (dict) –
Contains details of the foundation model usage.
inputTokens (integer) –
Contains information about the input tokens from the foundation model usage.
outputTokens (integer) –
Contains information about the output tokens from the foundation model usage.
parsedResponse (dict) –
Details about the response from the Lambda parsing of the output of the pre-processing step.
isValid (boolean) –
Whether the user input is valid or not. If
false
, the agent doesn’t proceed to orchestration.rationale (string) –
The text returned by the parsing of the pre-processing step, explaining the steps that the agent plans to take in orchestration, if the user input is valid.
rawResponse (dict) –
Details of the raw response from the foundation model output.
content (string) –
The foundation model’s raw output content.
traceId (string) –
The unique identifier of the trace.
validationException (dict) –
Input validation failed. Check your request parameters and retry the request.
message (string) –
contentType (string) –
The MIME type of the input data in the request. The default value is application/json.
sessionId (string) –
The unique identifier of the session with the agent.
Exceptions
AgentsforBedrockRuntime.Client.exceptions.ConflictException
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