SDK for PHP 3.x

Client: Aws\BedrockAgentRuntime\BedrockAgentRuntimeClient
Service ID: bedrock-agent-runtime
Version: 2023-07-26

This page describes the parameters and results for the operations of the Agents for Amazon Bedrock Runtime (2023-07-26), and shows how to use the Aws\BedrockAgentRuntime\BedrockAgentRuntimeClient object to call the described operations. This documentation is specific to the 2023-07-26 API version of the service.

Operation Summary

Each of the following operations can be created from a client using $client->getCommand('CommandName'), where "CommandName" is the name of one of the following operations. Note: a command is a value that encapsulates an operation and the parameters used to create an HTTP request.

You can also create and send a command immediately using the magic methods available on a client object: $client->commandName(/* parameters */). You can send the command asynchronously (returning a promise) by appending the word "Async" to the operation name: $client->commandNameAsync(/* parameters */).

DeleteAgentMemory ( array $params = [] )
Deletes memory from the specified memory identifier.
GetAgentMemory ( array $params = [] )
Gets the sessions stored in the memory of the agent.
InvokeAgent ( array $params = [] )
The CLI doesn't support streaming operations in Amazon Bedrock, including InvokeAgent.
InvokeFlow ( array $params = [] )
Invokes an alias of a flow to run the inputs that you specify and return the output of each node as a stream.
InvokeInlineAgent ( array $params = [] )
Invokes an inline Amazon Bedrock agent using the configurations you provide with the request.
OptimizePrompt ( array $params = [] )
Optimizes a prompt for the task that you specify.
Retrieve ( array $params = [] )
Queries a knowledge base and retrieves information from it.
RetrieveAndGenerate ( array $params = [] )
Queries a knowledge base and generates responses based on the retrieved results and using the specified foundation model or inference profile.

Paginators

Paginators handle automatically iterating over paginated API results. Paginators are associated with specific API operations, and they accept the parameters that the corresponding API operation accepts. You can get a paginator from a client class using getPaginator($paginatorName, $operationParameters). This client supports the following paginators:

GetAgentMemory
Retrieve

Operations

DeleteAgentMemory

$result = $client->deleteAgentMemory([/* ... */]);
$promise = $client->deleteAgentMemoryAsync([/* ... */]);

Deletes memory from the specified memory identifier.

Parameter Syntax

$result = $client->deleteAgentMemory([
    'agentAliasId' => '<string>', // REQUIRED
    'agentId' => '<string>', // REQUIRED
    'memoryId' => '<string>',
]);

Parameter Details

Members
agentAliasId
Required: Yes
Type: string

The unique identifier of an alias of an agent.

agentId
Required: Yes
Type: string

The unique identifier of the agent to which the alias belongs.

memoryId
Type: string

The unique identifier of the memory.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ConflictException:

There was a conflict performing an operation. Resolve the conflict and retry your request.

ResourceNotFoundException:

The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.

ValidationException:

Input validation failed. Check your request parameters and retry the request.

InternalServerException:

An internal server error occurred. Retry your request.

DependencyFailedException:

There was an issue with a dependency. Check the resource configurations and retry the request.

BadGatewayException:

There was an issue with a dependency due to a server issue. Retry your request.

ThrottlingException:

The number of requests exceeds the limit. Resubmit your request later.

AccessDeniedException:

The request is denied because of missing access permissions. Check your permissions and retry your request.

ServiceQuotaExceededException:

The number of requests exceeds the service quota. Resubmit your request later.

GetAgentMemory

$result = $client->getAgentMemory([/* ... */]);
$promise = $client->getAgentMemoryAsync([/* ... */]);

Gets the sessions stored in the memory of the agent.

Parameter Syntax

$result = $client->getAgentMemory([
    'agentAliasId' => '<string>', // REQUIRED
    'agentId' => '<string>', // REQUIRED
    'maxItems' => <integer>,
    'memoryId' => '<string>', // REQUIRED
    'memoryType' => 'SESSION_SUMMARY', // REQUIRED
    'nextToken' => '<string>',
]);

Parameter Details

Members
agentAliasId
Required: Yes
Type: string

The unique identifier of an alias of an agent.

agentId
Required: Yes
Type: string

The unique identifier of the agent to which the alias belongs.

maxItems
Type: int

The maximum number of items to return in the response. If the total number of results is greater than this value, use the token returned in the response in the nextToken field when making another request to return the next batch of results.

memoryId
Required: Yes
Type: string

The unique identifier of the memory.

memoryType
Required: Yes
Type: string

The type of memory.

nextToken
Type: string

If the total number of results is greater than the maxItems value provided in the request, enter the token returned in the nextToken field in the response in this field to return the next batch of results.

Result Syntax

[
    'memoryContents' => [
        [
            'sessionSummary' => [
                'memoryId' => '<string>',
                'sessionExpiryTime' => <DateTime>,
                'sessionId' => '<string>',
                'sessionStartTime' => <DateTime>,
                'summaryText' => '<string>',
            ],
        ],
        // ...
    ],
    'nextToken' => '<string>',
]

Result Details

Members
memoryContents
Type: Array of Memory structures

Contains details of the sessions stored in the memory

nextToken
Type: string

If the total number of results is greater than the maxItems value provided in the request, use this token when making another request in the nextToken field to return the next batch of results.

Errors

ConflictException:

There was a conflict performing an operation. Resolve the conflict and retry your request.

ResourceNotFoundException:

The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.

ValidationException:

Input validation failed. Check your request parameters and retry the request.

InternalServerException:

An internal server error occurred. Retry your request.

DependencyFailedException:

There was an issue with a dependency. Check the resource configurations and retry the request.

BadGatewayException:

There was an issue with a dependency due to a server issue. Retry your request.

ThrottlingException:

The number of requests exceeds the limit. Resubmit your request later.

AccessDeniedException:

The request is denied because of missing access permissions. Check your permissions and retry your request.

ServiceQuotaExceededException:

The number of requests exceeds the service quota. Resubmit your request later.

InvokeAgent

$result = $client->invokeAgent([/* ... */]);
$promise = $client->invokeAgentAsync([/* ... */]);

The CLI doesn't support streaming operations in Amazon Bedrock, including InvokeAgent.

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 sessionId value in the request.

  • To activate trace enablement, turn enableTrace to 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 endSession to true.

  • In the sessionState object, 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 is returned in the bytes field of the chunk object.

  • The attribution object contains citations for parts of the response.

  • If you set enableTrace to true in 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 returnControl field.

  • Errors are also surfaced in the response.

Parameter Syntax

$result = $client->invokeAgent([
    'agentAliasId' => '<string>', // REQUIRED
    'agentId' => '<string>', // REQUIRED
    'enableTrace' => true || false,
    'endSession' => true || false,
    'inputText' => '<string>',
    'memoryId' => '<string>',
    'sessionId' => '<string>', // REQUIRED
    'sessionState' => [
        'files' => [
            [
                'name' => '<string>', // REQUIRED
                'source' => [ // REQUIRED
                    'byteContent' => [
                        'data' => <string || resource || Psr\Http\Message\StreamInterface>, // REQUIRED
                        'mediaType' => '<string>', // REQUIRED
                    ],
                    's3Location' => [
                        'uri' => '<string>', // REQUIRED
                    ],
                    'sourceType' => 'S3|BYTE_CONTENT', // REQUIRED
                ],
                'useCase' => 'CODE_INTERPRETER|CHAT', // REQUIRED
            ],
            // ...
        ],
        'invocationId' => '<string>',
        'knowledgeBaseConfigurations' => [
            [
                'knowledgeBaseId' => '<string>', // REQUIRED
                'retrievalConfiguration' => [ // REQUIRED
                    'vectorSearchConfiguration' => [ // REQUIRED
                        'filter' => [
                            'andAll' => [
                                [...], // RECURSIVE
                                // ...
                            ],
                            'equals' => [
                                'key' => '<string>', // REQUIRED
                                'value' => [ // REQUIRED
                                ],
                            ],
                            'greaterThan' => [
                                'key' => '<string>', // REQUIRED
                                'value' => [ // REQUIRED
                                ],
                            ],
                            'greaterThanOrEquals' => [
                                'key' => '<string>', // REQUIRED
                                'value' => [ // REQUIRED
                                ],
                            ],
                            'in' => [
                                'key' => '<string>', // REQUIRED
                                'value' => [ // REQUIRED
                                ],
                            ],
                            'lessThan' => [
                                'key' => '<string>', // REQUIRED
                                'value' => [ // REQUIRED
                                ],
                            ],
                            'lessThanOrEquals' => [
                                'key' => '<string>', // REQUIRED
                                'value' => [ // REQUIRED
                                ],
                            ],
                            'listContains' => [
                                'key' => '<string>', // REQUIRED
                                'value' => [ // REQUIRED
                                ],
                            ],
                            'notEquals' => [
                                'key' => '<string>', // REQUIRED
                                'value' => [ // REQUIRED
                                ],
                            ],
                            'notIn' => [
                                'key' => '<string>', // REQUIRED
                                'value' => [ // REQUIRED
                                ],
                            ],
                            'orAll' => [
                                [...], // RECURSIVE
                                // ...
                            ],
                            'startsWith' => [
                                'key' => '<string>', // REQUIRED
                                'value' => [ // REQUIRED
                                ],
                            ],
                            'stringContains' => [
                                'key' => '<string>', // REQUIRED
                                'value' => [ // REQUIRED
                                ],
                            ],
                        ],
                        'numberOfResults' => <integer>,
                        'overrideSearchType' => 'HYBRID|SEMANTIC',
                    ],
                ],
            ],
            // ...
        ],
        'promptSessionAttributes' => ['<string>', ...],
        'returnControlInvocationResults' => [
            [
                'apiResult' => [
                    'actionGroup' => '<string>', // REQUIRED
                    'apiPath' => '<string>',
                    'confirmationState' => 'CONFIRM|DENY',
                    'httpMethod' => '<string>',
                    'httpStatusCode' => <integer>,
                    'responseBody' => [
                        '<String>' => [
                            'body' => '<string>',
                        ],
                        // ...
                    ],
                    'responseState' => 'FAILURE|REPROMPT',
                ],
                'functionResult' => [
                    'actionGroup' => '<string>', // REQUIRED
                    'confirmationState' => 'CONFIRM|DENY',
                    'function' => '<string>',
                    'responseBody' => [
                        '<String>' => [
                            'body' => '<string>',
                        ],
                        // ...
                    ],
                    'responseState' => 'FAILURE|REPROMPT',
                ],
            ],
            // ...
        ],
        'sessionAttributes' => ['<string>', ...],
    ],
]);

Parameter Details

Members
agentAliasId
Required: Yes
Type: string

The alias of the agent to use.

agentId
Required: Yes
Type: string

The unique identifier of the agent to use.

enableTrace
Type: boolean

Specifies whether to turn on the trace or not to track the agent's reasoning process. For more information, see Trace enablement.

endSession
Type: boolean

Specifies whether to end the session with the agent or not.

inputText
Type: string

The prompt text to send the agent.

If you include returnControlInvocationResults in the sessionState field, the inputText field will be ignored.

memoryId
Type: string

The unique identifier of the agent memory.

sessionId
Required: Yes
Type: string

The unique identifier of the session. Use the same value across requests to continue the same conversation.

sessionState
Type: SessionState structure

Contains parameters that specify various attributes of the session. For more information, see Control session context.

If you include returnControlInvocationResults in the sessionState field, the inputText field will be ignored.

Result Syntax

[
    'completion' => [ // EventParsingIterator
        'accessDeniedException' => [
            'message' => '<string>',
        ],
        'badGatewayException' => [
            'message' => '<string>',
            'resourceName' => '<string>',
        ],
        'chunk' => [
            'attribution' => [
                'citations' => [
                    [
                        'generatedResponsePart' => [
                            'textResponsePart' => [
                                'span' => [
                                    'end' => <integer>,
                                    'start' => <integer>,
                                ],
                                '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' => [
                                    '<RetrievalResultMetadataKey>' => [
                                    ],
                                    // ...
                                ],
                            ],
                            // ...
                        ],
                    ],
                    // ...
                ],
            ],
            'bytes' => <string || resource || Psr\Http\Message\StreamInterface>,
        ],
        'conflictException' => [
            'message' => '<string>',
        ],
        'dependencyFailedException' => [
            'message' => '<string>',
            'resourceName' => '<string>',
        ],
        'files' => [
            'files' => [
                [
                    'bytes' => <string || resource || Psr\Http\Message\StreamInterface>,
                    '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' => [
            'agentAliasId' => '<string>',
            'agentId' => '<string>',
            'agentVersion' => '<string>',
            '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' => <integer>,
                            'stopSequences' => ['<string>', ...],
                            'temperature' => <float>,
                            'topK' => <integer>,
                            'topP' => <float>,
                        ],
                        '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' => <integer>,
                                'outputTokens' => <integer>,
                            ],
                        ],
                        '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' => [
                                        '<RetrievalResultMetadataKey>' => [
                                        ],
                                        // ...
                                    ],
                                ],
                                // ...
                            ],
                        ],
                        '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' => <integer>,
                            'stopSequences' => ['<string>', ...],
                            'temperature' => <float>,
                            'topK' => <integer>,
                            'topP' => <float>,
                        ],
                        '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' => <integer>,
                                'outputTokens' => <integer>,
                            ],
                        ],
                        'parsedResponse' => [
                            'text' => '<string>',
                        ],
                        'rawResponse' => [
                            'content' => '<string>',
                        ],
                        'traceId' => '<string>',
                    ],
                ],
                'preProcessingTrace' => [
                    'modelInvocationInput' => [
                        'inferenceConfiguration' => [
                            'maximumLength' => <integer>,
                            'stopSequences' => ['<string>', ...],
                            'temperature' => <float>,
                            'topK' => <integer>,
                            'topP' => <float>,
                        ],
                        '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' => <integer>,
                                'outputTokens' => <integer>,
                            ],
                        ],
                        'parsedResponse' => [
                            'isValid' => true || false,
                            'rationale' => '<string>',
                        ],
                        'rawResponse' => [
                            'content' => '<string>',
                        ],
                        'traceId' => '<string>',
                    ],
                ],
            ],
        ],
        'validationException' => [
            'message' => '<string>',
        ],
    ],
    'contentType' => '<string>',
    'memoryId' => '<string>',
    'sessionId' => '<string>',
]

Result Details

Members
completion

The agent's response to the user prompt.

contentType
Required: Yes
Type: string

The MIME type of the input data in the request. The default value is application/json.

memoryId
Type: string

The unique identifier of the agent memory.

sessionId
Required: Yes
Type: string

The unique identifier of the session with the agent.

Using an EventParsingIterator

To use an EventParsingIterator, you will need to loop over the events it will generate and check the top-level field to determine which type of event it is.

foreach($result['completion'] as $event) {
    if (isset($event['accessDeniedException'])) {
        // Handle the 'accessDeniedException' event.
    } else if (isset($event['badGatewayException'])) {
        // Handle the 'badGatewayException' event.
    } else if (isset($event['chunk'])) {
        // Handle the 'chunk' event.
    } else if (isset($event['conflictException'])) {
        // Handle the 'conflictException' event.
    } else if (isset($event['dependencyFailedException'])) {
        // Handle the 'dependencyFailedException' event.
    } else if (isset($event['files'])) {
        // Handle the 'files' event.
    } else if (isset($event['internalServerException'])) {
        // Handle the 'internalServerException' event.
    } else if (isset($event['resourceNotFoundException'])) {
        // Handle the 'resourceNotFoundException' event.
    } else if (isset($event['returnControl'])) {
        // Handle the 'returnControl' event.
    } else if (isset($event['serviceQuotaExceededException'])) {
        // Handle the 'serviceQuotaExceededException' event.
    } else if (isset($event['throttlingException'])) {
        // Handle the 'throttlingException' event.
    } else if (isset($event['trace'])) {
        // Handle the 'trace' event.
    } else if (isset($event['validationException'])) {
        // Handle the 'validationException' event.
    }
}

Errors

ConflictException:

There was a conflict performing an operation. Resolve the conflict and retry your request.

ResourceNotFoundException:

The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.

ValidationException:

Input validation failed. Check your request parameters and retry the request.

InternalServerException:

An internal server error occurred. Retry your request.

DependencyFailedException:

There was an issue with a dependency. Check the resource configurations and retry the request.

BadGatewayException:

There was an issue with a dependency due to a server issue. Retry your request.

ThrottlingException:

The number of requests exceeds the limit. Resubmit your request later.

AccessDeniedException:

The request is denied because of missing access permissions. Check your permissions and retry your request.

ServiceQuotaExceededException:

The number of requests exceeds the service quota. Resubmit your request later.

InvokeFlow

$result = $client->invokeFlow([/* ... */]);
$promise = $client->invokeFlowAsync([/* ... */]);

Invokes an alias of a flow to run the inputs that you specify and return the output of each node as a stream. If there's an error, the error is returned. For more information, see Test a flow in Amazon Bedrock in the Amazon Bedrock User Guide.

The CLI doesn't support streaming operations in Amazon Bedrock, including InvokeFlow.

Parameter Syntax

$result = $client->invokeFlow([
    'enableTrace' => true || false,
    'flowAliasIdentifier' => '<string>', // REQUIRED
    'flowIdentifier' => '<string>', // REQUIRED
    'inputs' => [ // REQUIRED
        [
            'content' => [ // REQUIRED
                'document' => [
                ],
            ],
            'nodeName' => '<string>', // REQUIRED
            'nodeOutputName' => '<string>', // REQUIRED
        ],
        // ...
    ],
]);

Parameter Details

Members
enableTrace
Type: boolean

Specifies whether to return the trace for the flow or not. Traces track inputs and outputs for nodes in the flow. For more information, see Track each step in your prompt flow by viewing its trace in Amazon Bedrock.

flowAliasIdentifier
Required: Yes
Type: string

The unique identifier of the flow alias.

flowIdentifier
Required: Yes
Type: string

The unique identifier of the flow.

inputs
Required: Yes
Type: Array of FlowInput structures

A list of objects, each containing information about an input into the flow.

Result Syntax

[
    'responseStream' => [ // EventParsingIterator
        'accessDeniedException' => [
            'message' => '<string>',
        ],
        'badGatewayException' => [
            'message' => '<string>',
            'resourceName' => '<string>',
        ],
        'conflictException' => [
            'message' => '<string>',
        ],
        'dependencyFailedException' => [
            'message' => '<string>',
            'resourceName' => '<string>',
        ],
        'flowCompletionEvent' => [
            'completionReason' => 'SUCCESS',
        ],
        'flowOutputEvent' => [
            'content' => [
                'document' => [
                ],
            ],
            'nodeName' => '<string>',
            'nodeType' => 'FlowInputNode|FlowOutputNode|LambdaFunctionNode|KnowledgeBaseNode|PromptNode|ConditionNode|LexNode',
        ],
        'flowTraceEvent' => [
            'trace' => [
                'conditionNodeResultTrace' => [
                    'nodeName' => '<string>',
                    'satisfiedConditions' => [
                        [
                            'conditionName' => '<string>',
                        ],
                        // ...
                    ],
                    'timestamp' => <DateTime>,
                ],
                'nodeInputTrace' => [
                    'fields' => [
                        [
                            'content' => [
                                'document' => [
                                ],
                            ],
                            'nodeInputName' => '<string>',
                        ],
                        // ...
                    ],
                    'nodeName' => '<string>',
                    'timestamp' => <DateTime>,
                ],
                'nodeOutputTrace' => [
                    'fields' => [
                        [
                            'content' => [
                                'document' => [
                                ],
                            ],
                            'nodeOutputName' => '<string>',
                        ],
                        // ...
                    ],
                    'nodeName' => '<string>',
                    'timestamp' => <DateTime>,
                ],
            ],
        ],
        'internalServerException' => [
            'message' => '<string>',
        ],
        'resourceNotFoundException' => [
            'message' => '<string>',
        ],
        'serviceQuotaExceededException' => [
            'message' => '<string>',
        ],
        'throttlingException' => [
            'message' => '<string>',
        ],
        'validationException' => [
            'message' => '<string>',
        ],
    ],
]

Result Details

Members
responseStream

The output of the flow, returned as a stream. If there's an error, the error is returned.

Using an EventParsingIterator

To use an EventParsingIterator, you will need to loop over the events it will generate and check the top-level field to determine which type of event it is.

foreach($result['responseStream'] as $event) {
    if (isset($event['accessDeniedException'])) {
        // Handle the 'accessDeniedException' event.
    } else if (isset($event['badGatewayException'])) {
        // Handle the 'badGatewayException' event.
    } else if (isset($event['conflictException'])) {
        // Handle the 'conflictException' event.
    } else if (isset($event['dependencyFailedException'])) {
        // Handle the 'dependencyFailedException' event.
    } else if (isset($event['flowCompletionEvent'])) {
        // Handle the 'flowCompletionEvent' event.
    } else if (isset($event['flowOutputEvent'])) {
        // Handle the 'flowOutputEvent' event.
    } else if (isset($event['flowTraceEvent'])) {
        // Handle the 'flowTraceEvent' event.
    } else if (isset($event['internalServerException'])) {
        // Handle the 'internalServerException' event.
    } else if (isset($event['resourceNotFoundException'])) {
        // Handle the 'resourceNotFoundException' event.
    } else if (isset($event['serviceQuotaExceededException'])) {
        // Handle the 'serviceQuotaExceededException' event.
    } else if (isset($event['throttlingException'])) {
        // Handle the 'throttlingException' event.
    } else if (isset($event['validationException'])) {
        // Handle the 'validationException' event.
    }
}

Errors

ConflictException:

There was a conflict performing an operation. Resolve the conflict and retry your request.

ResourceNotFoundException:

The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.

ValidationException:

Input validation failed. Check your request parameters and retry the request.

InternalServerException:

An internal server error occurred. Retry your request.

DependencyFailedException:

There was an issue with a dependency. Check the resource configurations and retry the request.

BadGatewayException:

There was an issue with a dependency due to a server issue. Retry your request.

ThrottlingException:

The number of requests exceeds the limit. Resubmit your request later.

AccessDeniedException:

The request is denied because of missing access permissions. Check your permissions and retry your request.

ServiceQuotaExceededException:

The number of requests exceeds the service quota. Resubmit your request later.

InvokeInlineAgent

$result = $client->invokeInlineAgent([/* ... */]);
$promise = $client->invokeInlineAgentAsync([/* ... */]);

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 subsequent InvokeInlineAgent 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.

The CLI doesn't support streaming operations in Amazon Bedrock, including InvokeInlineAgent.

Parameter Syntax

$result = $client->invokeInlineAgent([
    'actionGroups' => [
        [
            'actionGroupExecutor' => [
                'customControl' => 'RETURN_CONTROL',
                'lambda' => '<string>',
            ],
            'actionGroupName' => '<string>', // REQUIRED
            'apiSchema' => [
                'payload' => '<string>',
                's3' => [
                    's3BucketName' => '<string>',
                    's3ObjectKey' => '<string>',
                ],
            ],
            'description' => '<string>',
            'functionSchema' => [
                'functions' => [
                    [
                        'description' => '<string>',
                        'name' => '<string>', // REQUIRED
                        'parameters' => [
                            '<ParameterName>' => [
                                'description' => '<string>',
                                'required' => true || false,
                                'type' => 'string|number|integer|boolean|array', // REQUIRED
                            ],
                            // ...
                        ],
                        'requireConfirmation' => 'ENABLED|DISABLED',
                    ],
                    // ...
                ],
            ],
            'parentActionGroupSignature' => 'AMAZON.UserInput|AMAZON.CodeInterpreter',
        ],
        // ...
    ],
    'customerEncryptionKeyArn' => '<string>',
    'enableTrace' => true || false,
    'endSession' => true || false,
    'foundationModel' => '<string>', // REQUIRED
    'guardrailConfiguration' => [
        'guardrailIdentifier' => '<string>', // REQUIRED
        'guardrailVersion' => '<string>', // REQUIRED
    ],
    'idleSessionTTLInSeconds' => <integer>,
    'inlineSessionState' => [
        'files' => [
            [
                'name' => '<string>', // REQUIRED
                'source' => [ // REQUIRED
                    'byteContent' => [
                        'data' => <string || resource || Psr\Http\Message\StreamInterface>, // REQUIRED
                        'mediaType' => '<string>', // REQUIRED
                    ],
                    's3Location' => [
                        'uri' => '<string>', // REQUIRED
                    ],
                    'sourceType' => 'S3|BYTE_CONTENT', // REQUIRED
                ],
                'useCase' => 'CODE_INTERPRETER|CHAT', // REQUIRED
            ],
            // ...
        ],
        'invocationId' => '<string>',
        'promptSessionAttributes' => ['<string>', ...],
        'returnControlInvocationResults' => [
            [
                'apiResult' => [
                    'actionGroup' => '<string>', // REQUIRED
                    'apiPath' => '<string>',
                    'confirmationState' => 'CONFIRM|DENY',
                    'httpMethod' => '<string>',
                    'httpStatusCode' => <integer>,
                    'responseBody' => [
                        '<String>' => [
                            'body' => '<string>',
                        ],
                        // ...
                    ],
                    'responseState' => 'FAILURE|REPROMPT',
                ],
                'functionResult' => [
                    'actionGroup' => '<string>', // REQUIRED
                    'confirmationState' => 'CONFIRM|DENY',
                    'function' => '<string>',
                    'responseBody' => [
                        '<String>' => [
                            'body' => '<string>',
                        ],
                        // ...
                    ],
                    'responseState' => 'FAILURE|REPROMPT',
                ],
            ],
            // ...
        ],
        'sessionAttributes' => ['<string>', ...],
    ],
    'inputText' => '<string>',
    'instruction' => '<string>', // REQUIRED
    'knowledgeBases' => [
        [
            'description' => '<string>', // REQUIRED
            'knowledgeBaseId' => '<string>', // REQUIRED
            'retrievalConfiguration' => [
                'vectorSearchConfiguration' => [ // REQUIRED
                    'filter' => [
                        'andAll' => [
                            [...], // RECURSIVE
                            // ...
                        ],
                        'equals' => [
                            'key' => '<string>', // REQUIRED
                            'value' => [ // REQUIRED
                            ],
                        ],
                        'greaterThan' => [
                            'key' => '<string>', // REQUIRED
                            'value' => [ // REQUIRED
                            ],
                        ],
                        'greaterThanOrEquals' => [
                            'key' => '<string>', // REQUIRED
                            'value' => [ // REQUIRED
                            ],
                        ],
                        'in' => [
                            'key' => '<string>', // REQUIRED
                            'value' => [ // REQUIRED
                            ],
                        ],
                        'lessThan' => [
                            'key' => '<string>', // REQUIRED
                            'value' => [ // REQUIRED
                            ],
                        ],
                        'lessThanOrEquals' => [
                            'key' => '<string>', // REQUIRED
                            'value' => [ // REQUIRED
                            ],
                        ],
                        'listContains' => [
                            'key' => '<string>', // REQUIRED
                            'value' => [ // REQUIRED
                            ],
                        ],
                        'notEquals' => [
                            'key' => '<string>', // REQUIRED
                            'value' => [ // REQUIRED
                            ],
                        ],
                        'notIn' => [
                            'key' => '<string>', // REQUIRED
                            'value' => [ // REQUIRED
                            ],
                        ],
                        'orAll' => [
                            [...], // RECURSIVE
                            // ...
                        ],
                        'startsWith' => [
                            'key' => '<string>', // REQUIRED
                            'value' => [ // REQUIRED
                            ],
                        ],
                        'stringContains' => [
                            'key' => '<string>', // REQUIRED
                            'value' => [ // REQUIRED
                            ],
                        ],
                    ],
                    'numberOfResults' => <integer>,
                    'overrideSearchType' => 'HYBRID|SEMANTIC',
                ],
            ],
        ],
        // ...
    ],
    'promptOverrideConfiguration' => [
        'overrideLambda' => '<string>',
        'promptConfigurations' => [ // REQUIRED
            [
                'basePromptTemplate' => '<string>',
                'inferenceConfiguration' => [
                    'maximumLength' => <integer>,
                    'stopSequences' => ['<string>', ...],
                    'temperature' => <float>,
                    'topK' => <integer>,
                    'topP' => <float>,
                ],
                'parserMode' => 'DEFAULT|OVERRIDDEN',
                'promptCreationMode' => 'DEFAULT|OVERRIDDEN',
                'promptState' => 'ENABLED|DISABLED',
                'promptType' => 'PRE_PROCESSING|ORCHESTRATION|KNOWLEDGE_BASE_RESPONSE_GENERATION|POST_PROCESSING|ROUTING_CLASSIFIER',
            ],
            // ...
        ],
    ],
    'sessionId' => '<string>', // REQUIRED
]);

Parameter Details

Members
actionGroups
Type: Array of AgentActionGroup structures

A list of action groups with each action group defining the action the inline agent needs to carry out.

customerEncryptionKeyArn
Type: string

The Amazon Resource Name (ARN) of the Amazon Web Services KMS key to use to encrypt your inline agent.

enableTrace
Type: 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
Type: boolean

Specifies whether to end the session with the inline agent or not.

foundationModel
Required: Yes
Type: string

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

The guardrails to assign to the inline agent.

idleSessionTTLInSeconds
Type: int

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
Type: InlineSessionState structure

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.

If you include returnControlInvocationResults in the sessionState field, the inputText field will be ignored.

inputText
Type: string

The prompt text to send to the agent.

If you include returnControlInvocationResults in the sessionState field, the inputText field will be ignored.

instruction
Required: Yes
Type: string

The instructions that tell the inline agent what it should do and how it should interact with users.

knowledgeBases
Type: Array of KnowledgeBase structures

Contains information of the knowledge bases to associate with.

promptOverrideConfiguration
Type: PromptOverrideConfiguration structure

Configurations for advanced prompts used to override the default prompts to enhance the accuracy of the inline agent.

sessionId
Required: Yes
Type: string

The unique identifier of the session. Use the same value across requests to continue the same conversation.

Result Syntax

[
    'completion' => [ // EventParsingIterator
        'accessDeniedException' => [
            'message' => '<string>',
        ],
        'badGatewayException' => [
            'message' => '<string>',
            'resourceName' => '<string>',
        ],
        'chunk' => [
            'attribution' => [
                'citations' => [
                    [
                        'generatedResponsePart' => [
                            'textResponsePart' => [
                                'span' => [
                                    'end' => <integer>,
                                    'start' => <integer>,
                                ],
                                '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' => [
                                    '<RetrievalResultMetadataKey>' => [
                                    ],
                                    // ...
                                ],
                            ],
                            // ...
                        ],
                    ],
                    // ...
                ],
            ],
            'bytes' => <string || resource || Psr\Http\Message\StreamInterface>,
        ],
        'conflictException' => [
            'message' => '<string>',
        ],
        'dependencyFailedException' => [
            'message' => '<string>',
            'resourceName' => '<string>',
        ],
        'files' => [
            'files' => [
                [
                    'bytes' => <string || resource || Psr\Http\Message\StreamInterface>,
                    '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' => <integer>,
                            'stopSequences' => ['<string>', ...],
                            'temperature' => <float>,
                            'topK' => <integer>,
                            'topP' => <float>,
                        ],
                        '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' => <integer>,
                                'outputTokens' => <integer>,
                            ],
                        ],
                        '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' => [
                                        '<RetrievalResultMetadataKey>' => [
                                        ],
                                        // ...
                                    ],
                                ],
                                // ...
                            ],
                        ],
                        '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' => <integer>,
                            'stopSequences' => ['<string>', ...],
                            'temperature' => <float>,
                            'topK' => <integer>,
                            'topP' => <float>,
                        ],
                        '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' => <integer>,
                                'outputTokens' => <integer>,
                            ],
                        ],
                        'parsedResponse' => [
                            'text' => '<string>',
                        ],
                        'rawResponse' => [
                            'content' => '<string>',
                        ],
                        'traceId' => '<string>',
                    ],
                ],
                'preProcessingTrace' => [
                    'modelInvocationInput' => [
                        'inferenceConfiguration' => [
                            'maximumLength' => <integer>,
                            'stopSequences' => ['<string>', ...],
                            'temperature' => <float>,
                            'topK' => <integer>,
                            'topP' => <float>,
                        ],
                        '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' => <integer>,
                                'outputTokens' => <integer>,
                            ],
                        ],
                        'parsedResponse' => [
                            'isValid' => true || false,
                            'rationale' => '<string>',
                        ],
                        'rawResponse' => [
                            'content' => '<string>',
                        ],
                        'traceId' => '<string>',
                    ],
                ],
            ],
        ],
        'validationException' => [
            'message' => '<string>',
        ],
    ],
    'contentType' => '<string>',
    'sessionId' => '<string>',
]

Result Details

Members
completion

 </p> 
contentType
Required: Yes
Type: string

The MIME type of the input data in the request. The default value is application/json.

sessionId
Required: Yes
Type: string

The unique identifier of the session with the agent.

Using an EventParsingIterator

To use an EventParsingIterator, you will need to loop over the events it will generate and check the top-level field to determine which type of event it is.

foreach($result['completion'] as $event) {
    if (isset($event['accessDeniedException'])) {
        // Handle the 'accessDeniedException' event.
    } else if (isset($event['badGatewayException'])) {
        // Handle the 'badGatewayException' event.
    } else if (isset($event['chunk'])) {
        // Handle the 'chunk' event.
    } else if (isset($event['conflictException'])) {
        // Handle the 'conflictException' event.
    } else if (isset($event['dependencyFailedException'])) {
        // Handle the 'dependencyFailedException' event.
    } else if (isset($event['files'])) {
        // Handle the 'files' event.
    } else if (isset($event['internalServerException'])) {
        // Handle the 'internalServerException' event.
    } else if (isset($event['resourceNotFoundException'])) {
        // Handle the 'resourceNotFoundException' event.
    } else if (isset($event['returnControl'])) {
        // Handle the 'returnControl' event.
    } else if (isset($event['serviceQuotaExceededException'])) {
        // Handle the 'serviceQuotaExceededException' event.
    } else if (isset($event['throttlingException'])) {
        // Handle the 'throttlingException' event.
    } else if (isset($event['trace'])) {
        // Handle the 'trace' event.
    } else if (isset($event['validationException'])) {
        // Handle the 'validationException' event.
    }
}

Errors

ConflictException:

There was a conflict performing an operation. Resolve the conflict and retry your request.

ResourceNotFoundException:

The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.

ValidationException:

Input validation failed. Check your request parameters and retry the request.

InternalServerException:

An internal server error occurred. Retry your request.

DependencyFailedException:

There was an issue with a dependency. Check the resource configurations and retry the request.

BadGatewayException:

There was an issue with a dependency due to a server issue. Retry your request.

ThrottlingException:

The number of requests exceeds the limit. Resubmit your request later.

AccessDeniedException:

The request is denied because of missing access permissions. Check your permissions and retry your request.

ServiceQuotaExceededException:

The number of requests exceeds the service quota. Resubmit your request later.

OptimizePrompt

$result = $client->optimizePrompt([/* ... */]);
$promise = $client->optimizePromptAsync([/* ... */]);

Optimizes a prompt for the task that you specify. For more information, see Optimize a prompt in the Amazon Bedrock User Guide.

Parameter Syntax

$result = $client->optimizePrompt([
    'input' => [ // REQUIRED
        'textPrompt' => [
            'text' => '<string>', // REQUIRED
        ],
    ],
    'targetModelId' => '<string>', // REQUIRED
]);

Parameter Details

Members
input
Required: Yes
Type: InputPrompt structure

Contains the prompt to optimize.

targetModelId
Required: Yes
Type: string

The unique identifier of the model that you want to optimize the prompt for.

Result Syntax

[
    'optimizedPrompt' => [ // EventParsingIterator
        'accessDeniedException' => [
            'message' => '<string>',
        ],
        'analyzePromptEvent' => [
            'message' => '<string>',
        ],
        'badGatewayException' => [
            'message' => '<string>',
            'resourceName' => '<string>',
        ],
        'dependencyFailedException' => [
            'message' => '<string>',
            'resourceName' => '<string>',
        ],
        'internalServerException' => [
            'message' => '<string>',
        ],
        'optimizedPromptEvent' => [
            'optimizedPrompt' => [
                'textPrompt' => [
                    'text' => '<string>',
                ],
            ],
        ],
        'throttlingException' => [
            'message' => '<string>',
        ],
        'validationException' => [
            'message' => '<string>',
        ],
    ],
]

Result Details

Members
optimizedPrompt

The prompt after being optimized for the task.

Using an EventParsingIterator

To use an EventParsingIterator, you will need to loop over the events it will generate and check the top-level field to determine which type of event it is.

foreach($result['optimizedPrompt'] as $event) {
    if (isset($event['accessDeniedException'])) {
        // Handle the 'accessDeniedException' event.
    } else if (isset($event['analyzePromptEvent'])) {
        // Handle the 'analyzePromptEvent' event.
    } else if (isset($event['badGatewayException'])) {
        // Handle the 'badGatewayException' event.
    } else if (isset($event['dependencyFailedException'])) {
        // Handle the 'dependencyFailedException' event.
    } else if (isset($event['internalServerException'])) {
        // Handle the 'internalServerException' event.
    } else if (isset($event['optimizedPromptEvent'])) {
        // Handle the 'optimizedPromptEvent' event.
    } else if (isset($event['throttlingException'])) {
        // Handle the 'throttlingException' event.
    } else if (isset($event['validationException'])) {
        // Handle the 'validationException' event.
    }
}

Errors

ValidationException:

Input validation failed. Check your request parameters and retry the request.

InternalServerException:

An internal server error occurred. Retry your request.

DependencyFailedException:

There was an issue with a dependency. Check the resource configurations and retry the request.

BadGatewayException:

There was an issue with a dependency due to a server issue. Retry your request.

ThrottlingException:

The number of requests exceeds the limit. Resubmit your request later.

AccessDeniedException:

The request is denied because of missing access permissions. Check your permissions and retry your request.

Retrieve

$result = $client->retrieve([/* ... */]);
$promise = $client->retrieveAsync([/* ... */]);

Queries a knowledge base and retrieves information from it.

Parameter Syntax

$result = $client->retrieve([
    'knowledgeBaseId' => '<string>', // REQUIRED
    'nextToken' => '<string>',
    'retrievalConfiguration' => [
        'vectorSearchConfiguration' => [ // REQUIRED
            'filter' => [
                'andAll' => [
                    [...], // RECURSIVE
                    // ...
                ],
                'equals' => [
                    'key' => '<string>', // REQUIRED
                    'value' => [ // REQUIRED
                    ],
                ],
                'greaterThan' => [
                    'key' => '<string>', // REQUIRED
                    'value' => [ // REQUIRED
                    ],
                ],
                'greaterThanOrEquals' => [
                    'key' => '<string>', // REQUIRED
                    'value' => [ // REQUIRED
                    ],
                ],
                'in' => [
                    'key' => '<string>', // REQUIRED
                    'value' => [ // REQUIRED
                    ],
                ],
                'lessThan' => [
                    'key' => '<string>', // REQUIRED
                    'value' => [ // REQUIRED
                    ],
                ],
                'lessThanOrEquals' => [
                    'key' => '<string>', // REQUIRED
                    'value' => [ // REQUIRED
                    ],
                ],
                'listContains' => [
                    'key' => '<string>', // REQUIRED
                    'value' => [ // REQUIRED
                    ],
                ],
                'notEquals' => [
                    'key' => '<string>', // REQUIRED
                    'value' => [ // REQUIRED
                    ],
                ],
                'notIn' => [
                    'key' => '<string>', // REQUIRED
                    'value' => [ // REQUIRED
                    ],
                ],
                'orAll' => [
                    [...], // RECURSIVE
                    // ...
                ],
                'startsWith' => [
                    'key' => '<string>', // REQUIRED
                    'value' => [ // REQUIRED
                    ],
                ],
                'stringContains' => [
                    'key' => '<string>', // REQUIRED
                    'value' => [ // REQUIRED
                    ],
                ],
            ],
            'numberOfResults' => <integer>,
            'overrideSearchType' => 'HYBRID|SEMANTIC',
        ],
    ],
    'retrievalQuery' => [ // REQUIRED
        'text' => '<string>', // REQUIRED
    ],
]);

Parameter Details

Members
knowledgeBaseId
Required: Yes
Type: string

The unique identifier of the knowledge base to query.

nextToken
Type: string

If there are more results than can fit in the response, the response returns a nextToken. Use this token in the nextToken field of another request to retrieve the next batch of results.

retrievalConfiguration

Contains configurations for the knowledge base query and retrieval process. For more information, see Query configurations.

retrievalQuery
Required: Yes
Type: KnowledgeBaseQuery structure

Contains the query to send the knowledge base.

Result Syntax

[
    'nextToken' => '<string>',
    'retrievalResults' => [
        [
            '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' => [
                '<RetrievalResultMetadataKey>' => [
                ],
                // ...
            ],
            'score' => <float>,
        ],
        // ...
    ],
]

Result Details

Members
nextToken
Type: string

If there are more results than can fit in the response, the response returns a nextToken. Use this token in the nextToken field of another request to retrieve the next batch of results.

retrievalResults
Required: Yes
Type: Array of KnowledgeBaseRetrievalResult structures

A list of results from querying the knowledge base.

Errors

ConflictException:

There was a conflict performing an operation. Resolve the conflict and retry your request.

ResourceNotFoundException:

The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.

ValidationException:

Input validation failed. Check your request parameters and retry the request.

InternalServerException:

An internal server error occurred. Retry your request.

DependencyFailedException:

There was an issue with a dependency. Check the resource configurations and retry the request.

BadGatewayException:

There was an issue with a dependency due to a server issue. Retry your request.

ThrottlingException:

The number of requests exceeds the limit. Resubmit your request later.

AccessDeniedException:

The request is denied because of missing access permissions. Check your permissions and retry your request.

ServiceQuotaExceededException:

The number of requests exceeds the service quota. Resubmit your request later.

RetrieveAndGenerate

$result = $client->retrieveAndGenerate([/* ... */]);
$promise = $client->retrieveAndGenerateAsync([/* ... */]);

Queries a knowledge base and generates responses based on the retrieved results and using the specified foundation model or inference profile. The response only cites sources that are relevant to the query.

Parameter Syntax

$result = $client->retrieveAndGenerate([
    'input' => [ // REQUIRED
        'text' => '<string>', // REQUIRED
    ],
    'retrieveAndGenerateConfiguration' => [
        'externalSourcesConfiguration' => [
            'generationConfiguration' => [
                'additionalModelRequestFields' => [
                    '<AdditionalModelRequestFieldsKey>' => [
                    ],
                    // ...
                ],
                'guardrailConfiguration' => [
                    'guardrailId' => '<string>', // REQUIRED
                    'guardrailVersion' => '<string>', // REQUIRED
                ],
                'inferenceConfig' => [
                    'textInferenceConfig' => [
                        'maxTokens' => <integer>,
                        'stopSequences' => ['<string>', ...],
                        'temperature' => <float>,
                        'topP' => <float>,
                    ],
                ],
                'promptTemplate' => [
                    'textPromptTemplate' => '<string>',
                ],
            ],
            'modelArn' => '<string>', // REQUIRED
            'sources' => [ // REQUIRED
                [
                    'byteContent' => [
                        'contentType' => '<string>', // REQUIRED
                        'data' => <string || resource || Psr\Http\Message\StreamInterface>, // REQUIRED
                        'identifier' => '<string>', // REQUIRED
                    ],
                    's3Location' => [
                        'uri' => '<string>', // REQUIRED
                    ],
                    'sourceType' => 'S3|BYTE_CONTENT', // REQUIRED
                ],
                // ...
            ],
        ],
        'knowledgeBaseConfiguration' => [
            'generationConfiguration' => [
                'additionalModelRequestFields' => [
                    '<AdditionalModelRequestFieldsKey>' => [
                    ],
                    // ...
                ],
                'guardrailConfiguration' => [
                    'guardrailId' => '<string>', // REQUIRED
                    'guardrailVersion' => '<string>', // REQUIRED
                ],
                'inferenceConfig' => [
                    'textInferenceConfig' => [
                        'maxTokens' => <integer>,
                        'stopSequences' => ['<string>', ...],
                        'temperature' => <float>,
                        'topP' => <float>,
                    ],
                ],
                'promptTemplate' => [
                    'textPromptTemplate' => '<string>',
                ],
            ],
            'knowledgeBaseId' => '<string>', // REQUIRED
            'modelArn' => '<string>', // REQUIRED
            'orchestrationConfiguration' => [
                'additionalModelRequestFields' => [
                    '<AdditionalModelRequestFieldsKey>' => [
                    ],
                    // ...
                ],
                'inferenceConfig' => [
                    'textInferenceConfig' => [
                        'maxTokens' => <integer>,
                        'stopSequences' => ['<string>', ...],
                        'temperature' => <float>,
                        'topP' => <float>,
                    ],
                ],
                'promptTemplate' => [
                    'textPromptTemplate' => '<string>',
                ],
                'queryTransformationConfiguration' => [
                    'type' => 'QUERY_DECOMPOSITION', // REQUIRED
                ],
            ],
            'retrievalConfiguration' => [
                'vectorSearchConfiguration' => [ // REQUIRED
                    'filter' => [
                        'andAll' => [
                            [...], // RECURSIVE
                            // ...
                        ],
                        'equals' => [
                            'key' => '<string>', // REQUIRED
                            'value' => [ // REQUIRED
                            ],
                        ],
                        'greaterThan' => [
                            'key' => '<string>', // REQUIRED
                            'value' => [ // REQUIRED
                            ],
                        ],
                        'greaterThanOrEquals' => [
                            'key' => '<string>', // REQUIRED
                            'value' => [ // REQUIRED
                            ],
                        ],
                        'in' => [
                            'key' => '<string>', // REQUIRED
                            'value' => [ // REQUIRED
                            ],
                        ],
                        'lessThan' => [
                            'key' => '<string>', // REQUIRED
                            'value' => [ // REQUIRED
                            ],
                        ],
                        'lessThanOrEquals' => [
                            'key' => '<string>', // REQUIRED
                            'value' => [ // REQUIRED
                            ],
                        ],
                        'listContains' => [
                            'key' => '<string>', // REQUIRED
                            'value' => [ // REQUIRED
                            ],
                        ],
                        'notEquals' => [
                            'key' => '<string>', // REQUIRED
                            'value' => [ // REQUIRED
                            ],
                        ],
                        'notIn' => [
                            'key' => '<string>', // REQUIRED
                            'value' => [ // REQUIRED
                            ],
                        ],
                        'orAll' => [
                            [...], // RECURSIVE
                            // ...
                        ],
                        'startsWith' => [
                            'key' => '<string>', // REQUIRED
                            'value' => [ // REQUIRED
                            ],
                        ],
                        'stringContains' => [
                            'key' => '<string>', // REQUIRED
                            'value' => [ // REQUIRED
                            ],
                        ],
                    ],
                    'numberOfResults' => <integer>,
                    'overrideSearchType' => 'HYBRID|SEMANTIC',
                ],
            ],
        ],
        'type' => 'KNOWLEDGE_BASE|EXTERNAL_SOURCES', // REQUIRED
    ],
    'sessionConfiguration' => [
        'kmsKeyArn' => '<string>', // REQUIRED
    ],
    'sessionId' => '<string>',
]);

Parameter Details

Members
input
Required: Yes
Type: RetrieveAndGenerateInput structure

Contains the query to be made to the knowledge base.

retrieveAndGenerateConfiguration

Contains configurations for the knowledge base query and retrieval process. For more information, see Query configurations.

sessionConfiguration

Contains details about the session with the knowledge base.

sessionId
Type: string

The unique identifier of the session. When you first make a RetrieveAndGenerate request, Amazon Bedrock automatically generates this value. You must reuse this value for all subsequent requests in the same conversational session. This value allows Amazon Bedrock to maintain context and knowledge from previous interactions. You can't explicitly set the sessionId yourself.

Result Syntax

[
    'citations' => [
        [
            'generatedResponsePart' => [
                'textResponsePart' => [
                    'span' => [
                        'end' => <integer>,
                        'start' => <integer>,
                    ],
                    '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' => [
                        '<RetrievalResultMetadataKey>' => [
                        ],
                        // ...
                    ],
                ],
                // ...
            ],
        ],
        // ...
    ],
    'guardrailAction' => 'INTERVENED|NONE',
    'output' => [
        'text' => '<string>',
    ],
    'sessionId' => '<string>',
]

Result Details

Members
citations
Type: Array of Citation structures

A list of segments of the generated response that are based on sources in the knowledge base, alongside information about the sources.

guardrailAction
Type: string

Specifies if there is a guardrail intervention in the response.

output
Required: Yes
Type: RetrieveAndGenerateOutput structure

Contains the response generated from querying the knowledge base.

sessionId
Required: Yes
Type: string

The unique identifier of the session. When you first make a RetrieveAndGenerate request, Amazon Bedrock automatically generates this value. You must reuse this value for all subsequent requests in the same conversational session. This value allows Amazon Bedrock to maintain context and knowledge from previous interactions. You can't explicitly set the sessionId yourself.

Errors

ConflictException:

There was a conflict performing an operation. Resolve the conflict and retry your request.

ResourceNotFoundException:

The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.

ValidationException:

Input validation failed. Check your request parameters and retry the request.

InternalServerException:

An internal server error occurred. Retry your request.

DependencyFailedException:

There was an issue with a dependency. Check the resource configurations and retry the request.

BadGatewayException:

There was an issue with a dependency due to a server issue. Retry your request.

ThrottlingException:

The number of requests exceeds the limit. Resubmit your request later.

AccessDeniedException:

The request is denied because of missing access permissions. Check your permissions and retry your request.

ServiceQuotaExceededException:

The number of requests exceeds the service quota. Resubmit your request later.

Shapes

APISchema

Description

Contains details about the OpenAPI schema for the action group. For more information, see Action group OpenAPI schemas. You can either include the schema directly in the payload field or you can upload it to an S3 bucket and specify the S3 bucket location in the s3 field.

Members
payload
Type: string

The JSON or YAML-formatted payload defining the OpenAPI schema for the action group.

s3
Type: S3Identifier structure

Contains details about the S3 object containing the OpenAPI schema for the action group.

AccessDeniedException

Description

The request is denied because of missing access permissions. Check your permissions and retry your request.

Members
message
Type: string

ActionGroupExecutor

Description

Contains details about 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.

Members
customControl
Type: string

To return the action group invocation results directly in the InvokeInlineAgent response, specify RETURN_CONTROL.

lambda
Type: string

The Amazon Resource Name (ARN) of the Lambda function containing the business logic that is carried out upon invoking the action.

ActionGroupInvocationInput

Description

Contains information about the action group being invoked. For more information about the possible structures, see the InvocationInput tab in OrchestrationTrace in the Amazon Bedrock User Guide.

Members
actionGroupName
Type: string

The name of the action group.

apiPath
Type: string

The path to the API to call, based off the action group.

executionType
Type: string

How fulfillment of the action is handled. For more information, see Handling fulfillment of the action.

function
Type: string

The function in the action group to call.

invocationId
Type: string

The unique identifier of the invocation. Only returned if the executionType is RETURN_CONTROL.

parameters
Type: Array of Parameter structures

The parameters in the Lambda input event.

requestBody
Type: RequestBody structure

The parameters in the request body for the Lambda input event.

verb
Type: string

The API method being used, based off the action group.

ActionGroupInvocationOutput

Description

Contains the JSON-formatted string returned by the API invoked by the action group.

Members
text
Type: string

The JSON-formatted string returned by the API invoked by the action group.

AdditionalModelRequestFieldsValue

Members

AgentActionGroup

Description

Contains details of the inline agent's action group.

Members
actionGroupExecutor
Type: ActionGroupExecutor structure

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.

actionGroupName
Required: Yes
Type: string

The name of the action group.

apiSchema
Type: APISchema structure

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.

description
Type: string

A description of the action group.

functionSchema
Type: FunctionSchema structure

Contains details about the function schema for the action group or the JSON or YAML-formatted payload defining the schema.

parentActionGroupSignature
Type: 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 the description, apiSchema, and actionGroupExecutor 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 the description, apiSchema, and actionGroupExecutor 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.

AnalyzePromptEvent

Description

An event in which the prompt was analyzed in preparation for optimization.

Members
message
Type: string

A message describing the analysis of the prompt.

ApiInvocationInput

Description

Contains information about the API operation that the agent predicts should be called.

This data type is used in the following API operations:

Members
actionGroup
Required: Yes
Type: string

The action group that the API operation belongs to.

actionInvocationType
Type: string

Contains information about the API operation to invoke.

apiPath
Type: string

The path to the API operation.

httpMethod
Type: string

The HTTP method of the API operation.

parameters
Type: Array of ApiParameter structures

The parameters to provide for the API request, as the agent elicited from the user.

requestBody
Type: ApiRequestBody structure

The request body to provide for the API request, as the agent elicited from the user.

ApiParameter

Description

Information about a parameter to provide to the API request.

This data type is used in the following API operations:

Members
name
Type: string

The name of the parameter.

type
Type: string

The data type for the parameter.

value
Type: string

The value of the parameter.

ApiRequestBody

Description

The request body to provide for the API request, as the agent elicited from the user.

This data type is used in the following API operations:

Members
content
Type: Associative array of custom strings keys (String) to PropertyParameters structures

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.

ApiResult

Description

Contains information about the API operation that was called from the action group and the response body that was returned.

This data type is used in the following API operations:

Members
actionGroup
Required: Yes
Type: string

The action group that the API operation belongs to.

apiPath
Type: string

The path to the API operation.

confirmationState
Type: string

Controls the API operations or functions to invoke based on the user confirmation.

httpMethod
Type: string

The HTTP method for the API operation.

httpStatusCode
Type: int

http status code from API execution response (for example: 200, 400, 500).

responseBody
Type: Associative array of custom strings keys (String) to ContentBody structures

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.

responseState
Type: 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

Attribution

Description

Contains citations for a part of an agent response.

Members
citations
Type: Array of Citation structures

A list of citations and related information for a part of an agent response.

BadGatewayException

Description

There was an issue with a dependency due to a server issue. Retry your request.

Members
message
Type: string
resourceName
Type: string

The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or STS.

ByteContentDoc

Description

This property contains the document to chat with, along with its attributes.

Members
contentType
Required: Yes
Type: string

The MIME type of the document contained in the wrapper object.

data
Required: Yes
Type: blob (string|resource|Psr\Http\Message\StreamInterface)

The byte value of the file to upload, encoded as a Base-64 string.

identifier
Required: Yes
Type: string

The file name of the document contained in the wrapper object.

ByteContentFile

Description

The property contains the file to chat with, along with its attributes.

Members
data
Required: Yes
Type: blob (string|resource|Psr\Http\Message\StreamInterface)

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
Required: Yes
Type: string

The MIME type of data contained in the file used for chat.

Citation

Description

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:

Members
generatedResponsePart
Type: GeneratedResponsePart structure

Contains the generated response and metadata

retrievedReferences
Type: Array of RetrievedReference structures

Contains metadata about the sources cited for the generated response.

CodeInterpreterInvocationInput

Description

Contains information about the code interpreter being invoked.

Members
code
Type: string

The code for the code interpreter to use.

files
Type: Array of strings

Files that are uploaded for code interpreter to use.

CodeInterpreterInvocationOutput

Description

Contains the JSON-formatted string returned by the API invoked by the code interpreter.

Members
executionError
Type: string

Contains the error returned from code execution.

executionOutput
Type: string

Contains the successful output returned from code execution

executionTimeout
Type: boolean

Indicates if the execution of the code timed out.

files
Type: Array of strings

Contains output files, if generated by code execution.

ConflictException

Description

There was a conflict performing an operation. Resolve the conflict and retry your request.

Members
message
Type: string

ContentBody

Description

Contains the body of the API response.

This data type is used in the following API operations:

Members
body
Type: string

The body of the API response.

DependencyFailedException

Description

There was an issue with a dependency. Check the resource configurations and retry the request.

Members
message
Type: string
resourceName
Type: string

The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or STS.

Document

Members

ExternalSource

Description

The unique external source of the content contained in the wrapper object.

Members
byteContent
Type: ByteContentDoc structure

The identifier, contentType, and data of the external source wrapper object.

s3Location
Type: S3ObjectDoc structure

The S3 location of the external source wrapper object.

sourceType
Required: Yes
Type: string

The source type of the external source wrapper object.

ExternalSourcesGenerationConfiguration

Description

Contains the generation configuration of the external source wrapper object.

Members
additionalModelRequestFields
Type: Associative array of custom strings keys (AdditionalModelRequestFieldsKey) to document (null|bool|string|numeric) or an (array|associative array) whose members are all valid documentss

Additional model parameters and their corresponding values not included in the textInferenceConfig structure for an external source. Takes in custom model parameters specific to the language model being used.

guardrailConfiguration
Type: GuardrailConfiguration structure

The configuration details for the guardrail.

inferenceConfig
Type: InferenceConfig structure

Configuration settings for inference when using RetrieveAndGenerate to generate responses while using an external source.

promptTemplate
Type: PromptTemplate structure

Contain the textPromptTemplate string for the external source wrapper object.

ExternalSourcesRetrieveAndGenerateConfiguration

Description

The configurations of the external source wrapper object in the retrieveAndGenerate function.

Members
generationConfiguration

The prompt used with the external source wrapper object with the retrieveAndGenerate function.

modelArn
Required: Yes
Type: string

The model Amazon Resource Name (ARN) for the external source wrapper object in the retrieveAndGenerate function.

sources
Required: Yes
Type: Array of ExternalSource structures

The document for the external source wrapper object in the retrieveAndGenerate function.

FailureTrace

Description

Contains information about the failure of the interaction.

Members
failureReason
Type: string

The reason the interaction failed.

traceId
Type: string

The unique identifier of the trace.

FilePart

Description

Contains intermediate response for code interpreter if any files have been generated.

Members
files
Type: Array of OutputFile structures

Files containing intermediate response for the user.

FileSource

Description

The source file of the content contained in the wrapper object.

Members
byteContent
Type: ByteContentFile structure

The data and the text of the attached files.

s3Location
Type: S3ObjectFile structure

The s3 location of the files to attach.

sourceType
Required: Yes
Type: string

The source type of the files to attach.

FilterAttribute

Description

Specifies the name that the metadata attribute must match and the value to which to compare the value of the metadata attribute. For more information, see Query configurations.

This data type is used in the following API operations:

Members
key
Required: Yes
Type: string

The name that the metadata attribute must match.

value
Required: Yes
Type: document (null|bool|string|numeric) or an (array|associative array) whose members are all valid documents

The value to whcih to compare the value of the metadata attribute.

FilterValue

Members

FinalResponse

Description

Contains details about the response to the user.

Members
text
Type: string

The text in the response to the user.

FlowCompletionEvent

Description

Contains information about why a flow completed.

Members
completionReason
Required: Yes
Type: string

The reason that the flow completed.

FlowInput

Description

Contains information about an input into the prompt flow and where to send it.

Members
content
Required: Yes
Type: FlowInputContent structure

Contains information about an input into the prompt flow.

nodeName
Required: Yes
Type: string

The name of the flow input node that begins the prompt flow.

nodeOutputName
Required: Yes
Type: string

The name of the output from the flow input node that begins the prompt flow.

FlowInputContent

Description

Contains information about an input into the flow.

Members
document
Type: document (null|bool|string|numeric) or an (array|associative array) whose members are all valid documents

The input to send to the prompt flow input node.

FlowOutputContent

Description

Contains information about the content in an output from prompt flow invocation.

Members
document
Type: document (null|bool|string|numeric) or an (array|associative array) whose members are all valid documents

The content in the output.

FlowOutputEvent

Description

Contains information about an output from prompt flow invoction.

Members
content
Required: Yes
Type: FlowOutputContent structure

The content in the output.

nodeName
Required: Yes
Type: string

The name of the flow output node that the output is from.

nodeType
Required: Yes
Type: string

The type of the node that the output is from.

FlowResponseStream

Description

The output of the flow.

Members
accessDeniedException
Type: AccessDeniedException structure

The request is denied because of missing access permissions. Check your permissions and retry your request.

badGatewayException
Type: BadGatewayException structure

There was an issue with a dependency due to a server issue. Retry your request.

conflictException
Type: ConflictException structure

There was a conflict performing an operation. Resolve the conflict and retry your request.

dependencyFailedException
Type: DependencyFailedException structure

There was an issue with a dependency. Check the resource configurations and retry the request.

flowCompletionEvent
Type: FlowCompletionEvent structure

Contains information about why the flow completed.

flowOutputEvent
Type: FlowOutputEvent structure

Contains information about an output from flow invocation.

flowTraceEvent
Type: FlowTraceEvent structure

Contains information about a trace, which tracks an input or output for a node in the flow.

internalServerException
Type: InternalServerException structure

An internal server error occurred. Retry your request.

resourceNotFoundException
Type: ResourceNotFoundException structure

The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.

serviceQuotaExceededException

The number of requests exceeds the service quota. Resubmit your request later.

throttlingException
Type: ThrottlingException structure

The number of requests exceeds the limit. Resubmit your request later.

validationException
Type: ValidationException structure

Input validation failed. Check your request parameters and retry the request.

FlowTrace

Description

Contains information about an input or output for a node in the flow. For more information, see Track each step in your prompt flow by viewing its trace in Amazon Bedrock.

Members
conditionNodeResultTrace

Contains information about an output from a condition node.

nodeInputTrace
Type: FlowTraceNodeInputEvent structure

Contains information about the input into a node.

nodeOutputTrace
Type: FlowTraceNodeOutputEvent structure

Contains information about the output from a node.

FlowTraceConditionNodeResultEvent

Description

Contains information about an output from a condition node. For more information, see Track each step in your prompt flow by viewing its trace in Amazon Bedrock.

Members
nodeName
Required: Yes
Type: string

The name of the condition node.

satisfiedConditions
Required: Yes
Type: Array of FlowTraceCondition structures

An array of objects containing information about the conditions that were satisfied.

timestamp
Required: Yes
Type: timestamp (string|DateTime or anything parsable by strtotime)

The date and time that the trace was returned.

FlowTraceNodeInputEvent

Description

Contains information about the input into a node. For more information, see Track each step in your prompt flow by viewing its trace in Amazon Bedrock.

Members
fields
Required: Yes
Type: Array of FlowTraceNodeInputField structures

An array of objects containing information about each field in the input.

nodeName
Required: Yes
Type: string

The name of the node that received the input.

timestamp
Required: Yes
Type: timestamp (string|DateTime or anything parsable by strtotime)

The date and time that the trace was returned.

FlowTraceNodeOutputEvent

Description

Contains information about the output from a node. For more information, see Track each step in your prompt flow by viewing its trace in Amazon Bedrock.

Members
fields
Required: Yes
Type: Array of FlowTraceNodeOutputField structures

An array of objects containing information about each field in the output.

nodeName
Required: Yes
Type: string

The name of the node that yielded the output.

timestamp
Required: Yes
Type: timestamp (string|DateTime or anything parsable by strtotime)

The date and time that the trace was returned.

FunctionDefinition

Description

Defines parameters that the agent needs to invoke from the user to complete the function. Corresponds to an action in an action group.

Members
description
Type: string

A description of the function and its purpose.

name
Required: Yes
Type: string

A name for the function.

parameters
Type: Associative array of custom strings keys (ParameterName) to ParameterDetail structures

The parameters that the agent elicits from the user to fulfill the function.

requireConfirmation
Type: string

Contains information if user confirmation is required to invoke the function.

FunctionInvocationInput

Description

Contains information about the function that the agent predicts should be called.

This data type is used in the following API operations:

Members
actionGroup
Required: Yes
Type: string

The action group that the function belongs to.

actionInvocationType
Type: string

Contains information about the function to invoke,

function
Type: string

The name of the function.

parameters
Type: Array of FunctionParameter structures

A list of parameters of the function.

FunctionParameter

Description

Contains information about a parameter of the function.

This data type is used in the following API operations:

Members
name
Type: string

The name of the parameter.

type
Type: string

The data type of the parameter.

value
Type: string

The value of the parameter.

FunctionResult

Description

Contains information about the function that was called from the action group and the response that was returned.

This data type is used in the following API operations:

Members
actionGroup
Required: Yes
Type: string

The action group that the function belongs to.

confirmationState
Type: string

Contains the user confirmation information about the function that was called.

function
Type: string

The name of the function that was called.

responseBody
Type: Associative array of custom strings keys (String) to ContentBody structures

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.

responseState
Type: 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

FunctionSchema

Description

Contains details about the function schema for the action group or the JSON or YAML-formatted payload defining the schema.

Members
functions
Type: Array of FunctionDefinition structures

A list of functions that each define an action in the action group.

GeneratedResponsePart

Description

Contains metadata about a part of the generated response that is accompanied by a citation.

This data type is used in the following API operations:

Members
textResponsePart
Type: TextResponsePart structure

Contains metadata about a textual part of the generated response that is accompanied by a citation.

GenerationConfiguration

Description

Contains configurations for response generation based on the knowledge base query results.

This data type is used in the following API operations:

Members
additionalModelRequestFields
Type: Associative array of custom strings keys (AdditionalModelRequestFieldsKey) to document (null|bool|string|numeric) or an (array|associative array) whose members are all valid documentss

Additional model parameters and corresponding values not included in the textInferenceConfig structure for a knowledge base. This allows users to provide custom model parameters specific to the language model being used.

guardrailConfiguration
Type: GuardrailConfiguration structure

The configuration details for the guardrail.

inferenceConfig
Type: InferenceConfig structure

Configuration settings for inference when using RetrieveAndGenerate to generate responses while using a knowledge base as a source.

promptTemplate
Type: PromptTemplate structure

Contains the template for the prompt that's sent to the model for response generation. Generation prompts must include the $search_results$ variable. For more information, see Use placeholder variables in the user guide.

GuardrailAssessment

Description

Assessment details of the content analyzed by Guardrails.

Members
contentPolicy

Content policy details of the Guardrail.

sensitiveInformationPolicy

Sensitive Information policy details of Guardrail.

topicPolicy

Topic policy details of the Guardrail.

wordPolicy

Word policy details of the Guardrail.

GuardrailConfiguration

Description

The configuration details for the guardrail.

Members
guardrailId
Required: Yes
Type: string

The unique identifier for the guardrail.

guardrailVersion
Required: Yes
Type: string

The version of the guardrail.

GuardrailConfigurationWithArn

Description

The configuration details for the guardrail.

Members
guardrailIdentifier
Required: Yes
Type: string

The unique identifier for the guardrail.

guardrailVersion
Required: Yes
Type: string

The version of the guardrail.

GuardrailContentFilter

Description

Details of the content filter used in the Guardrail.

Members
action
Type: string

The action placed on the content by the Guardrail filter.

confidence
Type: string

The confidence level regarding the content detected in the filter by the Guardrail.

type
Type: string

The type of content detected in the filter by the Guardrail.

GuardrailContentPolicyAssessment

Description

The details of the policy assessment in the Guardrails filter.

Members
filters
Type: Array of GuardrailContentFilter structures

The filter details of the policy assessment used in the Guardrails filter.

GuardrailCustomWord

Description

The custom word details for the filter in the Guardrail.

Members
action
Type: string

The action details for the custom word filter in the Guardrail.

match
Type: string

The match details for the custom word filter in the Guardrail.

GuardrailManagedWord

Description

The managed word details for the filter in the Guardrail.

Members
action
Type: string

The action details for the managed word filter in the Guardrail.

match
Type: string

The match details for the managed word filter in the Guardrail.

type
Type: string

The type details for the managed word filter in the Guardrail.

GuardrailPiiEntityFilter

Description

The Guardrail filter to identify and remove personally identifiable information (PII).

Members
action
Type: string

The action of the Guardrail filter to identify and remove PII.

match
Type: string

The match to settings in the Guardrail filter to identify and remove PII.

type
Type: string

The type of PII the Guardrail filter has identified and removed.

GuardrailRegexFilter

Description

The details for the regex filter used in the Guardrail.

Members
action
Type: string

The action details for the regex filter used in the Guardrail.

match
Type: string

The match details for the regex filter used in the Guardrail.

name
Type: string

The name details for the regex filter used in the Guardrail.

regex
Type: string

The regex details for the regex filter used in the Guardrail.

GuardrailSensitiveInformationPolicyAssessment

Description

The details of the sensitive policy assessment used in the Guardrail.

Members
piiEntities
Type: Array of GuardrailPiiEntityFilter structures

The details of the PII entities used in the sensitive policy assessment for the Guardrail.

regexes
Type: Array of GuardrailRegexFilter structures

The details of the regexes used in the sensitive policy assessment for the Guardrail.

GuardrailTopic

Description

The details for a specific topic defined in the Guardrail.

Members
action
Type: string

The action details on a specific topic in the Guardrail.

name
Type: string

The name details on a specific topic in the Guardrail.

type
Type: string

The type details on a specific topic in the Guardrail.

GuardrailTopicPolicyAssessment

Description

The details of the policy assessment used in the Guardrail.

Members
topics
Type: Array of GuardrailTopic structures

The topic details of the policy assessment used in the Guardrail.

GuardrailTrace

Description

The trace details used in the Guardrail.

Members
action
Type: string

The trace action details used with the Guardrail.

inputAssessments
Type: Array of GuardrailAssessment structures

The details of the input assessments used in the Guardrail Trace.

outputAssessments
Type: Array of GuardrailAssessment structures

The details of the output assessments used in the Guardrail Trace.

traceId
Type: string

The details of the trace Id used in the Guardrail Trace.

GuardrailWordPolicyAssessment

Description

The assessment details for words defined in the Guardrail filter.

Members
customWords
Type: Array of GuardrailCustomWord structures

The custom word details for words defined in the Guardrail filter.

managedWordLists
Type: Array of GuardrailManagedWord structures

The managed word lists for words defined in the Guardrail filter.

InferenceConfig

Description

The configuration for inference settings when generating responses using RetrieveAndGenerate.

Members
textInferenceConfig
Type: TextInferenceConfig structure

Configuration settings specific to text generation while generating responses using RetrieveAndGenerate.

InferenceConfiguration

Description

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.

Members
maximumLength
Type: int

The maximum number of tokens allowed in the generated response.

stopSequences
Type: Array of strings

A list of stop sequences. A stop sequence is a sequence of characters that causes the model to stop generating the response.

temperature
Type: 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
Type: int

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 set topK to 50, the model selects the next token from among the top 50 most likely choices.

topP
Type: 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 set topP to 0.8, the model only selects the next token from the top 80% of the probability distribution of next tokens.

InlineAgentFilePart

Description

Contains intermediate response for code interpreter if any files have been generated.

Members
files
Type: Array of OutputFile structures

Files containing intermediate response for the user.

InlineAgentPayloadPart

Description

Contains a part of an agent response and citations for it.

Members
attribution
Type: Attribution structure

Contains citations for a part of an agent response.

bytes
Type: blob (string|resource|Psr\Http\Message\StreamInterface)

A part of the agent response in bytes.

InlineAgentResponseStream

Description

The response from invoking the agent and associated citations and trace information.

Members
accessDeniedException
Type: AccessDeniedException structure

The request is denied because of missing access permissions. Check your permissions and retry your request.

badGatewayException
Type: BadGatewayException structure

There was an issue with a dependency due to a server issue. Retry your request.

chunk
Type: InlineAgentPayloadPart structure

Contains a part of an agent response and citations for it.

conflictException
Type: ConflictException structure

There was a conflict performing an operation. Resolve the conflict and retry your request.

dependencyFailedException
Type: DependencyFailedException structure

There was an issue with a dependency. Check the resource configurations and retry the request.

files
Type: InlineAgentFilePart structure

Contains intermediate response for code interpreter if any files have been generated.

internalServerException
Type: InternalServerException structure

An internal server error occurred. Retry your request.

resourceNotFoundException
Type: ResourceNotFoundException structure

The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.

returnControl

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.

serviceQuotaExceededException

The number of requests exceeds the service quota. Resubmit your request later.

throttlingException
Type: ThrottlingException structure

The number of requests exceeds the limit. Resubmit your request later.

trace
Type: InlineAgentTracePart structure

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.

validationException
Type: ValidationException structure

Input validation failed. Check your request parameters and retry the request.

InlineAgentReturnControlPayload

Description

Contains information to return from the action group that the agent has predicted to invoke.

This data type is used in the InvokeAgent response API operation.

Members
invocationId
Type: string

The identifier of the action group invocation.

invocationInputs
Type: Array of InvocationInputMember structures

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.

InlineAgentTracePart

Description

Contains information about the agent and session, alongside the agent's reasoning process and results from calling API 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 enablement.

Members
sessionId
Type: string

The unique identifier of the session with the agent.

trace
Type: Trace structure

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.

InlineSessionState

Description

Contains parameters that specify various attributes that persist across a session or prompt. You can define session state attributes as key-value pairs when writing a Lambda function for an action group or pass them when making an InvokeInlineAgent request. Use session state attributes to control and provide conversational context for your inline agent and to help customize your agent's behavior. For more information, see Control session context

Members
files
Type: Array of InputFile structures

Contains information about the files used by code interpreter.

invocationId
Type: string

The identifier of the invocation of an action. This value must match the invocationId returned in the InvokeInlineAgent response for the action whose results are provided in the returnControlInvocationResults field. For more information, see Return control to the agent developer.

promptSessionAttributes
Type: Associative array of custom strings keys (String) to strings

Contains attributes that persist across a session and the values of those attributes.

returnControlInvocationResults
Type: Array of InvocationResultMember structures

Contains information about the results from the action group invocation. For more information, see Return control to the agent developer.

If you include this field in the sessionState field, the inputText field will be ignored.

sessionAttributes
Type: Associative array of custom strings keys (String) to strings

Contains attributes that persist across a session and the values of those attributes.

InputFile

Description

Contains details of the source files.

Members
name
Required: Yes
Type: string

The name of the source file.

source
Required: Yes
Type: FileSource structure

Specifies where the files are located.

useCase
Required: Yes
Type: string

Specifies how the source files will be used by the code interpreter.

InputPrompt

Description

Contains information about the prompt to optimize.

Members
textPrompt
Type: TextPrompt structure

Contains information about the text prompt to optimize.

InternalServerException

Description

An internal server error occurred. Retry your request.

Members
message
Type: string

InvocationInput

Description

Contains information pertaining to the action group or knowledge base that is being invoked.

Members
actionGroupInvocationInput
Type: ActionGroupInvocationInput structure

Contains information about the action group to be invoked.

codeInterpreterInvocationInput

Contains information about the code interpreter to be invoked.

invocationType
Type: string

Specifies whether the agent is invoking an action group or a knowledge base.

knowledgeBaseLookupInput
Type: KnowledgeBaseLookupInput structure

Contains details about the knowledge base to look up and the query to be made.

traceId
Type: string

The unique identifier of the trace.

InvocationInputMember

Description

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:

Members
apiInvocationInput
Type: ApiInvocationInput structure

Contains information about the API operation that the agent predicts should be called.

functionInvocationInput
Type: FunctionInvocationInput structure

Contains information about the function that the agent predicts should be called.

KnowledgeBase

Description

Details of the knowledge base associated withe inline agent.

Members
description
Required: Yes
Type: string

The description of the knowledge base associated with the inline agent.

knowledgeBaseId
Required: Yes
Type: string

The unique identifier for a knowledge base associated with the inline agent.

retrievalConfiguration

The configurations to apply to the knowledge base during query. For more information, see Query configurations.

KnowledgeBaseConfiguration

Description

Configurations to apply to a knowledge base attached to the agent during query. For more information, see Knowledge base retrieval configurations.

Members
knowledgeBaseId
Required: Yes
Type: string

The unique identifier for a knowledge base attached to the agent.

retrievalConfiguration
Required: Yes
Type: KnowledgeBaseRetrievalConfiguration structure

The configurations to apply to the knowledge base during query. For more information, see Query configurations.

KnowledgeBaseLookupInput

Description

Contains details about the knowledge base to look up and the query to be made.

Members
knowledgeBaseId
Type: string

The unique identifier of the knowledge base to look up.

text
Type: string

The query made to the knowledge base.

KnowledgeBaseLookupOutput

Description

Contains details about the results from looking up the knowledge base.

Members
retrievedReferences
Type: Array of RetrievedReference structures

Contains metadata about the sources cited for the generated response.

KnowledgeBaseQuery

Description

Contains the query made to the knowledge base.

This data type is used in the following API operations:

Members
text
Required: Yes
Type: string

The text of the query made to the knowledge base.

KnowledgeBaseRetrievalConfiguration

Description

Contains configurations for knowledge base query. For more information, see Query configurations.

This data type is used in the following API operations:

Members
vectorSearchConfiguration
Required: Yes
Type: KnowledgeBaseVectorSearchConfiguration structure

Contains details about how the results from the vector search should be returned. For more information, see Query configurations.

KnowledgeBaseRetrievalResult

Description

Details about a result from querying the knowledge base.

This data type is used in the following API operations:

Members
content
Required: Yes
Type: RetrievalResultContent structure

Contains a chunk of text from a data source in the knowledge base.

location
Type: RetrievalResultLocation structure

Contains information about the location of the data source.

metadata
Type: Associative array of custom strings keys (RetrievalResultMetadataKey) to document (null|bool|string|numeric) or an (array|associative array) whose members are all valid documentss

Contains metadata attributes and their values for the file in the data source. For more information, see Metadata and filtering.

score
Type: double

The level of relevance of the result to the query.

KnowledgeBaseRetrieveAndGenerateConfiguration

Description

Contains details about the resource being queried.

This data type is used in the following API operations:

Members
generationConfiguration
Type: GenerationConfiguration structure

Contains configurations for response generation based on the knowledge base query results.

knowledgeBaseId
Required: Yes
Type: string

The unique identifier of the knowledge base that is queried.

modelArn
Required: Yes
Type: string

The ARN of the foundation model or inference profile used to generate a response.

orchestrationConfiguration
Type: OrchestrationConfiguration structure

Settings for how the model processes the prompt prior to retrieval and generation.

retrievalConfiguration

Contains configurations for how to retrieve and return the knowledge base query.

KnowledgeBaseVectorSearchConfiguration

Description

Configurations for how to perform the search query and return results. For more information, see Query configurations.

This data type is used in the following API operations:

Members
filter
Type: RetrievalFilter structure

Specifies the filters to use on the metadata in the knowledge base data sources before returning results. For more information, see Query configurations.

numberOfResults
Type: int

The number of source chunks to retrieve.

overrideSearchType
Type: 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, or SEMANTIC search using only vector embeddings. For other vector store configurations, only SEMANTIC search is available. For more information, see Test a knowledge base.

Memory

Description

Contains sessions summaries.

Members
sessionSummary
Type: MemorySessionSummary structure

Contains summary of a session.

MemorySessionSummary

Description

Contains details of a session summary.

Members
memoryId
Type: string

The unique identifier of the memory where the session summary is stored.

sessionExpiryTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

The time when the memory duration for the session is set to end.

sessionId
Type: string

The identifier for this session.

sessionStartTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

The start time for this session.

summaryText
Type: string

The summarized text for this session.

Metadata

Description

Provides details of the foundation model.

Members
usage
Type: Usage structure

Contains details of the foundation model usage.

ModelInvocationInput

Description

The input for the pre-processing step.

  • The type matches the agent step.

  • The text contains the prompt.

  • The inferenceConfiguration, parserMode, and overrideLambda values are set in the PromptOverrideConfiguration object that was set when the agent was created or updated.

Members
inferenceConfiguration
Type: InferenceConfiguration structure

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.

overrideLambda
Type: string

The ARN of the Lambda function to use when parsing the raw foundation model output in parts of the agent sequence.

parserMode
Type: 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
Type: string

Specifies whether the default prompt template was OVERRIDDEN. If it was, the basePromptTemplate that was set in the PromptOverrideConfiguration object when the agent was created or updated is used instead.

text
Type: string

The text that prompted the agent at this step.

traceId
Type: string

The unique identifier of the trace.

type
Type: string

The step in the agent sequence.

Observation

Description

Contains the result or output of an action group or knowledge base, or the response to the user.

Members
actionGroupInvocationOutput
Type: ActionGroupInvocationOutput structure

Contains the JSON-formatted string returned by the API invoked by the action group.

codeInterpreterInvocationOutput

Contains the JSON-formatted string returned by the API invoked by the code interpreter.

finalResponse
Type: FinalResponse structure

Contains details about the response to the user.

knowledgeBaseLookupOutput
Type: KnowledgeBaseLookupOutput structure

Contains details about the results from looking up the knowledge base.

repromptResponse
Type: RepromptResponse structure

Contains details about the response to reprompt the input.

traceId
Type: string

The unique identifier of the trace.

type
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.

OptimizedPrompt

Description

Contains information about the optimized prompt.

Members
textPrompt
Type: TextPrompt structure

Contains information about the text in the prompt that was optimized.

OptimizedPromptEvent

Description

An event in which the prompt was optimized.

Members
optimizedPrompt
Type: OptimizedPrompt structure

Contains information about the optimized prompt.

OptimizedPromptStream

Description

The stream containing events in the prompt optimization process.

Members
accessDeniedException
Type: AccessDeniedException structure

The request is denied because of missing access permissions. Check your permissions and retry your request.

analyzePromptEvent
Type: AnalyzePromptEvent structure

An event in which the prompt was analyzed in preparation for optimization.

badGatewayException
Type: BadGatewayException structure

There was an issue with a dependency due to a server issue. Retry your request.

dependencyFailedException
Type: DependencyFailedException structure

There was an issue with a dependency. Check the resource configurations and retry the request.

internalServerException
Type: InternalServerException structure

An internal server error occurred. Retry your request.

optimizedPromptEvent
Type: OptimizedPromptEvent structure

An event in which the prompt was optimized.

throttlingException
Type: ThrottlingException structure

Your request was throttled because of service-wide limitations. Resubmit your request later or in a different region. You can also purchase Provisioned Throughput to increase the rate or number of tokens you can process.

validationException
Type: ValidationException structure

Input validation failed. Check your request parameters and retry the request.

OrchestrationConfiguration

Description

Settings for how the model processes the prompt prior to retrieval and generation.

Members
additionalModelRequestFields
Type: Associative array of custom strings keys (AdditionalModelRequestFieldsKey) to document (null|bool|string|numeric) or an (array|associative array) whose members are all valid documentss

Additional model parameters and corresponding values not included in the textInferenceConfig structure for a knowledge base. This allows users to provide custom model parameters specific to the language model being used.

inferenceConfig
Type: InferenceConfig structure

Configuration settings for inference when using RetrieveAndGenerate to generate responses while using a knowledge base as a source.

promptTemplate
Type: PromptTemplate structure

Contains the template for the prompt that's sent to the model. Orchestration prompts must include the $conversation_history$ and $output_format_instructions$ variables. For more information, see Use placeholder variables in the user guide.

queryTransformationConfiguration

To split up the prompt and retrieve multiple sources, set the transformation type to QUERY_DECOMPOSITION.

OrchestrationModelInvocationOutput

Description

The foundation model output from the orchestration step.

Members
metadata
Type: Metadata structure

Contains information about the foundation model output from the orchestration step.

rawResponse
Type: RawResponse structure

Contains details of the raw response from the foundation model output.

traceId
Type: string

The unique identifier of the trace.

OrchestrationTrace

Description

Details about the orchestration step, in which the agent determines the order in which actions are executed and which knowledge bases are retrieved.

Members
invocationInput
Type: InvocationInput structure

Contains information pertaining to the action group or knowledge base that is being invoked.

modelInvocationInput
Type: ModelInvocationInput structure

The input for the orchestration step.

  • The type is ORCHESTRATION.

  • The text contains the prompt.

  • The inferenceConfiguration, parserMode, and overrideLambda values are set in the PromptOverrideConfiguration object that was set when the agent was created or updated.

modelInvocationOutput

Contains information pertaining to the output from the foundation model that is being invoked.

observation
Type: Observation structure

Details about the observation (the output of the action group Lambda or knowledge base) made by the agent.

rationale
Type: Rationale structure

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.

OutputFile

Description

Contains details of the response from code interpreter.

Members
bytes
Type: blob (string|resource|Psr\Http\Message\StreamInterface)

The byte count of files that contains response from code interpreter.

name
Type: string

The name of the file containing response from code interpreter.

type
Type: string

The type of file that contains response from the code interpreter.

Parameter

Description

A parameter for the API request or function.

Members
name
Type: string

The name of the parameter.

type
Type: string

The type of the parameter.

value
Type: string

The value of the parameter.

ParameterDetail

Description

Contains details about a parameter in a function for an action group.

Members
description
Type: string

A description of the parameter. Helps the foundation model determine how to elicit the parameters from the user.

required
Type: boolean

Whether the parameter is required for the agent to complete the function for action group invocation.

type
Required: Yes
Type: string

The data type of the parameter.

PayloadPart

Description

Contains a part of an agent response and citations for it.

Members
attribution
Type: Attribution structure

Contains citations for a part of an agent response.

bytes
Type: blob (string|resource|Psr\Http\Message\StreamInterface)

A part of the agent response in bytes.

PostProcessingModelInvocationOutput

Description

The foundation model output from the post-processing step.

Members
metadata
Type: Metadata structure

Contains information about the foundation model output from the post-processing step.

parsedResponse

Details about the response from the Lambda parsing of the output of the post-processing step.

rawResponse
Type: RawResponse structure

Details of the raw response from the foundation model output.

traceId
Type: string

The unique identifier of the trace.

PostProcessingParsedResponse

Description

Details about the response from the Lambda parsing of the output from the post-processing step.

Members
text
Type: string

The text returned by the parser.

PostProcessingTrace

Description

Details about the post-processing step, in which the agent shapes the response.

Members
modelInvocationInput
Type: ModelInvocationInput structure

The input for the post-processing step.

  • The type is POST_PROCESSING.

  • The text contains the prompt.

  • The inferenceConfiguration, parserMode, and overrideLambda values are set in the PromptOverrideConfiguration object that was set when the agent was created or updated.

modelInvocationOutput

The foundation model output from the post-processing step.

PreProcessingModelInvocationOutput

Description

The foundation model output from the pre-processing step.

Members
metadata
Type: Metadata structure

Contains information about the foundation model output from the pre-processing step.

parsedResponse
Type: PreProcessingParsedResponse structure

Details about the response from the Lambda parsing of the output of the pre-processing step.

rawResponse
Type: RawResponse structure

Details of the raw response from the foundation model output.

traceId
Type: string

The unique identifier of the trace.

PreProcessingParsedResponse

Description

Details about the response from the Lambda parsing of the output from the pre-processing step.

Members
isValid
Type: boolean

Whether the user input is valid or not. If false, the agent doesn't proceed to orchestration.

rationale
Type: 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.

PreProcessingTrace

Description

Details about the pre-processing step, in which the agent contextualizes and categorizes user inputs.

Members
modelInvocationInput
Type: ModelInvocationInput structure

The input for the pre-processing step.

  • The type is PRE_PROCESSING.

  • The text contains the prompt.

  • The inferenceConfiguration, parserMode, and overrideLambda values are set in the PromptOverrideConfiguration object that was set when the agent was created or updated.

modelInvocationOutput

The foundation model output from the pre-processing step.

PromptConfiguration

Description

Contains configurations to override a prompt template in one part of an agent sequence. For more information, see Advanced prompts.

Members
basePromptTemplate
Type: 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
Type: InferenceConfiguration structure

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.

parserMode
Type: 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 as OVERRIDEN, the overrideLambda field in the PromptOverrideConfiguration must be specified with the ARN of a Lambda function.

promptCreationMode
Type: string

Specifies whether to override the default prompt template for this promptType. Set this value to OVERRIDDEN to use the prompt that you provide in the basePromptTemplate. If you leave it as DEFAULT, the agent uses a default prompt template.

promptState
Type: string

Specifies whether to allow the inline agent to carry out the step specified in the promptType. If you set this value to DISABLED, the agent skips that step. The default state for each promptType is as follows.

  • PRE_PROCESSINGENABLED

  • ORCHESTRATIONENABLED

  • KNOWLEDGE_BASE_RESPONSE_GENERATIONENABLED

  • POST_PROCESSINGDISABLED

promptType
Type: string

The step in the agent sequence that this prompt configuration applies to.

PromptOverrideConfiguration

Description

Contains configurations to override prompts in different parts of an agent sequence. For more information, see Advanced prompts.

Members
overrideLambda
Type: 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 a parserMode value that is set to OVERRIDDEN. For more information, see Parser Lambda function in Amazon Bedrock Agents.

promptConfigurations
Required: Yes
Type: Array of PromptConfiguration structures

Contains configurations to override a prompt template in one part of an agent sequence. For more information, see Advanced prompts.

PromptTemplate

Description

Contains the template for the prompt that's sent to the model for response generation. For more information, see Knowledge base prompt templates.

This data type is used in the following API operations:

Members
textPromptTemplate
Type: string

The template for the prompt that's sent to the model for response generation. You can include prompt placeholders, which become replaced before the prompt is sent to the model to provide instructions and context to the model. In addition, you can include XML tags to delineate meaningful sections of the prompt template.

For more information, see the following resources:

PropertyParameters

Description

Contains the parameters in the request body.

Members
properties
Type: Array of Parameter structures

A list of parameters in the request body.

QueryTransformationConfiguration

Description

To split up the prompt and retrieve multiple sources, set the transformation type to QUERY_DECOMPOSITION.

Members
type
Required: Yes
Type: string

The type of transformation to apply to the prompt.

Rationale

Description

Contains the reasoning, based on the input, that the agent uses to justify carrying out an action group or getting information from a knowledge base.

Members
text
Type: string

The reasoning or thought process of the agent, based on the input.

traceId
Type: string

The unique identifier of the trace step.

RawResponse

Description

Contains the raw output from the foundation model.

Members
content
Type: string

The foundation model's raw output content.

RepromptResponse

Description

Contains details about the agent's response to reprompt the input.

Members
source
Type: string

Specifies what output is prompting the agent to reprompt the input.

text
Type: string

The text reprompting the input.

RequestBody

Description

The parameters in the API request body.

Members
content
Type: Associative array of custom strings keys (String) to Parameter structuress

The content in the request body.

ResourceNotFoundException

Description

The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.

Members
message
Type: string

ResponseStream

Description

The response from invoking the agent and associated citations and trace information.

Members
accessDeniedException
Type: AccessDeniedException structure

The request is denied because of missing access permissions. Check your permissions and retry your request.

badGatewayException
Type: BadGatewayException structure

There was an issue with a dependency due to a server issue. Retry your request.

chunk
Type: PayloadPart structure

Contains a part of an agent response and citations for it.

conflictException
Type: ConflictException structure

There was a conflict performing an operation. Resolve the conflict and retry your request.

dependencyFailedException
Type: DependencyFailedException structure

There was an issue with a dependency. Check the resource configurations and retry the request.

files
Type: FilePart structure

Contains intermediate response for code interpreter if any files have been generated.

internalServerException
Type: InternalServerException structure

An internal server error occurred. Retry your request.

resourceNotFoundException
Type: ResourceNotFoundException structure

The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.

returnControl
Type: ReturnControlPayload structure

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.

serviceQuotaExceededException

The number of requests exceeds the service quota. Resubmit your request later.

throttlingException
Type: ThrottlingException structure

The number of requests exceeds the limit. Resubmit your request later.

trace
Type: TracePart structure

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.

validationException
Type: ValidationException structure

Input validation failed. Check your request parameters and retry the request.

RetrievalFilter

Description

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:

Members
andAll
Type: Array of RetrievalFilter structures

Knowledge base data sources are returned if their metadata attributes fulfill all the filter conditions inside this list.

equals
Type: FilterAttribute structure

Knowledge base data sources are returned if they contain a metadata attribute whose name matches the key and whose value matches the value in this object.

The following example would return data sources with an animal attribute whose value is cat:

"equals": { "key": "animal", "value": "cat" }

greaterThan
Type: FilterAttribute structure

Knowledge base data sources are returned if they contain a metadata attribute whose name matches the key and whose value is greater than the value in this object.

The following example would return data sources with an year attribute whose value is greater than 1989:

"greaterThan": { "key": "year", "value": 1989 }

greaterThanOrEquals
Type: FilterAttribute structure

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 the value in this object.

The following example would return data sources with an year attribute whose value is greater than or equal to 1989:

"greaterThanOrEquals": { "key": "year", "value": 1989 }

in
Type: FilterAttribute structure

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 the value in this object.

The following example would return data sources with an animal attribute that is either cat or dog:

"in": { "key": "animal", "value": ["cat", "dog"] }

lessThan
Type: FilterAttribute structure

Knowledge base data sources are returned if they contain a metadata attribute whose name matches the key and whose value is less than the value in this object.

The following example would return data sources with an year attribute whose value is less than to 1989.

"lessThan": { "key": "year", "value": 1989 }

lessThanOrEquals
Type: FilterAttribute structure

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 the value in this object.

The following example would return data sources with an year attribute whose value is less than or equal to 1989.

"lessThanOrEquals": { "key": "year", "value": 1989 }

listContains
Type: FilterAttribute structure

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 the value as one of its members.

The following example would return data sources with an animals attribute that is a list containing a cat member (for example ["dog", "cat"]).

"listContains": { "key": "animals", "value": "cat" }

notEquals
Type: FilterAttribute structure

Knowledge base data sources that contain a metadata attribute whose name matches the key and whose value doesn't match the value in this object are returned.

The following example would return data sources that don't contain an animal attribute whose value is cat.

"notEquals": { "key": "animal", "value": "cat" }

notIn
Type: FilterAttribute structure

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 the value in this object.

The following example would return data sources whose animal attribute is neither cat nor dog.

"notIn": { "key": "animal", "value": ["cat", "dog"] }

orAll
Type: Array of RetrievalFilter structures

Knowledge base data sources are returned if their metadata attributes fulfill at least one of the filter conditions inside this list.

startsWith
Type: FilterAttribute structure

Knowledge base data sources are returned if they contain a metadata attribute whose name matches the key and whose value starts with the value 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 with ca (for example, cat or camel).

"startsWith": { "key": "animal", "value": "ca" }

stringContains
Type: FilterAttribute structure

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 an animal attribute that contains the substring at (for example cat).

    "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 an animals attribute that is a list containing a member that contains the substring at (for example ["dog", "cat"]).

    "stringContains": { "key": "animals", "value": "at" }

RetrievalResultConfluenceLocation

Description

The Confluence data source location.

Members
url
Type: string

The Confluence host URL for the data source location.

RetrievalResultContent

Description

Contains the cited text from the data source.

This data type is used in the following API operations:

Members
text
Required: Yes
Type: string

The cited text from the data source.

RetrievalResultLocation

Description

Contains information about the data source location.

This data type is used in the following API operations:

Members
confluenceLocation

The Confluence data source location.

s3Location
Type: RetrievalResultS3Location structure

The S3 data source location.

salesforceLocation

The Salesforce data source location.

sharePointLocation

The SharePoint data source location.

type
Required: Yes
Type: string

The type of data source location.

webLocation
Type: RetrievalResultWebLocation structure

The web URL/URLs data source location.

RetrievalResultMetadataValue

Members

RetrievalResultS3Location

Description

The S3 data source location.

This data type is used in the following API operations:

Members
uri
Type: string

The S3 URI for the data source location.

RetrievalResultSalesforceLocation

Description

The Salesforce data source location.

Members
url
Type: string

The Salesforce host URL for the data source location.

RetrievalResultSharePointLocation

Description

The SharePoint data source location.

Members
url
Type: string

The SharePoint site URL for the data source location.

RetrievalResultWebLocation

Description

The web URL/URLs data source location.

Members
url
Type: string

The web URL/URLs for the data source location.

RetrieveAndGenerateConfiguration

Description

Contains details about the resource being queried.

This data type is used in the following API operations:

Members
externalSourcesConfiguration

The configuration for the external source wrapper object in the retrieveAndGenerate function.

knowledgeBaseConfiguration

Contains details about the knowledge base for retrieving information and generating responses.

type
Required: Yes
Type: string

The type of resource that contains your data for retrieving information and generating responses.

If you choose ot use EXTERNAL_SOURCES, then currently only Claude 3 Sonnet models for knowledge bases are supported.

RetrieveAndGenerateInput

Description

Contains the query made to the knowledge base.

This data type is used in the following API operations:

Members
text
Required: Yes
Type: string

The query made to the knowledge base.

RetrieveAndGenerateOutput

Description

Contains the response generated from querying the knowledge base.

This data type is used in the following API operations:

Members
text
Required: Yes
Type: string

The response generated from querying the knowledge base.

RetrieveAndGenerateSessionConfiguration

Description

Contains configuration about the session with the knowledge base.

This data type is used in the following API operations:

Members
kmsKeyArn
Required: Yes
Type: string

The ARN of the KMS key encrypting the session.

RetrievedReference

Description

Contains metadata about a source cited for the generated response.

This data type is used in the following API operations:

Members
content
Type: RetrievalResultContent structure

Contains the cited text from the data source.

location
Type: RetrievalResultLocation structure

Contains information about the location of the data source.

metadata
Type: Associative array of custom strings keys (RetrievalResultMetadataKey) to document (null|bool|string|numeric) or an (array|associative array) whose members are all valid documentss

Contains metadata attributes and their values for the file in the data source. For more information, see Metadata and filtering.

ReturnControlPayload

Description

Contains information to return from the action group that the agent has predicted to invoke.

This data type is used in the following API operations:

Members
invocationId
Type: string

The identifier of the action group invocation.

invocationInputs
Type: Array of InvocationInputMember structures

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.

S3Identifier

Description

The identifier information for an Amazon S3 bucket.

Members
s3BucketName
Type: string

The name of the S3 bucket.

s3ObjectKey
Type: string

The S3 object key for the S3 resource.

S3ObjectDoc

Description

The unique wrapper object of the document from the S3 location.

Members
uri
Required: Yes
Type: string

The file location of the S3 wrapper object.

S3ObjectFile

Description

Contains details of the s3 object where the source file is located.

Members
uri
Required: Yes
Type: string

The uri of the s3 object.

ServiceQuotaExceededException

Description

The number of requests exceeds the service quota. Resubmit your request later.

Members
message
Type: string

SessionState

Description

Contains parameters that specify various attributes that persist across a session or prompt. You can define session state attributes as key-value pairs when writing a Lambda function for an action group or pass them when making an InvokeAgent request. Use session state attributes to control and provide conversational context for your agent and to help customize your agent's behavior. For more information, see Control session context.

Members
files
Type: Array of InputFile structures

Contains information about the files used by code interpreter.

invocationId
Type: string

The identifier of the invocation of an action. This value must match the invocationId returned in the InvokeAgent response for the action whose results are provided in the returnControlInvocationResults field. For more information, see Return control to the agent developer and Control session context.

knowledgeBaseConfigurations
Type: Array of KnowledgeBaseConfiguration structures

An array of configurations, each of which applies to a knowledge base attached to the agent.

promptSessionAttributes
Type: Associative array of custom strings keys (String) to strings

Contains attributes that persist across a prompt and the values of those attributes. These attributes replace the $prompt_session_attributes$ placeholder variable in the orchestration prompt template. For more information, see Prompt template placeholder variables.

returnControlInvocationResults
Type: Array of InvocationResultMember structures

Contains information about the results from the action group invocation. For more information, see Return control to the agent developer and Control session context.

If you include this field, the inputText field will be ignored.

sessionAttributes
Type: Associative array of custom strings keys (String) to strings

Contains attributes that persist across a session and the values of those attributes.

Span

Description

Contains information about where the text with a citation begins and ends in the generated output.

This data type is used in the following API operations:

Members
end
Type: int

Where the text with a citation ends in the generated output.

start
Type: int

Where the text with a citation starts in the generated output.

TextInferenceConfig

Description

Configuration settings for text generation using a language model via the RetrieveAndGenerate operation. Includes parameters like temperature, top-p, maximum token count, and stop sequences.

The valid range of maxTokens depends on the accepted values for your chosen model's inference parameters. To see the inference parameters for your model, see Inference parameters for foundation models.

Members
maxTokens
Type: int

The maximum number of tokens to generate in the output text. Do not use the minimum of 0 or the maximum of 65536. The limit values described here are arbitary values, for actual values consult the limits defined by your specific model.

stopSequences
Type: Array of strings

A list of sequences of characters that, if generated, will cause the model to stop generating further tokens. Do not use a minimum length of 1 or a maximum length of 1000. The limit values described here are arbitary values, for actual values consult the limits defined by your specific model.

temperature
Type: float

Controls the random-ness of text generated by the language model, influencing how much the model sticks to the most predictable next words versus exploring more surprising options. A lower temperature value (e.g. 0.2 or 0.3) makes model outputs more deterministic or predictable, while a higher temperature (e.g. 0.8 or 0.9) makes the outputs more creative or unpredictable.

topP
Type: float

A probability distribution threshold which controls what the model considers for the set of possible next tokens. The model will only consider the top p% of the probability distribution when generating the next token.

TextPrompt

Description

Contains information about the text prompt to optimize.

Members
text
Required: Yes
Type: string

The text in the text prompt to optimize.

TextResponsePart

Description

Contains the part of the generated text that contains a citation, alongside where it begins and ends.

This data type is used in the following API operations:

Members
span
Type: Span structure

Contains information about where the text with a citation begins and ends in the generated output.

text
Type: string

The part of the generated text that contains a citation.

ThrottlingException

Description

The number of requests exceeds the limit. Resubmit your request later.

Members
message
Type: string

Trace

Description

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.

Members
failureTrace
Type: FailureTrace structure

Contains information about the failure of the interaction.

guardrailTrace
Type: GuardrailTrace structure

The trace details for a trace defined in the Guardrail filter.

orchestrationTrace
Type: OrchestrationTrace structure

Details about the orchestration step, in which the agent determines the order in which actions are executed and which knowledge bases are retrieved.

postProcessingTrace
Type: PostProcessingTrace structure

Details about the post-processing step, in which the agent shapes the response..

preProcessingTrace
Type: PreProcessingTrace structure

Details about the pre-processing step, in which the agent contextualizes and categorizes user inputs.

TracePart

Description

Contains information about the agent and session, alongside the agent's reasoning process and results from calling API 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 enablement.

Members
agentAliasId
Type: string

The unique identifier of the alias of the agent.

agentId
Type: string

The unique identifier of the agent.

agentVersion
Type: string

The version of the agent.

sessionId
Type: string

The unique identifier of the session with the agent.

trace
Type: Trace structure

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.

Usage

Description

Contains information of the usage of the foundation model.

Members
inputTokens
Type: int

Contains information about the input tokens from the foundation model usage.

outputTokens
Type: int

Contains information about the output tokens from the foundation model usage.

ValidationException

Description

Input validation failed. Check your request parameters and retry the request.

Members
message
Type: string