

# Agents for Amazon Bedrock Runtime


The following actions are supported by Agents for Amazon Bedrock Runtime:
+  [CreateInvocation](API_agent-runtime_CreateInvocation.md) 
+  [CreateSession](API_agent-runtime_CreateSession.md) 
+  [DeleteAgentMemory](API_agent-runtime_DeleteAgentMemory.md) 
+  [DeleteSession](API_agent-runtime_DeleteSession.md) 
+  [EndSession](API_agent-runtime_EndSession.md) 
+  [GenerateQuery](API_agent-runtime_GenerateQuery.md) 
+  [GetAgentMemory](API_agent-runtime_GetAgentMemory.md) 
+  [GetExecutionFlowSnapshot](API_agent-runtime_GetExecutionFlowSnapshot.md) 
+  [GetFlowExecution](API_agent-runtime_GetFlowExecution.md) 
+  [GetInvocationStep](API_agent-runtime_GetInvocationStep.md) 
+  [GetSession](API_agent-runtime_GetSession.md) 
+  [InvokeAgent](API_agent-runtime_InvokeAgent.md) 
+  [InvokeFlow](API_agent-runtime_InvokeFlow.md) 
+  [InvokeInlineAgent](API_agent-runtime_InvokeInlineAgent.md) 
+  [ListFlowExecutionEvents](API_agent-runtime_ListFlowExecutionEvents.md) 
+  [ListFlowExecutions](API_agent-runtime_ListFlowExecutions.md) 
+  [ListInvocations](API_agent-runtime_ListInvocations.md) 
+  [ListInvocationSteps](API_agent-runtime_ListInvocationSteps.md) 
+  [ListSessions](API_agent-runtime_ListSessions.md) 
+  [ListTagsForResource](API_agent-runtime_ListTagsForResource.md) 
+  [OptimizePrompt](API_agent-runtime_OptimizePrompt.md) 
+  [PutInvocationStep](API_agent-runtime_PutInvocationStep.md) 
+  [Rerank](API_agent-runtime_Rerank.md) 
+  [Retrieve](API_agent-runtime_Retrieve.md) 
+  [RetrieveAndGenerate](API_agent-runtime_RetrieveAndGenerate.md) 
+  [RetrieveAndGenerateStream](API_agent-runtime_RetrieveAndGenerateStream.md) 
+  [StartFlowExecution](API_agent-runtime_StartFlowExecution.md) 
+  [StopFlowExecution](API_agent-runtime_StopFlowExecution.md) 
+  [TagResource](API_agent-runtime_TagResource.md) 
+  [UntagResource](API_agent-runtime_UntagResource.md) 
+  [UpdateSession](API_agent-runtime_UpdateSession.md) 

# CreateInvocation


Creates a new invocation within a session. An invocation groups the related invocation steps that store the content from a conversation. For more information about sessions, see [Store and retrieve conversation history and context with Amazon Bedrock sessions](https://docs.aws.amazon.com/bedrock/latest/userguide/sessions.html).

Related APIs
+  [ListInvocations](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_ListInvocations.html) 
+  [ListSessions](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_ListSessions.html) 
+  [GetSession](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_GetSession.html) 

## Request Syntax


```
PUT /sessions/sessionIdentifier/invocations/ HTTP/1.1
Content-type: application/json

{
   "description": "string",
   "invocationId": "string"
}
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [sessionIdentifier](#API_agent-runtime_CreateInvocation_RequestSyntax) **   <a name="bedrock-agent-runtime_CreateInvocation-request-uri-sessionIdentifier"></a>
The unique identifier for the associated session for the invocation. You can specify either the session's `sessionId` or its Amazon Resource Name (ARN).   
Pattern: `(arn:aws(-[^:]+)?:bedrock:[a-z0-9-]+:[0-9]{12}:session/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})|([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})`   
Required: Yes

## Request Body


The request accepts the following data in JSON format.

 ** [description](#API_agent-runtime_CreateInvocation_RequestSyntax) **   <a name="bedrock-agent-runtime_CreateInvocation-request-description"></a>
A description for the interactions in the invocation. For example, "User asking about weather in Seattle".  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 200.  
Required: No

 ** [invocationId](#API_agent-runtime_CreateInvocation_RequestSyntax) **   <a name="bedrock-agent-runtime_CreateInvocation-request-invocationId"></a>
A unique identifier for the invocation in UUID format.  
Type: String  
Pattern: `[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}`   
Required: No

## Response Syntax


```
HTTP/1.1 201
Content-type: application/json

{
   "createdAt": "string",
   "invocationId": "string",
   "sessionId": "string"
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 201 response.

The following data is returned in JSON format by the service.

 ** [createdAt](#API_agent-runtime_CreateInvocation_ResponseSyntax) **   <a name="bedrock-agent-runtime_CreateInvocation-response-createdAt"></a>
The timestamp for when the invocation was created.  
Type: Timestamp

 ** [invocationId](#API_agent-runtime_CreateInvocation_ResponseSyntax) **   <a name="bedrock-agent-runtime_CreateInvocation-response-invocationId"></a>
The unique identifier for the invocation.  
Type: String  
Pattern: `[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}` 

 ** [sessionId](#API_agent-runtime_CreateInvocation_ResponseSyntax) **   <a name="bedrock-agent-runtime_CreateInvocation-response-sessionId"></a>
The unique identifier for the session associated with the invocation.  
Type: String  
Pattern: `[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}` 

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** ConflictException **   
There was a conflict performing an operation. Resolve the conflict and retry your request.  
HTTP Status Code: 409

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ServiceQuotaExceededException **   
The number of requests exceeds the service quota. Resubmit your request later.  
HTTP Status Code: 400

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## Examples


### Request example


This example illustrates one usage of CreateInvocation.

```
PUT bedrock-agent-runtime.us-east-1.amazonaws.com/sessions/12345abc-1234-abcd-1234-abcdef123456/invocations/ HTTP/1.1
Content-type: application/json

{
    "description": "User asking about weather in Seattle",
    "invocationId": "12345abc-1234-abcd-1234-abcdef123456"
}
```

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/CreateInvocation) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/CreateInvocation) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/CreateInvocation) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/CreateInvocation) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/CreateInvocation) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/CreateInvocation) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/CreateInvocation) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/CreateInvocation) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/CreateInvocation) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/CreateInvocation) 

# CreateSession


Creates a session to temporarily store conversations for generative AI (GenAI) applications built with open-source frameworks such as LangGraph and LlamaIndex. Sessions enable you to save the state of conversations at checkpoints, with the added security and infrastructure of AWS. For more information, see [Store and retrieve conversation history and context with Amazon Bedrock sessions](https://docs.aws.amazon.com/bedrock/latest/userguide/sessions.html).

By default, Amazon Bedrock uses AWS-managed keys for session encryption, including session metadata, or you can use your own KMS key. For more information, see [Amazon Bedrock session encryption](https://docs.aws.amazon.com/bedrock/latest/userguide/session-encryption.html).

**Note**  
 You use a session to store state and conversation history for generative AI applications built with open-source frameworks. For Amazon Bedrock Agents, the service automatically manages conversation context and associates them with the agent-specific sessionId you specify in the [InvokeAgent](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html) API operation. 

Related APIs:
+  [ListSessions](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_ListSessions.html) 
+  [GetSession](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_GetSession.html) 
+  [EndSession](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_EndSession.html) 
+  [DeleteSession](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_DeleteSession.html) 

## Request Syntax


```
PUT /sessions/ HTTP/1.1
Content-type: application/json

{
   "encryptionKeyArn": "string",
   "sessionMetadata": { 
      "string" : "string" 
   },
   "tags": { 
      "string" : "string" 
   }
}
```

## URI Request Parameters


The request does not use any URI parameters.

## Request Body


The request accepts the following data in JSON format.

 ** [encryptionKeyArn](#API_agent-runtime_CreateSession_RequestSyntax) **   <a name="bedrock-agent-runtime_CreateSession-request-encryptionKeyArn"></a>
The Amazon Resource Name (ARN) of the KMS key to use to encrypt the session data. The user or role creating the session must have permission to use the key. For more information, see [Amazon Bedrock session encryption](https://docs.aws.amazon.com/bedrock/latest/userguide/session-encryption.html).   
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `arn:aws(|-cn|-us-gov):kms:[a-zA-Z0-9-]*:[0-9]{12}:key/[a-zA-Z0-9-]{36}`   
Required: No

 ** [sessionMetadata](#API_agent-runtime_CreateSession_RequestSyntax) **   <a name="bedrock-agent-runtime_CreateSession-request-sessionMetadata"></a>
A map of key-value pairs containing attributes to be persisted across the session. For example, the user's ID, their language preference, and the type of device they are using.  
Type: String to string map  
Map Entries: Minimum number of 0 items. Maximum number of 50 items.  
Key Length Constraints: Minimum length of 1. Maximum length of 100.  
Value Length Constraints: Minimum length of 0. Maximum length of 5000.  
Required: No

 ** [tags](#API_agent-runtime_CreateSession_RequestSyntax) **   <a name="bedrock-agent-runtime_CreateSession-request-tags"></a>
Specify the key-value pairs for the tags that you want to attach to the session.  
Type: String to string map  
Map Entries: Maximum number of 200 items.  
Key Length Constraints: Minimum length of 1. Maximum length of 128.  
Key Pattern: `[a-zA-Z0-9\s._:/=+@-]*`   
Value Length Constraints: Minimum length of 0. Maximum length of 256.  
Value Pattern: `[a-zA-Z0-9\s._:/=+@-]*`   
Required: No

## Response Syntax


```
HTTP/1.1 201
Content-type: application/json

{
   "createdAt": "string",
   "sessionArn": "string",
   "sessionId": "string",
   "sessionStatus": "string"
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 201 response.

The following data is returned in JSON format by the service.

 ** [createdAt](#API_agent-runtime_CreateSession_ResponseSyntax) **   <a name="bedrock-agent-runtime_CreateSession-response-createdAt"></a>
The timestamp for when the session was created.  
Type: Timestamp

 ** [sessionArn](#API_agent-runtime_CreateSession_ResponseSyntax) **   <a name="bedrock-agent-runtime_CreateSession-response-sessionArn"></a>
The Amazon Resource Name (ARN) of the created session.  
Type: String  
Pattern: `arn:aws(-[^:]+)?:bedrock:[a-z0-9-]+:[0-9]{12}:session/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}` 

 ** [sessionId](#API_agent-runtime_CreateSession_ResponseSyntax) **   <a name="bedrock-agent-runtime_CreateSession-response-sessionId"></a>
The unique identifier for the session.  
Type: String  
Pattern: `[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}` 

 ** [sessionStatus](#API_agent-runtime_CreateSession_ResponseSyntax) **   <a name="bedrock-agent-runtime_CreateSession-response-sessionStatus"></a>
The current status of the session.  
Type: String  
Valid Values: `ACTIVE | EXPIRED | ENDED` 

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** ConflictException **   
There was a conflict performing an operation. Resolve the conflict and retry your request.  
HTTP Status Code: 409

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ServiceQuotaExceededException **   
The number of requests exceeds the service quota. Resubmit your request later.  
HTTP Status Code: 400

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## Examples


### Example request


This example illustrates one usage of CreateSession.

```
PUT bedrock-agent-runtime.us-east-1.amazonaws.com/sessions/ HTTP/1.1
Content-type: application/json

{
    "encryptionKeyArn": "key Amazon Resource Name (ARN)",
    "sessionMetadata": {
        "deviceType": "mobile",
        "language": "english"
    },
    "tags": {
        "Environment": "Production",
        "Project": "Demo"
    }
}
```

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/CreateSession) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/CreateSession) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/CreateSession) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/CreateSession) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/CreateSession) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/CreateSession) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/CreateSession) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/CreateSession) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/CreateSession) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/CreateSession) 

# DeleteAgentMemory


Deletes memory from the specified memory identifier.

## Request Syntax


```
DELETE /agents/agentId/agentAliases/agentAliasId/memories?memoryId=memoryId&sessionId=sessionId HTTP/1.1
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [agentAliasId](#API_agent-runtime_DeleteAgentMemory_RequestSyntax) **   <a name="bedrock-agent-runtime_DeleteAgentMemory-request-uri-agentAliasId"></a>
The unique identifier of an alias of an agent.  
Length Constraints: Minimum length of 0. Maximum length of 10.  
Pattern: `[0-9a-zA-Z]+`   
Required: Yes

 ** [agentId](#API_agent-runtime_DeleteAgentMemory_RequestSyntax) **   <a name="bedrock-agent-runtime_DeleteAgentMemory-request-uri-agentId"></a>
The unique identifier of the agent to which the alias belongs.  
Length Constraints: Minimum length of 0. Maximum length of 10.  
Pattern: `[0-9a-zA-Z]+`   
Required: Yes

 ** [memoryId](#API_agent-runtime_DeleteAgentMemory_RequestSyntax) **   <a name="bedrock-agent-runtime_DeleteAgentMemory-request-uri-memoryId"></a>
The unique identifier of the memory.  
Length Constraints: Minimum length of 2. Maximum length of 100.  
Pattern: `[0-9a-zA-Z._:-]+` 

 ** [sessionId](#API_agent-runtime_DeleteAgentMemory_RequestSyntax) **   <a name="bedrock-agent-runtime_DeleteAgentMemory-request-uri-sessionId"></a>
The unique session identifier of the memory.  
Length Constraints: Minimum length of 2. Maximum length of 100.  
Pattern: `[0-9a-zA-Z._:-]+` 

## Request Body


The request does not have a request body.

## Response Syntax


```
HTTP/1.1 202
```

## Response Elements


If the action is successful, the service sends back an HTTP 202 response with an empty HTTP body.

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** BadGatewayException **   
There was an issue with a dependency due to a server issue. Retry your request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 502

 ** ConflictException **   
There was a conflict performing an operation. Resolve the conflict and retry your request.  
HTTP Status Code: 409

 ** DependencyFailedException **   
There was an issue with a dependency. Check the resource configurations and retry the request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 424

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ServiceQuotaExceededException **   
The number of requests exceeds the service quota. Resubmit your request later.  
HTTP Status Code: 400

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/DeleteAgentMemory) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/DeleteAgentMemory) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/DeleteAgentMemory) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/DeleteAgentMemory) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/DeleteAgentMemory) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/DeleteAgentMemory) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/DeleteAgentMemory) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/DeleteAgentMemory) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/DeleteAgentMemory) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/DeleteAgentMemory) 

# DeleteSession


Deletes a session that you ended. You can't delete a session with an `ACTIVE` status. To delete an active session, you must first end it with the [EndSession](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_EndSession.html) API operation. For more information about sessions, see [Store and retrieve conversation history and context with Amazon Bedrock sessions](https://docs.aws.amazon.com/bedrock/latest/userguide/sessions.html).

## Request Syntax


```
DELETE /sessions/sessionIdentifier/ HTTP/1.1
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [sessionIdentifier](#API_agent-runtime_DeleteSession_RequestSyntax) **   <a name="bedrock-agent-runtime_DeleteSession-request-uri-sessionIdentifier"></a>
The unique identifier for the session to be deleted. You can specify either the session's `sessionId` or its Amazon Resource Name (ARN).  
Pattern: `(arn:aws(-[^:]+)?:bedrock:[a-z0-9-]+:[0-9]{12}:session/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})|([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})`   
Required: Yes

## Request Body


The request does not have a request body.

## Response Syntax


```
HTTP/1.1 200
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** ConflictException **   
There was a conflict performing an operation. Resolve the conflict and retry your request.  
HTTP Status Code: 409

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## Examples


### Example request


This example illustrates one usage of DeleteSession.

```
DELETE bedrock-agent-runtime.us-east-1.amazonaws.com/sessions/12345abc-1234-abcd-1234-abcdef123456/ HTTP/1.1
```

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/DeleteSession) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/DeleteSession) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/DeleteSession) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/DeleteSession) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/DeleteSession) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/DeleteSession) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/DeleteSession) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/DeleteSession) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/DeleteSession) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/DeleteSession) 

# EndSession


Ends the session. After you end a session, you can still access its content but you can’t add to it. To delete the session and it's content, you use the DeleteSession API operation. For more information about sessions, see [Store and retrieve conversation history and context with Amazon Bedrock sessions](https://docs.aws.amazon.com/bedrock/latest/userguide/sessions.html).

## Request Syntax


```
PATCH /sessions/sessionIdentifier HTTP/1.1
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [sessionIdentifier](#API_agent-runtime_EndSession_RequestSyntax) **   <a name="bedrock-agent-runtime_EndSession-request-uri-sessionIdentifier"></a>
The unique identifier for the session to end. You can specify either the session's `sessionId` or its Amazon Resource Name (ARN).  
Pattern: `(arn:aws(-[^:]+)?:bedrock:[a-z0-9-]+:[0-9]{12}:session/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})|([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})`   
Required: Yes

## Request Body


The request does not have a request body.

## Response Syntax


```
HTTP/1.1 200
Content-type: application/json

{
   "sessionArn": "string",
   "sessionId": "string",
   "sessionStatus": "string"
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [sessionArn](#API_agent-runtime_EndSession_ResponseSyntax) **   <a name="bedrock-agent-runtime_EndSession-response-sessionArn"></a>
The Amazon Resource Name (ARN) of the session you ended.  
Type: String  
Pattern: `arn:aws(-[^:]+)?:bedrock:[a-z0-9-]+:[0-9]{12}:session/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}` 

 ** [sessionId](#API_agent-runtime_EndSession_ResponseSyntax) **   <a name="bedrock-agent-runtime_EndSession-response-sessionId"></a>
The unique identifier of the session you ended.  
Type: String  
Pattern: `[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}` 

 ** [sessionStatus](#API_agent-runtime_EndSession_ResponseSyntax) **   <a name="bedrock-agent-runtime_EndSession-response-sessionStatus"></a>
The current status of the session you ended.  
Type: String  
Valid Values: `ACTIVE | EXPIRED | ENDED` 

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** ConflictException **   
There was a conflict performing an operation. Resolve the conflict and retry your request.  
HTTP Status Code: 409

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## Examples


### Example request


This example illustrates one usage of EndSession.

```
PATCH bedrock-agent-runtime.us-east-1.amazonaws.com/sessions/12345abc-1234-abcd-1234-abcdef123456/ HTTP/1.1
```

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/EndSession) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/EndSession) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/EndSession) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/EndSession) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/EndSession) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/EndSession) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/EndSession) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/EndSession) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/EndSession) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/EndSession) 

# GenerateQuery


Generates an SQL query from a natural language query. For more information, see [Generate a query for structured data](https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-generate-query.html) in the Amazon Bedrock User Guide.

## Request Syntax


```
POST /generateQuery HTTP/1.1
Content-type: application/json

{
   "queryGenerationInput": { 
      "text": "string",
      "type": "string"
   },
   "transformationConfiguration": { 
      "mode": "string",
      "textToSqlConfiguration": { 
         "knowledgeBaseConfiguration": { 
            "knowledgeBaseArn": "string"
         },
         "type": "string"
      }
   }
}
```

## URI Request Parameters


The request does not use any URI parameters.

## Request Body


The request accepts the following data in JSON format.

 ** [queryGenerationInput](#API_agent-runtime_GenerateQuery_RequestSyntax) **   <a name="bedrock-agent-runtime_GenerateQuery-request-queryGenerationInput"></a>
Specifies information about a natural language query to transform into SQL.  
Type: [QueryGenerationInput](API_agent-runtime_QueryGenerationInput.md) object  
Required: Yes

 ** [transformationConfiguration](#API_agent-runtime_GenerateQuery_RequestSyntax) **   <a name="bedrock-agent-runtime_GenerateQuery-request-transformationConfiguration"></a>
Specifies configurations for transforming the natural language query into SQL.  
Type: [TransformationConfiguration](API_agent-runtime_TransformationConfiguration.md) object  
Required: Yes

## Response Syntax


```
HTTP/1.1 200
Content-type: application/json

{
   "queries": [ 
      { 
         "sql": "string",
         "type": "string"
      }
   ]
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [queries](#API_agent-runtime_GenerateQuery_ResponseSyntax) **   <a name="bedrock-agent-runtime_GenerateQuery-response-queries"></a>
A list of objects, each of which defines a generated query that can correspond to the natural language queries.  
Type: Array of [GeneratedQuery](API_agent-runtime_GeneratedQuery.md) objects  
Array Members: Minimum number of 0 items.

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** BadGatewayException **   
There was an issue with a dependency due to a server issue. Retry your request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 502

 ** ConflictException **   
There was a conflict performing an operation. Resolve the conflict and retry your request.  
HTTP Status Code: 409

 ** DependencyFailedException **   
There was an issue with a dependency. Check the resource configurations and retry the request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 424

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ServiceQuotaExceededException **   
The number of requests exceeds the service quota. Resubmit your request later.  
HTTP Status Code: 400

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/GenerateQuery) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/GenerateQuery) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/GenerateQuery) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/GenerateQuery) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/GenerateQuery) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/GenerateQuery) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/GenerateQuery) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/GenerateQuery) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/GenerateQuery) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/GenerateQuery) 

# GetAgentMemory


Gets the sessions stored in the memory of the agent.

## Request Syntax


```
GET /agents/agentId/agentAliases/agentAliasId/memories?maxItems=maxItems&memoryId=memoryId&memoryType=memoryType&nextToken=nextToken HTTP/1.1
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [agentAliasId](#API_agent-runtime_GetAgentMemory_RequestSyntax) **   <a name="bedrock-agent-runtime_GetAgentMemory-request-uri-agentAliasId"></a>
The unique identifier of an alias of an agent.  
Length Constraints: Minimum length of 0. Maximum length of 10.  
Pattern: `[0-9a-zA-Z]+`   
Required: Yes

 ** [agentId](#API_agent-runtime_GetAgentMemory_RequestSyntax) **   <a name="bedrock-agent-runtime_GetAgentMemory-request-uri-agentId"></a>
The unique identifier of the agent to which the alias belongs.  
Length Constraints: Minimum length of 0. Maximum length of 10.  
Pattern: `[0-9a-zA-Z]+`   
Required: Yes

 ** [maxItems](#API_agent-runtime_GetAgentMemory_RequestSyntax) **   <a name="bedrock-agent-runtime_GetAgentMemory-request-uri-maxItems"></a>
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.  
Valid Range: Minimum value of 1. Maximum value of 1000.

 ** [memoryId](#API_agent-runtime_GetAgentMemory_RequestSyntax) **   <a name="bedrock-agent-runtime_GetAgentMemory-request-uri-memoryId"></a>
The unique identifier of the memory.   
Length Constraints: Minimum length of 2. Maximum length of 100.  
Pattern: `[0-9a-zA-Z._:-]+`   
Required: Yes

 ** [memoryType](#API_agent-runtime_GetAgentMemory_RequestSyntax) **   <a name="bedrock-agent-runtime_GetAgentMemory-request-uri-memoryType"></a>
The type of memory.  
Valid Values: `SESSION_SUMMARY`   
Required: Yes

 ** [nextToken](#API_agent-runtime_GetAgentMemory_RequestSyntax) **   <a name="bedrock-agent-runtime_GetAgentMemory-request-uri-nextToken"></a>
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.  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `\S*` 

## Request Body


The request does not have a request body.

## Response Syntax


```
HTTP/1.1 200
Content-type: application/json

{
   "memoryContents": [ 
      { ... }
   ],
   "nextToken": "string"
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [memoryContents](#API_agent-runtime_GetAgentMemory_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetAgentMemory-response-memoryContents"></a>
Contains details of the sessions stored in the memory  
Type: Array of [Memory](API_agent-runtime_Memory.md) objects

 ** [nextToken](#API_agent-runtime_GetAgentMemory_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetAgentMemory-response-nextToken"></a>
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.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `\S*` 

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** BadGatewayException **   
There was an issue with a dependency due to a server issue. Retry your request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 502

 ** ConflictException **   
There was a conflict performing an operation. Resolve the conflict and retry your request.  
HTTP Status Code: 409

 ** DependencyFailedException **   
There was an issue with a dependency. Check the resource configurations and retry the request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 424

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ServiceQuotaExceededException **   
The number of requests exceeds the service quota. Resubmit your request later.  
HTTP Status Code: 400

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/GetAgentMemory) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/GetAgentMemory) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/GetAgentMemory) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/GetAgentMemory) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/GetAgentMemory) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/GetAgentMemory) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/GetAgentMemory) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/GetAgentMemory) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/GetAgentMemory) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/GetAgentMemory) 

# GetExecutionFlowSnapshot


Retrieves the flow definition snapshot used for a flow execution. The snapshot represents the flow metadata and definition as it existed at the time the execution was started. Note that even if the flow is edited after an execution starts, the snapshot connected to the execution remains unchanged.

**Note**  
Flow executions is in preview release for Amazon Bedrock and is subject to change.

## Request Syntax


```
GET /flows/flowIdentifier/aliases/flowAliasIdentifier/executions/executionIdentifier/flowsnapshot HTTP/1.1
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [executionIdentifier](#API_agent-runtime_GetExecutionFlowSnapshot_RequestSyntax) **   <a name="bedrock-agent-runtime_GetExecutionFlowSnapshot-request-uri-executionIdentifier"></a>
The unique identifier of the flow execution.  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `[a-zA-Z0-9-]{1,36}$|^(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10}/alias/[0-9a-zA-Z]{10}/execution/[a-zA-Z0-9-]{1,36})`   
Required: Yes

 ** [flowAliasIdentifier](#API_agent-runtime_GetExecutionFlowSnapshot_RequestSyntax) **   <a name="bedrock-agent-runtime_GetExecutionFlowSnapshot-request-uri-flowAliasIdentifier"></a>
The unique identifier of the flow alias used for the flow execution.  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10}/alias/[0-9a-zA-Z]{10})|(\bTSTALIASID\b|[0-9a-zA-Z]+)`   
Required: Yes

 ** [flowIdentifier](#API_agent-runtime_GetExecutionFlowSnapshot_RequestSyntax) **   <a name="bedrock-agent-runtime_GetExecutionFlowSnapshot-request-uri-flowIdentifier"></a>
The unique identifier of the flow.  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10})|([0-9a-zA-Z]{10})`   
Required: Yes

## Request Body


The request does not have a request body.

## Response Syntax


```
HTTP/1.1 200
Content-type: application/json

{
   "customerEncryptionKeyArn": "string",
   "definition": "string",
   "executionRoleArn": "string",
   "flowAliasIdentifier": "string",
   "flowIdentifier": "string",
   "flowVersion": "string"
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [customerEncryptionKeyArn](#API_agent-runtime_GetExecutionFlowSnapshot_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetExecutionFlowSnapshot-response-customerEncryptionKeyArn"></a>
The Amazon Resource Name (ARN) of the customer managed AWS KMS key that's used to encrypt the flow snapshot.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `arn:aws(|-cn|-us-gov):kms:[a-zA-Z0-9-]*:[0-9]{12}:key/[a-zA-Z0-9-]{36}` 

 ** [definition](#API_agent-runtime_GetExecutionFlowSnapshot_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetExecutionFlowSnapshot-response-definition"></a>
The flow definition used for the flow execution, including the nodes, connections, and configuration at the time when the execution started.  
The definition returns as a string that follows the structure of a [FlowDefinition](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_FlowDefinition.html) object.  
Type: String

 ** [executionRoleArn](#API_agent-runtime_GetExecutionFlowSnapshot_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetExecutionFlowSnapshot-response-executionRoleArn"></a>
The Amazon Resource Name (ARN) of the IAM service role that's used by the flow execution.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `arn:aws(-[^:]+)?:iam::([0-9]{12})?:role/(service-role/)?.+` 

 ** [flowAliasIdentifier](#API_agent-runtime_GetExecutionFlowSnapshot_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetExecutionFlowSnapshot-response-flowAliasIdentifier"></a>
The unique identifier of the flow alias used for the flow execution.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10}/alias/[0-9a-zA-Z]{10})|(\bTSTALIASID\b|[0-9a-zA-Z]+)` 

 ** [flowIdentifier](#API_agent-runtime_GetExecutionFlowSnapshot_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetExecutionFlowSnapshot-response-flowIdentifier"></a>
The unique identifier of the flow.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10})|([0-9a-zA-Z]{10})` 

 ** [flowVersion](#API_agent-runtime_GetExecutionFlowSnapshot_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetExecutionFlowSnapshot-response-flowVersion"></a>
The version of the flow used for the flow execution.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 5.  
Pattern: `(DRAFT|[0-9]{0,4}[1-9][0-9]{0,4})` 

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/GetExecutionFlowSnapshot) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/GetExecutionFlowSnapshot) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/GetExecutionFlowSnapshot) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/GetExecutionFlowSnapshot) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/GetExecutionFlowSnapshot) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/GetExecutionFlowSnapshot) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/GetExecutionFlowSnapshot) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/GetExecutionFlowSnapshot) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/GetExecutionFlowSnapshot) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/GetExecutionFlowSnapshot) 

# GetFlowExecution


Retrieves details about a specific flow execution, including its status, start and end times, and any errors that occurred during execution.

## Request Syntax


```
GET /flows/flowIdentifier/aliases/flowAliasIdentifier/executions/executionIdentifier HTTP/1.1
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [executionIdentifier](#API_agent-runtime_GetFlowExecution_RequestSyntax) **   <a name="bedrock-agent-runtime_GetFlowExecution-request-uri-executionIdentifier"></a>
The unique identifier of the flow execution to retrieve.  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `[a-zA-Z0-9-]{1,36}$|^(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10}/alias/[0-9a-zA-Z]{10}/execution/[a-zA-Z0-9-]{1,36})`   
Required: Yes

 ** [flowAliasIdentifier](#API_agent-runtime_GetFlowExecution_RequestSyntax) **   <a name="bedrock-agent-runtime_GetFlowExecution-request-uri-flowAliasIdentifier"></a>
The unique identifier of the flow alias used for the execution.  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10}/alias/[0-9a-zA-Z]{10})|(\bTSTALIASID\b|[0-9a-zA-Z]+)`   
Required: Yes

 ** [flowIdentifier](#API_agent-runtime_GetFlowExecution_RequestSyntax) **   <a name="bedrock-agent-runtime_GetFlowExecution-request-uri-flowIdentifier"></a>
The unique identifier of the flow.  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10})|([0-9a-zA-Z]{10})`   
Required: Yes

## Request Body


The request does not have a request body.

## Response Syntax


```
HTTP/1.1 200
Content-type: application/json

{
   "endedAt": "string",
   "errors": [ 
      { 
         "error": "string",
         "message": "string",
         "nodeName": "string"
      }
   ],
   "executionArn": "string",
   "flowAliasIdentifier": "string",
   "flowIdentifier": "string",
   "flowVersion": "string",
   "startedAt": "string",
   "status": "string"
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [endedAt](#API_agent-runtime_GetFlowExecution_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetFlowExecution-response-endedAt"></a>
The timestamp when the flow execution ended. This field is only populated when the execution has completed, failed, timed out, or been aborted.  
Type: Timestamp

 ** [errors](#API_agent-runtime_GetFlowExecution_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetFlowExecution-response-errors"></a>
A list of errors that occurred during the flow execution. Each error includes an error code, message, and the node where the error occurred, if applicable.  
Type: Array of [FlowExecutionError](API_agent-runtime_FlowExecutionError.md) objects

 ** [executionArn](#API_agent-runtime_GetFlowExecution_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetFlowExecution-response-executionArn"></a>
The Amazon Resource Name (ARN) that uniquely identifies the flow execution.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `[a-zA-Z0-9-]{1,36}$|^(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10}/alias/[0-9a-zA-Z]{10}/execution/[a-zA-Z0-9-]{1,36})` 

 ** [flowAliasIdentifier](#API_agent-runtime_GetFlowExecution_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetFlowExecution-response-flowAliasIdentifier"></a>
The unique identifier of the flow alias used for the execution.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10}/alias/[0-9a-zA-Z]{10})|(\bTSTALIASID\b|[0-9a-zA-Z]+)` 

 ** [flowIdentifier](#API_agent-runtime_GetFlowExecution_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetFlowExecution-response-flowIdentifier"></a>
The unique identifier of the flow.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10})|([0-9a-zA-Z]{10})` 

 ** [flowVersion](#API_agent-runtime_GetFlowExecution_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetFlowExecution-response-flowVersion"></a>
The version of the flow used for the execution.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 5.  
Pattern: `(DRAFT|[0-9]{0,4}[1-9][0-9]{0,4})` 

 ** [startedAt](#API_agent-runtime_GetFlowExecution_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetFlowExecution-response-startedAt"></a>
The timestamp when the flow execution started.  
Type: Timestamp

 ** [status](#API_agent-runtime_GetFlowExecution_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetFlowExecution-response-status"></a>
The current status of the flow execution.  
Flow executions time out after 24 hours.  
Type: String  
Valid Values: `Running | Succeeded | Failed | TimedOut | Aborted` 

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/GetFlowExecution) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/GetFlowExecution) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/GetFlowExecution) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/GetFlowExecution) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/GetFlowExecution) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/GetFlowExecution) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/GetFlowExecution) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/GetFlowExecution) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/GetFlowExecution) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/GetFlowExecution) 

# GetInvocationStep


Retrieves the details of a specific invocation step within an invocation in a session. For more information about sessions, see [Store and retrieve conversation history and context with Amazon Bedrock sessions](https://docs.aws.amazon.com/bedrock/latest/userguide/sessions.html).

## Request Syntax


```
POST /sessions/sessionIdentifier/invocationSteps/invocationStepId HTTP/1.1
Content-type: application/json

{
   "invocationIdentifier": "string"
}
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [invocationStepId](#API_agent-runtime_GetInvocationStep_RequestSyntax) **   <a name="bedrock-agent-runtime_GetInvocationStep-request-uri-invocationStepId"></a>
The unique identifier (in UUID format) for the specific invocation step to retrieve.  
Pattern: `[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}`   
Required: Yes

 ** [sessionIdentifier](#API_agent-runtime_GetInvocationStep_RequestSyntax) **   <a name="bedrock-agent-runtime_GetInvocationStep-request-uri-sessionIdentifier"></a>
The unique identifier for the invocation step's associated session. You can specify either the session's `sessionId` or its Amazon Resource Name (ARN).  
Pattern: `(arn:aws(-[^:]+)?:bedrock:[a-z0-9-]+:[0-9]{12}:session/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})|([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})`   
Required: Yes

## Request Body


The request accepts the following data in JSON format.

 ** [invocationIdentifier](#API_agent-runtime_GetInvocationStep_RequestSyntax) **   <a name="bedrock-agent-runtime_GetInvocationStep-request-invocationIdentifier"></a>
The unique identifier for the invocation in UUID format.  
Type: String  
Pattern: `[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}`   
Required: Yes

## Response Syntax


```
HTTP/1.1 200
Content-type: application/json

{
   "invocationStep": { 
      "invocationId": "string",
      "invocationStepId": "string",
      "invocationStepTime": "string",
      "payload": { ... },
      "sessionId": "string"
   }
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [invocationStep](#API_agent-runtime_GetInvocationStep_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetInvocationStep-response-invocationStep"></a>
The complete details of the requested invocation step.  
Type: [InvocationStep](API_agent-runtime_InvocationStep.md) object

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## Examples


### Example request


This example illustrates one usage of GetInvocationStep.

```
POST bedrock-agent-runtime.us-east-1.amazonaws.com/sessions/12345abc-1234-abcd-1234-abcdef123456/invocationSteps/11111111-2222-3333-4444-555555555555 HTTP/1.1
Content-type: application/json

{
   "invocationIdentifier": "abc-1234-abcd-1234-abcdef123456"
}
```

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/GetInvocationStep) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/GetInvocationStep) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/GetInvocationStep) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/GetInvocationStep) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/GetInvocationStep) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/GetInvocationStep) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/GetInvocationStep) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/GetInvocationStep) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/GetInvocationStep) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/GetInvocationStep) 

# GetSession


Retrieves details about a specific session. For more information about sessions, see [Store and retrieve conversation history and context with Amazon Bedrock sessions](https://docs.aws.amazon.com/bedrock/latest/userguide/sessions.html).

## Request Syntax


```
GET /sessions/sessionIdentifier/ HTTP/1.1
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [sessionIdentifier](#API_agent-runtime_GetSession_RequestSyntax) **   <a name="bedrock-agent-runtime_GetSession-request-uri-sessionIdentifier"></a>
A unique identifier for the session to retrieve. You can specify either the session's `sessionId` or its Amazon Resource Name (ARN).  
Pattern: `(arn:aws(-[^:]+)?:bedrock:[a-z0-9-]+:[0-9]{12}:session/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})|([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})`   
Required: Yes

## Request Body


The request does not have a request body.

## Response Syntax


```
HTTP/1.1 200
Content-type: application/json

{
   "createdAt": "string",
   "encryptionKeyArn": "string",
   "lastUpdatedAt": "string",
   "sessionArn": "string",
   "sessionId": "string",
   "sessionMetadata": { 
      "string" : "string" 
   },
   "sessionStatus": "string"
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [createdAt](#API_agent-runtime_GetSession_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetSession-response-createdAt"></a>
The timestamp for when the session was created.  
Type: Timestamp

 ** [encryptionKeyArn](#API_agent-runtime_GetSession_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetSession-response-encryptionKeyArn"></a>
The Amazon Resource Name (ARN) of the AWS Key Management Service key used to encrypt the session data. For more information, see [Amazon Bedrock session encryption](https://docs.aws.amazon.com/bedrock/latest/userguide/session-encryption.html).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `arn:aws(|-cn|-us-gov):kms:[a-zA-Z0-9-]*:[0-9]{12}:key/[a-zA-Z0-9-]{36}` 

 ** [lastUpdatedAt](#API_agent-runtime_GetSession_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetSession-response-lastUpdatedAt"></a>
The timestamp for when the session was last modified.  
Type: Timestamp

 ** [sessionArn](#API_agent-runtime_GetSession_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetSession-response-sessionArn"></a>
The Amazon Resource Name (ARN) of the session.  
Type: String  
Pattern: `arn:aws(-[^:]+)?:bedrock:[a-z0-9-]+:[0-9]{12}:session/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}` 

 ** [sessionId](#API_agent-runtime_GetSession_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetSession-response-sessionId"></a>
The unique identifier for the session in UUID format.  
Type: String  
Pattern: `[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}` 

 ** [sessionMetadata](#API_agent-runtime_GetSession_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetSession-response-sessionMetadata"></a>
A map of key-value pairs containing attributes persisted across the session.  
Type: String to string map  
Map Entries: Minimum number of 0 items. Maximum number of 50 items.  
Key Length Constraints: Minimum length of 1. Maximum length of 100.  
Value Length Constraints: Minimum length of 0. Maximum length of 5000.

 ** [sessionStatus](#API_agent-runtime_GetSession_ResponseSyntax) **   <a name="bedrock-agent-runtime_GetSession-response-sessionStatus"></a>
The current status of the session.  
Type: String  
Valid Values: `ACTIVE | EXPIRED | ENDED` 

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## Examples


### Example request


This example illustrates one usage of GetSession.

```
GET bedrock-agent-runtime.us-east-1.amazonaws.com/sessions/12345abc-1234-abcd-1234-abcdef123456/ HTTP/1.1
```

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/GetSession) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/GetSession) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/GetSession) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/GetSession) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/GetSession) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/GetSession) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/GetSession) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/GetSession) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/GetSession) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/GetSession) 

# InvokeAgent


**Note**  
The AWS 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](https://docs.aws.amazon.com/bedrock/latest/userguide/agents-test.html#trace-events).
+ 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 contains both **chunk** and **trace** attributes.

The final response is returned in the `bytes` field of the `chunk` object. The `InvokeAgent` returns one chunk for the entire interaction.
+ 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.

## Request Syntax


```
POST /agents/agentId/agentAliases/agentAliasId/sessions/sessionId/text HTTP/1.1
x-amz-source-arn: sourceArn
Content-type: application/json

{
   "bedrockModelConfigurations": { 
      "performanceConfig": { 
         "latency": "string"
      }
   },
   "enableTrace": boolean,
   "endSession": boolean,
   "inputText": "string",
   "memoryId": "string",
   "promptCreationConfigurations": { 
      "excludePreviousThinkingSteps": boolean,
      "previousConversationTurnsToInclude": number
   },
   "sessionState": { 
      "conversationHistory": { 
         "messages": [ 
            { 
               "content": [ 
                  { ... }
               ],
               "role": "string"
            }
         ]
      },
      "files": [ 
         { 
            "name": "string",
            "source": { 
               "byteContent": { 
                  "data": blob,
                  "mediaType": "string"
               },
               "s3Location": { 
                  "uri": "string"
               },
               "sourceType": "string"
            },
            "useCase": "string"
         }
      ],
      "invocationId": "string",
      "knowledgeBaseConfigurations": [ 
         { 
            "knowledgeBaseId": "string",
            "retrievalConfiguration": { 
               "vectorSearchConfiguration": { 
                  "filter": { ... },
                  "implicitFilterConfiguration": { 
                     "metadataAttributes": [ 
                        { 
                           "description": "string",
                           "key": "string",
                           "type": "string"
                        }
                     ],
                     "modelArn": "string"
                  },
                  "numberOfResults": number,
                  "overrideSearchType": "string",
                  "rerankingConfiguration": { 
                     "bedrockRerankingConfiguration": { 
                        "metadataConfiguration": { 
                           "selectionMode": "string",
                           "selectiveModeConfiguration": { ... }
                        },
                        "modelConfiguration": { 
                           "additionalModelRequestFields": { 
                              "string" : JSON value 
                           },
                           "modelArn": "string"
                        },
                        "numberOfRerankedResults": number
                     },
                     "type": "string"
                  }
               }
            }
         }
      ],
      "promptSessionAttributes": { 
         "string" : "string" 
      },
      "returnControlInvocationResults": [ 
         { ... }
      ],
      "sessionAttributes": { 
         "string" : "string" 
      }
   },
   "streamingConfigurations": { 
      "applyGuardrailInterval": number,
      "streamFinalResponse": boolean
   }
}
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [agentAliasId](#API_agent-runtime_InvokeAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-request-uri-agentAliasId"></a>
The alias of the agent to use.  
Length Constraints: Minimum length of 0. Maximum length of 10.  
Pattern: `[0-9a-zA-Z]+`   
Required: Yes

 ** [agentId](#API_agent-runtime_InvokeAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-request-uri-agentId"></a>
The unique identifier of the agent to use.  
Length Constraints: Minimum length of 0. Maximum length of 10.  
Pattern: `[0-9a-zA-Z]+`   
Required: Yes

 ** [sessionId](#API_agent-runtime_InvokeAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-request-uri-sessionId"></a>
The unique identifier of the session. Use the same value across requests to continue the same conversation.  
Length Constraints: Minimum length of 2. Maximum length of 100.  
Pattern: `[0-9a-zA-Z._:-]+`   
Required: Yes

 ** [sourceArn](#API_agent-runtime_InvokeAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-request-sourceArn"></a>
The ARN of the resource making the request.  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:agent/[0-9a-zA-Z]{10}` 

## Request Body


The request accepts the following data in JSON format.

 ** [bedrockModelConfigurations](#API_agent-runtime_InvokeAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-request-bedrockModelConfigurations"></a>
Model performance settings for the request.  
Type: [BedrockModelConfigurations](API_agent-runtime_BedrockModelConfigurations.md) object  
Required: No

 ** [enableTrace](#API_agent-runtime_InvokeAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-request-enableTrace"></a>
Specifies whether to turn on the trace or not to track the agent's reasoning process. For more information, see [Trace enablement](https://docs.aws.amazon.com/bedrock/latest/userguide/agents-test.html#trace-events).  
Type: Boolean  
Required: No

 ** [endSession](#API_agent-runtime_InvokeAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-request-endSession"></a>
Specifies whether to end the session with the agent or not.  
Type: Boolean  
Required: No

 ** [inputText](#API_agent-runtime_InvokeAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-request-inputText"></a>
The prompt text to send the agent.  
If you include `returnControlInvocationResults` in the `sessionState` field, the `inputText` field will be ignored.
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 25000000.  
Required: No

 ** [memoryId](#API_agent-runtime_InvokeAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-request-memoryId"></a>
The unique identifier of the agent memory.  
Type: String  
Length Constraints: Minimum length of 2. Maximum length of 100.  
Pattern: `[0-9a-zA-Z._:-]+`   
Required: No

 ** [promptCreationConfigurations](#API_agent-runtime_InvokeAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-request-promptCreationConfigurations"></a>
Specifies parameters that control how the service populates the agent prompt for an `InvokeAgent` request. You can control which aspects of previous invocations in the same agent session the service uses to populate the agent prompt. This gives you more granular control over the contextual history that is used to process the current request.  
Type: [PromptCreationConfigurations](API_agent-runtime_PromptCreationConfigurations.md) object  
Required: No

 ** [sessionState](#API_agent-runtime_InvokeAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-request-sessionState"></a>
Contains parameters that specify various attributes of the session. For more information, see [Control session context](https://docs.aws.amazon.com/bedrock/latest/userguide/agents-session-state.html).  
If you include `returnControlInvocationResults` in the `sessionState` field, the `inputText` field will be ignored.
Type: [SessionState](API_agent-runtime_SessionState.md) object  
Required: No

 ** [streamingConfigurations](#API_agent-runtime_InvokeAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-request-streamingConfigurations"></a>
 Specifies the configurations for streaming.   
To use agent streaming, you need permissions to perform the `bedrock:InvokeModelWithResponseStream` action.
Type: [StreamingConfigurations](API_agent-runtime_StreamingConfigurations.md) object  
Required: No

## Response Syntax


```
HTTP/1.1 200
x-amzn-bedrock-agent-content-type: contentType
x-amz-bedrock-agent-session-id: sessionId
x-amz-bedrock-agent-memory-id: memoryId
Content-type: application/json

{
   "accessDeniedException": { 
   },
   "badGatewayException": { 
   },
   "chunk": { 
      "attribution": { 
         "citations": [ 
            { 
               "generatedResponsePart": { 
                  "textResponsePart": { 
                     "span": { 
                        "end": number,
                        "start": number
                     },
                     "text": "string"
                  }
               },
               "retrievedReferences": [ 
                  { 
                     "content": { 
                        "audio": { 
                           "s3Uri": "string",
                           "transcription": "string"
                        },
                        "byteContent": "string",
                        "row": [ 
                           { 
                              "columnName": "string",
                              "columnValue": "string",
                              "type": "string"
                           }
                        ],
                        "text": "string",
                        "type": "string",
                        "video": { 
                           "s3Uri": "string",
                           "summary": "string"
                        }
                     },
                     "location": { 
                        "confluenceLocation": { 
                           "url": "string"
                        },
                        "customDocumentLocation": { 
                           "id": "string"
                        },
                        "kendraDocumentLocation": { 
                           "uri": "string"
                        },
                        "s3Location": { 
                           "uri": "string"
                        },
                        "salesforceLocation": { 
                           "url": "string"
                        },
                        "sharePointLocation": { 
                           "url": "string"
                        },
                        "sqlLocation": { 
                           "query": "string"
                        },
                        "type": "string",
                        "webLocation": { 
                           "url": "string"
                        }
                     },
                     "metadata": { 
                        "string" : JSON value 
                     }
                  }
               ]
            }
         ]
      },
      "bytes": blob
   },
   "conflictException": { 
   },
   "dependencyFailedException": { 
   },
   "files": { 
      "files": [ 
         { 
            "bytes": blob,
            "name": "string",
            "type": "string"
         }
      ]
   },
   "internalServerException": { 
   },
   "modelNotReadyException": { 
   },
   "resourceNotFoundException": { 
   },
   "returnControl": { 
      "invocationId": "string",
      "invocationInputs": [ 
         { ... }
      ]
   },
   "serviceQuotaExceededException": { 
   },
   "throttlingException": { 
   },
   "trace": { 
      "agentAliasId": "string",
      "agentId": "string",
      "agentVersion": "string",
      "callerChain": [ 
         { ... }
      ],
      "collaboratorName": "string",
      "eventTime": "string",
      "sessionId": "string",
      "trace": { ... }
   },
   "validationException": { 
   }
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The response returns the following HTTP headers.

 ** [contentType](#API_agent-runtime_InvokeAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-response-contentType"></a>
The MIME type of the input data in the request. The default value is `application/json`.

 ** [memoryId](#API_agent-runtime_InvokeAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-response-memoryId"></a>
The unique identifier of the agent memory.  
Length Constraints: Minimum length of 2. Maximum length of 100.  
Pattern: `[0-9a-zA-Z._:-]+` 

 ** [sessionId](#API_agent-runtime_InvokeAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-response-sessionId"></a>
The unique identifier of the session with the agent.  
Length Constraints: Minimum length of 2. Maximum length of 100.  
Pattern: `[0-9a-zA-Z._:-]+` 

The following data is returned in JSON format by the service.

 ** [accessDeniedException](#API_agent-runtime_InvokeAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-response-accessDeniedException"></a>
The request is denied because of missing access permissions. Check your permissions and retry your request.  
Type: Exception  
HTTP Status Code: 403

 ** [badGatewayException](#API_agent-runtime_InvokeAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-response-badGatewayException"></a>
There was an issue with a dependency due to a server issue. Retry your request.  
Type: Exception  
HTTP Status Code: 502

 ** [chunk](#API_agent-runtime_InvokeAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-response-chunk"></a>
Contains a part of an agent response and citations for it.  
Type: [PayloadPart](API_agent-runtime_PayloadPart.md) object

 ** [conflictException](#API_agent-runtime_InvokeAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-response-conflictException"></a>
There was a conflict performing an operation. Resolve the conflict and retry your request.  
Type: Exception  
HTTP Status Code: 409

 ** [dependencyFailedException](#API_agent-runtime_InvokeAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-response-dependencyFailedException"></a>
There was an issue with a dependency. Check the resource configurations and retry the request.  
Type: Exception  
HTTP Status Code: 424

 ** [files](#API_agent-runtime_InvokeAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-response-files"></a>
Contains intermediate response for code interpreter if any files have been generated.  
Type: [FilePart](API_agent-runtime_FilePart.md) object

 ** [internalServerException](#API_agent-runtime_InvokeAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-response-internalServerException"></a>
An internal server error occurred. Retry your request.  
Type: Exception  
HTTP Status Code: 500

 ** [modelNotReadyException](#API_agent-runtime_InvokeAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-response-modelNotReadyException"></a>
 The model specified in the request is not ready to serve Inference requests. The AWS SDK will automatically retry the operation up to 5 times. For information about configuring automatic retries, see [Retry behavior](https://docs.aws.amazon.com/sdkref/latest/guide/feature-retry-behavior.html) in the *AWS SDKs and Tools* reference guide.   
Type: Exception  
HTTP Status Code: 424

 ** [resourceNotFoundException](#API_agent-runtime_InvokeAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-response-resourceNotFoundException"></a>
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
Type: Exception  
HTTP Status Code: 404

 ** [returnControl](#API_agent-runtime_InvokeAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-response-returnControl"></a>
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.  
Type: [ReturnControlPayload](API_agent-runtime_ReturnControlPayload.md) object

 ** [serviceQuotaExceededException](#API_agent-runtime_InvokeAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-response-serviceQuotaExceededException"></a>
The number of requests exceeds the service quota. Resubmit your request later.  
Type: Exception  
HTTP Status Code: 400

 ** [throttlingException](#API_agent-runtime_InvokeAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-response-throttlingException"></a>
The number of requests exceeds the limit. Resubmit your request later.  
Type: Exception  
HTTP Status Code: 429

 ** [trace](#API_agent-runtime_InvokeAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-response-trace"></a>
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](https://docs.aws.amazon.com/bedrock/latest/userguide/trace-events.html).  
Type: [TracePart](API_agent-runtime_TracePart.md) object

 ** [validationException](#API_agent-runtime_InvokeAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeAgent-response-validationException"></a>
Input validation failed. Check your request parameters and retry the request.  
Type: Exception  
HTTP Status Code: 400

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** BadGatewayException **   
There was an issue with a dependency due to a server issue. Retry your request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 502

 ** ConflictException **   
There was a conflict performing an operation. Resolve the conflict and retry your request.  
HTTP Status Code: 409

 ** DependencyFailedException **   
There was an issue with a dependency. Check the resource configurations and retry the request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 424

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ModelNotReadyException **   
 The model specified in the request is not ready to serve inference requests. The AWS SDK will automatically retry the operation up to 5 times. For information about configuring automatic retries, see [Retry behavior](https://docs.aws.amazon.com/sdkref/latest/guide/feature-retry-behavior.html) in the *AWS SDKs and Tools* reference guide.   
HTTP Status Code: 424

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ServiceQuotaExceededException **   
The number of requests exceeds the service quota. Resubmit your request later.  
HTTP Status Code: 400

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## Examples


### Example simple request


The following example inquires the agent to get the weather for Seattle.

```
POST https://bedrock-agent-runtime.us-east-1.amazonaws.com/agents/AGENT12345/agentAliases/TSTALIASID/sessions/abb/text

{
    "inputText": "give me the weather for seattle",
    "enableTrace": true
}
```

### Example response (action group defined with OpenAPI schema, control returned)


The following example shows a response from an agent that has invoked an action group that was configured as follows:
+ Defined with an OpenAPI schema
+ Configured to return control to the agent developer

```
HTTP/1.1 200
x-amzn-bedrock-agent-content-type: application/json
x-amz-bedrock-agent-session-id: session0
Content-type: application/json

{
    "invocationInputs": [{
        "apiInvocationInput": {
            "actionGroup": "WeatherAPIs",
            "apiPath": "/get-weather",
            "httpMethod": "get",
            "parameters": [
                {
                    "name": "location",
                    "type": "string",
                    "value": "seattle"
                },
                {
                    "name": "date",
                    "type": "string",
                    "value": "2024-09-15"
                }
            ]
        }
    }],
    "invocationId": "337cb2f6-ec74-4b49-8141-00b8091498ad"
}
```

### Example request using results from returned control (action group defined with OpenAPI schema)


The following example shows a request in which the results returned in the `InvokeAgent` response from an agent are passed to the `sessionState` of a new request. The results were returned from an agent that has invoked an action group that was configured as follows:
+ Defined with an OpenAPI schema
+ Configured to return control to the agent developer

The `invocationId` must match the `invocationId` that was returned in the response.

```
POST https: //bedrock-agent-runtime.us-east-1.amazonaws.com/agents/AGENT12345/agentAliases/TSTALIASID/sessions/abb/text
 
{
    "enableTrace": true,
    "sessionState": {
        "invocationId": "337cb2f6-ec74-4b49-8141-00b8091498ad",
        "returnControlInvocationResults": [{
            "apiResult": {
                "actionGroup": "WeatherAPIs",
                "httpMethod": "get",
                "apiPath": "/get-weather",
                "responseBody": {
                    "application/json": {
                        "body": "It's rainy in Seattle today."
                    }
                }
            }
        }]
    }
}
```

### Example response (action group defined with function details, control returned)


The following example shows a response from an agent that has invoked an action group that was configured as follows:
+ Defined with function details
+ Configured to return control to the agent developer

```
HTTP/1.1 200
x-amzn-bedrock-agent-content-type: application/json
x-amz-bedrock-agent-session-id: session0
Content-type: application/json
 
{
    "invocationInputs": [{
        "functionInvocationInput": {
            "actionGroup": "WeatherAPIs",
            "function": "getWeather",
            "parameters": [
                {
                    "name": "location",
                    "type": "string",
                    "value": "seattle"
                },
                {
                    "name": "date",
                    "type": "string",
                    "value": "2024-09-15"
                }
            ]
        }
    }],
    "invocationId": "79e0feaa-c6f7-49bf-814d-b7c498505172"
}
```

### Example request using results from returned control (action group defined with function details)


The following example shows a request in which the results returned in the `InvokeAgent` response from an agent are passed to the `sessionState` of a new request. The results were returned from an agent that has invoked an action group that was configured as follows:
+ Defined with function details
+ Configured to return control to the agent developer

The `invocationId` must match the `invocationId` that was returned in the response.

```
POST https://bedrock-agent-runtime.us-east-1.amazonaws.com/agents/AGENT12345/agentAliases/TSTALIASID/sessions/abb/text
            
{
    "enableTrace": true,
    "sessionState": {
        "invocationId": "79e0feaa-c6f7-49bf-814d-b7c498505172",
        "returnControlInvocationResults": [{
            "functionResult": {
                "actionGroup": "WeatherAPIs",
                "function": "getWeather",
                "responseBody": {
                    "TEXT": {
                        "body": "It's rainy in Seattle today."
                    }
                }
            }
        }]
    }
}
```

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/InvokeAgent) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/InvokeAgent) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/InvokeAgent) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/InvokeAgent) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/InvokeAgent) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/InvokeAgent) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/InvokeAgent) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/InvokeAgent) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/InvokeAgent) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/InvokeAgent) 

# InvokeFlow


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](https://docs.aws.amazon.com/bedrock/latest/userguide/flows-test.html) in the [Amazon Bedrock User Guide](https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html).

**Note**  
The AWS CLI doesn't support streaming operations in Amazon Bedrock, including `InvokeFlow`.

## Request Syntax


```
POST /flows/flowIdentifier/aliases/flowAliasIdentifier HTTP/1.1
Content-type: application/json

{
   "enableTrace": boolean,
   "executionId": "string",
   "inputs": [ 
      { 
         "content": { ... },
         "nodeInputName": "string",
         "nodeName": "string",
         "nodeOutputName": "string"
      }
   ],
   "modelPerformanceConfiguration": { 
      "performanceConfig": { 
         "latency": "string"
      }
   }
}
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [flowAliasIdentifier](#API_agent-runtime_InvokeFlow_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeFlow-request-uri-flowAliasIdentifier"></a>
The unique identifier of the flow alias.  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10}/alias/[0-9a-zA-Z]{10})|(\bTSTALIASID\b|[0-9a-zA-Z]+)`   
Required: Yes

 ** [flowIdentifier](#API_agent-runtime_InvokeFlow_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeFlow-request-uri-flowIdentifier"></a>
The unique identifier of the flow.  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10})|([0-9a-zA-Z]{10})`   
Required: Yes

## Request Body


The request accepts the following data in JSON format.

 ** [enableTrace](#API_agent-runtime_InvokeFlow_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeFlow-request-enableTrace"></a>
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](https://docs.aws.amazon.com/bedrock/latest/userguide/flows-trace.html).  
Type: Boolean  
Required: No

 ** [executionId](#API_agent-runtime_InvokeFlow_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeFlow-request-executionId"></a>
The unique identifier for the current flow execution. If you don't provide a value, Amazon Bedrock creates the identifier for you.   
Type: String  
Length Constraints: Minimum length of 2. Maximum length of 100.  
Pattern: `[0-9a-zA-Z._:-]+`   
Required: No

 ** [inputs](#API_agent-runtime_InvokeFlow_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeFlow-request-inputs"></a>
A list of objects, each containing information about an input into the flow.  
Type: Array of [FlowInput](API_agent-runtime_FlowInput.md) objects  
Array Members: Fixed number of 1 item.  
Required: Yes

 ** [modelPerformanceConfiguration](#API_agent-runtime_InvokeFlow_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeFlow-request-modelPerformanceConfiguration"></a>
Model performance settings for the request.  
Type: [ModelPerformanceConfiguration](API_agent-runtime_ModelPerformanceConfiguration.md) object  
Required: No

## Response Syntax


```
HTTP/1.1 200
x-amz-bedrock-flow-execution-id: executionId
Content-type: application/json

{
   "accessDeniedException": { 
   },
   "badGatewayException": { 
   },
   "conflictException": { 
   },
   "dependencyFailedException": { 
   },
   "flowCompletionEvent": { 
      "completionReason": "string"
   },
   "flowMultiTurnInputRequestEvent": { 
      "content": { ... },
      "nodeName": "string",
      "nodeType": "string"
   },
   "flowOutputEvent": { 
      "content": { ... },
      "nodeName": "string",
      "nodeType": "string"
   },
   "flowTraceEvent": { 
      "trace": { ... }
   },
   "internalServerException": { 
   },
   "resourceNotFoundException": { 
   },
   "serviceQuotaExceededException": { 
   },
   "throttlingException": { 
   },
   "validationException": { 
   }
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The response returns the following HTTP headers.

 ** [executionId](#API_agent-runtime_InvokeFlow_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeFlow-response-executionId"></a>
The unique identifier for the current flow execution.  
Length Constraints: Minimum length of 2. Maximum length of 100.  
Pattern: `[0-9a-zA-Z._:-]+` 

The following data is returned in JSON format by the service.

 ** [accessDeniedException](#API_agent-runtime_InvokeFlow_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeFlow-response-accessDeniedException"></a>
The request is denied because of missing access permissions. Check your permissions and retry your request.  
Type: Exception  
HTTP Status Code: 403

 ** [badGatewayException](#API_agent-runtime_InvokeFlow_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeFlow-response-badGatewayException"></a>
There was an issue with a dependency due to a server issue. Retry your request.  
Type: Exception  
HTTP Status Code: 502

 ** [conflictException](#API_agent-runtime_InvokeFlow_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeFlow-response-conflictException"></a>
There was a conflict performing an operation. Resolve the conflict and retry your request.  
Type: Exception  
HTTP Status Code: 409

 ** [dependencyFailedException](#API_agent-runtime_InvokeFlow_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeFlow-response-dependencyFailedException"></a>
There was an issue with a dependency. Check the resource configurations and retry the request.  
Type: Exception  
HTTP Status Code: 424

 ** [flowCompletionEvent](#API_agent-runtime_InvokeFlow_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeFlow-response-flowCompletionEvent"></a>
Contains information about why the flow completed.  
Type: [FlowCompletionEvent](API_agent-runtime_FlowCompletionEvent.md) object

 ** [flowMultiTurnInputRequestEvent](#API_agent-runtime_InvokeFlow_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeFlow-response-flowMultiTurnInputRequestEvent"></a>
The event stream containing the multi-turn input request information from the flow.  
Type: [FlowMultiTurnInputRequestEvent](API_agent-runtime_FlowMultiTurnInputRequestEvent.md) object

 ** [flowOutputEvent](#API_agent-runtime_InvokeFlow_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeFlow-response-flowOutputEvent"></a>
Contains information about an output from flow invocation.  
Type: [FlowOutputEvent](API_agent-runtime_FlowOutputEvent.md) object

 ** [flowTraceEvent](#API_agent-runtime_InvokeFlow_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeFlow-response-flowTraceEvent"></a>
Contains information about a trace, which tracks an input or output for a node in the flow.  
Type: [FlowTraceEvent](API_agent-runtime_FlowTraceEvent.md) object

 ** [internalServerException](#API_agent-runtime_InvokeFlow_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeFlow-response-internalServerException"></a>
An internal server error occurred. Retry your request.  
Type: Exception  
HTTP Status Code: 500

 ** [resourceNotFoundException](#API_agent-runtime_InvokeFlow_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeFlow-response-resourceNotFoundException"></a>
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
Type: Exception  
HTTP Status Code: 404

 ** [serviceQuotaExceededException](#API_agent-runtime_InvokeFlow_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeFlow-response-serviceQuotaExceededException"></a>
The number of requests exceeds the service quota. Resubmit your request later.  
Type: Exception  
HTTP Status Code: 400

 ** [throttlingException](#API_agent-runtime_InvokeFlow_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeFlow-response-throttlingException"></a>
The number of requests exceeds the limit. Resubmit your request later.  
Type: Exception  
HTTP Status Code: 429

 ** [validationException](#API_agent-runtime_InvokeFlow_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeFlow-response-validationException"></a>
Input validation failed. Check your request parameters and retry the request.  
Type: Exception  
HTTP Status Code: 400

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** BadGatewayException **   
There was an issue with a dependency due to a server issue. Retry your request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 502

 ** ConflictException **   
There was a conflict performing an operation. Resolve the conflict and retry your request.  
HTTP Status Code: 409

 ** DependencyFailedException **   
There was an issue with a dependency. Check the resource configurations and retry the request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 424

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ServiceQuotaExceededException **   
The number of requests exceeds the service quota. Resubmit your request later.  
HTTP Status Code: 400

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/InvokeFlow) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/InvokeFlow) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/InvokeFlow) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/InvokeFlow) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/InvokeFlow) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/InvokeFlow) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/InvokeFlow) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/InvokeFlow) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/InvokeFlow) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/InvokeFlow) 

# InvokeInlineAgent


 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 AWS 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](https://docs.aws.amazon.com/bedrock/latest/userguide/advanced-prompts.html).
+ The agent instructions will not be honored if your agent has only one knowledge base, uses default prompts, has no action group, and user input is disabled.

**Note**  
The AWS CLI doesn't support streaming operations in Amazon Bedrock, including `InvokeInlineAgent`.

## Request Syntax


```
POST /agents/sessionId HTTP/1.1
Content-type: application/json

{
   "actionGroups": [ 
      { 
         "actionGroupExecutor": { ... },
         "actionGroupName": "string",
         "apiSchema": { ... },
         "description": "string",
         "functionSchema": { ... },
         "parentActionGroupSignature": "string",
         "parentActionGroupSignatureParams": { 
            "string" : "string" 
         }
      }
   ],
   "agentCollaboration": "string",
   "agentName": "string",
   "bedrockModelConfigurations": { 
      "performanceConfig": { 
         "latency": "string"
      }
   },
   "collaboratorConfigurations": [ 
      { 
         "agentAliasArn": "string",
         "collaboratorInstruction": "string",
         "collaboratorName": "string",
         "relayConversationHistory": "string"
      }
   ],
   "collaborators": [ 
      { 
         "actionGroups": [ 
            { 
               "actionGroupExecutor": { ... },
               "actionGroupName": "string",
               "apiSchema": { ... },
               "description": "string",
               "functionSchema": { ... },
               "parentActionGroupSignature": "string",
               "parentActionGroupSignatureParams": { 
                  "string" : "string" 
               }
            }
         ],
         "agentCollaboration": "string",
         "agentName": "string",
         "collaboratorConfigurations": [ 
            { 
               "agentAliasArn": "string",
               "collaboratorInstruction": "string",
               "collaboratorName": "string",
               "relayConversationHistory": "string"
            }
         ],
         "customerEncryptionKeyArn": "string",
         "foundationModel": "string",
         "guardrailConfiguration": { 
            "guardrailIdentifier": "string",
            "guardrailVersion": "string"
         },
         "idleSessionTTLInSeconds": number,
         "instruction": "string",
         "knowledgeBases": [ 
            { 
               "description": "string",
               "knowledgeBaseId": "string",
               "retrievalConfiguration": { 
                  "vectorSearchConfiguration": { 
                     "filter": { ... },
                     "implicitFilterConfiguration": { 
                        "metadataAttributes": [ 
                           { 
                              "description": "string",
                              "key": "string",
                              "type": "string"
                           }
                        ],
                        "modelArn": "string"
                     },
                     "numberOfResults": number,
                     "overrideSearchType": "string",
                     "rerankingConfiguration": { 
                        "bedrockRerankingConfiguration": { 
                           "metadataConfiguration": { 
                              "selectionMode": "string",
                              "selectiveModeConfiguration": { ... }
                           },
                           "modelConfiguration": { 
                              "additionalModelRequestFields": { 
                                 "string" : JSON value 
                              },
                              "modelArn": "string"
                           },
                           "numberOfRerankedResults": number
                        },
                        "type": "string"
                     }
                  }
               }
            }
         ],
         "promptOverrideConfiguration": { 
            "overrideLambda": "string",
            "promptConfigurations": [ 
               { 
                  "additionalModelRequestFields": JSON value,
                  "basePromptTemplate": "string",
                  "foundationModel": "string",
                  "inferenceConfiguration": { 
                     "maximumLength": number,
                     "stopSequences": [ "string" ],
                     "temperature": number,
                     "topK": number,
                     "topP": number
                  },
                  "parserMode": "string",
                  "promptCreationMode": "string",
                  "promptState": "string",
                  "promptType": "string"
               }
            ]
         }
      }
   ],
   "customerEncryptionKeyArn": "string",
   "customOrchestration": { 
      "executor": { ... }
   },
   "enableTrace": boolean,
   "endSession": boolean,
   "foundationModel": "string",
   "guardrailConfiguration": { 
      "guardrailIdentifier": "string",
      "guardrailVersion": "string"
   },
   "idleSessionTTLInSeconds": number,
   "inlineSessionState": { 
      "conversationHistory": { 
         "messages": [ 
            { 
               "content": [ 
                  { ... }
               ],
               "role": "string"
            }
         ]
      },
      "files": [ 
         { 
            "name": "string",
            "source": { 
               "byteContent": { 
                  "data": blob,
                  "mediaType": "string"
               },
               "s3Location": { 
                  "uri": "string"
               },
               "sourceType": "string"
            },
            "useCase": "string"
         }
      ],
      "invocationId": "string",
      "promptSessionAttributes": { 
         "string" : "string" 
      },
      "returnControlInvocationResults": [ 
         { ... }
      ],
      "sessionAttributes": { 
         "string" : "string" 
      }
   },
   "inputText": "string",
   "instruction": "string",
   "knowledgeBases": [ 
      { 
         "description": "string",
         "knowledgeBaseId": "string",
         "retrievalConfiguration": { 
            "vectorSearchConfiguration": { 
               "filter": { ... },
               "implicitFilterConfiguration": { 
                  "metadataAttributes": [ 
                     { 
                        "description": "string",
                        "key": "string",
                        "type": "string"
                     }
                  ],
                  "modelArn": "string"
               },
               "numberOfResults": number,
               "overrideSearchType": "string",
               "rerankingConfiguration": { 
                  "bedrockRerankingConfiguration": { 
                     "metadataConfiguration": { 
                        "selectionMode": "string",
                        "selectiveModeConfiguration": { ... }
                     },
                     "modelConfiguration": { 
                        "additionalModelRequestFields": { 
                           "string" : JSON value 
                        },
                        "modelArn": "string"
                     },
                     "numberOfRerankedResults": number
                  },
                  "type": "string"
               }
            }
         }
      }
   ],
   "orchestrationType": "string",
   "promptCreationConfigurations": { 
      "excludePreviousThinkingSteps": boolean,
      "previousConversationTurnsToInclude": number
   },
   "promptOverrideConfiguration": { 
      "overrideLambda": "string",
      "promptConfigurations": [ 
         { 
            "additionalModelRequestFields": JSON value,
            "basePromptTemplate": "string",
            "foundationModel": "string",
            "inferenceConfiguration": { 
               "maximumLength": number,
               "stopSequences": [ "string" ],
               "temperature": number,
               "topK": number,
               "topP": number
            },
            "parserMode": "string",
            "promptCreationMode": "string",
            "promptState": "string",
            "promptType": "string"
         }
      ]
   },
   "streamingConfigurations": { 
      "applyGuardrailInterval": number,
      "streamFinalResponse": boolean
   }
}
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [sessionId](#API_agent-runtime_InvokeInlineAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-request-uri-sessionId"></a>
 The unique identifier of the session. Use the same value across requests to continue the same conversation.   
Length Constraints: Minimum length of 2. Maximum length of 100.  
Pattern: `[0-9a-zA-Z._:-]+`   
Required: Yes

## Request Body


The request accepts the following data in JSON format.

 ** [actionGroups](#API_agent-runtime_InvokeInlineAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-request-actionGroups"></a>
 A list of action groups with each action group defining the action the inline agent needs to carry out.   
Type: Array of [AgentActionGroup](API_agent-runtime_AgentActionGroup.md) objects  
Required: No

 ** [agentCollaboration](#API_agent-runtime_InvokeInlineAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-request-agentCollaboration"></a>
 Defines how the inline collaborator agent handles information across multiple collaborator agents to coordinate a final response. The inline collaborator agent can also be the supervisor.   
Type: String  
Valid Values: `SUPERVISOR | SUPERVISOR_ROUTER | DISABLED`   
Required: No

 ** [agentName](#API_agent-runtime_InvokeInlineAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-request-agentName"></a>
The name for the agent.  
Type: String  
Pattern: `([0-9a-zA-Z][_-]?){1,100}`   
Required: No

 ** [bedrockModelConfigurations](#API_agent-runtime_InvokeInlineAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-request-bedrockModelConfigurations"></a>
Model settings for the request.  
Type: [InlineBedrockModelConfigurations](API_agent-runtime_InlineBedrockModelConfigurations.md) object  
Required: No

 ** [collaboratorConfigurations](#API_agent-runtime_InvokeInlineAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-request-collaboratorConfigurations"></a>
 Settings for an inline agent collaborator called with [InvokeInlineAgent](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeInlineAgent.html).   
Type: Array of [CollaboratorConfiguration](API_agent-runtime_CollaboratorConfiguration.md) objects  
Required: No

 ** [collaborators](#API_agent-runtime_InvokeInlineAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-request-collaborators"></a>
 List of collaborator inline agents.   
Type: Array of [Collaborator](API_agent-runtime_Collaborator.md) objects  
Required: No

 ** [customerEncryptionKeyArn](#API_agent-runtime_InvokeInlineAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-request-customerEncryptionKeyArn"></a>
 The Amazon Resource Name (ARN) of the AWS KMS key to use to encrypt your inline agent.   
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `arn:aws(|-cn|-us-gov):kms:[a-zA-Z0-9-]*:[0-9]{12}:key/[a-zA-Z0-9-]{36}`   
Required: No

 ** [customOrchestration](#API_agent-runtime_InvokeInlineAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-request-customOrchestration"></a>
Contains details of the custom orchestration configured for the agent.   
Type: [CustomOrchestration](API_agent-runtime_CustomOrchestration.md) object  
Required: No

 ** [enableTrace](#API_agent-runtime_InvokeInlineAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-request-enableTrace"></a>
 Specifies whether to turn on the trace or not to track the agent's reasoning process. For more information, see [Using trace](https://docs.aws.amazon.com/bedrock/latest/userguide/trace-events.html).   
Type: Boolean  
Required: No

 ** [endSession](#API_agent-runtime_InvokeInlineAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-request-endSession"></a>
 Specifies whether to end the session with the inline agent or not.   
Type: Boolean  
Required: No

 ** [foundationModel](#API_agent-runtime_InvokeInlineAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-request-foundationModel"></a>
 The [model identifier (ID)](https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html#model-ids-arns) of the model to use for orchestration by the inline agent. For example, `meta.llama3-1-70b-instruct-v1:0`.   
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `.*(^arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}:(([0-9]{12}:custom-model/[a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}(([:][a-z0-9-]{1,63}){0,2})?/[a-z0-9]{12})|(:foundation-model/([a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}([.]?[a-z0-9-]{1,63})([:][a-z0-9-]{1,63}){0,2})))|(([a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}([.]?[a-z0-9-]{1,63})([:][a-z0-9-]{1,63}){0,2}))|(([0-9a-zA-Z][_-]?)+))$|(^arn:aws(|-us-gov|-cn|-iso|-iso-b):bedrock:(|[0-9a-z-]{1,20}):(|[0-9]{12}):inference-profile/[a-zA-Z0-9-:.]+)`   
Required: Yes

 ** [guardrailConfiguration](#API_agent-runtime_InvokeInlineAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-request-guardrailConfiguration"></a>
 The [guardrails](https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html) to assign to the inline agent.   
Type: [GuardrailConfigurationWithArn](API_agent-runtime_GuardrailConfigurationWithArn.md) object  
Required: No

 ** [idleSessionTTLInSeconds](#API_agent-runtime_InvokeInlineAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-request-idleSessionTTLInSeconds"></a>
 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.  
Type: Integer  
Valid Range: Minimum value of 60. Maximum value of 3600.  
Required: No

 ** [inlineSessionState](#API_agent-runtime_InvokeInlineAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-request-inlineSessionState"></a>
 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](https://docs.aws.amazon.com/bedrock/latest/userguide/agents-session-state.html).   
If you include `returnControlInvocationResults` in the `sessionState` field, the `inputText` field will be ignored.
Type: [InlineSessionState](API_agent-runtime_InlineSessionState.md) object  
Required: No

 ** [inputText](#API_agent-runtime_InvokeInlineAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-request-inputText"></a>
 The prompt text to send to the agent.   
If you include `returnControlInvocationResults` in the `sessionState` field, the `inputText` field will be ignored.
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 25000000.  
Required: No

 ** [instruction](#API_agent-runtime_InvokeInlineAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-request-instruction"></a>
 The instructions that tell the inline agent what it should do and how it should interact with users.   
Type: String  
Length Constraints: Minimum length of 40.  
Required: Yes

 ** [knowledgeBases](#API_agent-runtime_InvokeInlineAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-request-knowledgeBases"></a>
 Contains information of the knowledge bases to associate with.   
Type: Array of [KnowledgeBase](API_agent-runtime_KnowledgeBase.md) objects  
Required: No

 ** [orchestrationType](#API_agent-runtime_InvokeInlineAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-request-orchestrationType"></a>
Specifies the type of orchestration strategy for the agent. This is set to DEFAULT orchestration type, by default.   
Type: String  
Valid Values: `DEFAULT | CUSTOM_ORCHESTRATION`   
Required: No

 ** [promptCreationConfigurations](#API_agent-runtime_InvokeInlineAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-request-promptCreationConfigurations"></a>
Specifies parameters that control how the service populates the agent prompt for an `InvokeInlineAgent` request. You can control which aspects of previous invocations in the same agent session the service uses to populate the agent prompt. This gives you more granular control over the contextual history that is used to process the current request.  
Type: [PromptCreationConfigurations](API_agent-runtime_PromptCreationConfigurations.md) object  
Required: No

 ** [promptOverrideConfiguration](#API_agent-runtime_InvokeInlineAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-request-promptOverrideConfiguration"></a>
 Configurations for advanced prompts used to override the default prompts to enhance the accuracy of the inline agent.   
Type: [PromptOverrideConfiguration](API_agent-runtime_PromptOverrideConfiguration.md) object  
Required: No

 ** [streamingConfigurations](#API_agent-runtime_InvokeInlineAgent_RequestSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-request-streamingConfigurations"></a>
 Specifies the configurations for streaming.   
To use agent streaming, you need permissions to perform the `bedrock:InvokeModelWithResponseStream` action.
Type: [StreamingConfigurations](API_agent-runtime_StreamingConfigurations.md) object  
Required: No

## Response Syntax


```
HTTP/1.1 200
x-amzn-bedrock-agent-content-type: contentType
x-amz-bedrock-agent-session-id: sessionId
Content-type: application/json

{
   "accessDeniedException": { 
   },
   "badGatewayException": { 
   },
   "chunk": { 
      "attribution": { 
         "citations": [ 
            { 
               "generatedResponsePart": { 
                  "textResponsePart": { 
                     "span": { 
                        "end": number,
                        "start": number
                     },
                     "text": "string"
                  }
               },
               "retrievedReferences": [ 
                  { 
                     "content": { 
                        "audio": { 
                           "s3Uri": "string",
                           "transcription": "string"
                        },
                        "byteContent": "string",
                        "row": [ 
                           { 
                              "columnName": "string",
                              "columnValue": "string",
                              "type": "string"
                           }
                        ],
                        "text": "string",
                        "type": "string",
                        "video": { 
                           "s3Uri": "string",
                           "summary": "string"
                        }
                     },
                     "location": { 
                        "confluenceLocation": { 
                           "url": "string"
                        },
                        "customDocumentLocation": { 
                           "id": "string"
                        },
                        "kendraDocumentLocation": { 
                           "uri": "string"
                        },
                        "s3Location": { 
                           "uri": "string"
                        },
                        "salesforceLocation": { 
                           "url": "string"
                        },
                        "sharePointLocation": { 
                           "url": "string"
                        },
                        "sqlLocation": { 
                           "query": "string"
                        },
                        "type": "string",
                        "webLocation": { 
                           "url": "string"
                        }
                     },
                     "metadata": { 
                        "string" : JSON value 
                     }
                  }
               ]
            }
         ]
      },
      "bytes": blob
   },
   "conflictException": { 
   },
   "dependencyFailedException": { 
   },
   "files": { 
      "files": [ 
         { 
            "bytes": blob,
            "name": "string",
            "type": "string"
         }
      ]
   },
   "internalServerException": { 
   },
   "resourceNotFoundException": { 
   },
   "returnControl": { 
      "invocationId": "string",
      "invocationInputs": [ 
         { ... }
      ]
   },
   "serviceQuotaExceededException": { 
   },
   "throttlingException": { 
   },
   "trace": { 
      "callerChain": [ 
         { ... }
      ],
      "collaboratorName": "string",
      "eventTime": "string",
      "sessionId": "string",
      "trace": { ... }
   },
   "validationException": { 
   }
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The response returns the following HTTP headers.

 ** [contentType](#API_agent-runtime_InvokeInlineAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-response-contentType"></a>
 The MIME type of the input data in the request. The default value is application/json. 

 ** [sessionId](#API_agent-runtime_InvokeInlineAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-response-sessionId"></a>
 The unique identifier of the session with the agent.   
Length Constraints: Minimum length of 2. Maximum length of 100.  
Pattern: `[0-9a-zA-Z._:-]+` 

The following data is returned in JSON format by the service.

 ** [accessDeniedException](#API_agent-runtime_InvokeInlineAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-response-accessDeniedException"></a>
The request is denied because of missing access permissions. Check your permissions and retry your request.  
Type: Exception  
HTTP Status Code: 403

 ** [badGatewayException](#API_agent-runtime_InvokeInlineAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-response-badGatewayException"></a>
There was an issue with a dependency due to a server issue. Retry your request.   
Type: Exception  
HTTP Status Code: 502

 ** [chunk](#API_agent-runtime_InvokeInlineAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-response-chunk"></a>
Contains a part of an agent response and citations for it.  
Type: [InlineAgentPayloadPart](API_agent-runtime_InlineAgentPayloadPart.md) object

 ** [conflictException](#API_agent-runtime_InvokeInlineAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-response-conflictException"></a>
There was a conflict performing an operation. Resolve the conflict and retry your request.   
Type: Exception  
HTTP Status Code: 409

 ** [dependencyFailedException](#API_agent-runtime_InvokeInlineAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-response-dependencyFailedException"></a>
There was an issue with a dependency. Check the resource configurations and retry the request.  
Type: Exception  
HTTP Status Code: 424

 ** [files](#API_agent-runtime_InvokeInlineAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-response-files"></a>
Contains intermediate response for code interpreter if any files have been generated.  
Type: [InlineAgentFilePart](API_agent-runtime_InlineAgentFilePart.md) object

 ** [internalServerException](#API_agent-runtime_InvokeInlineAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-response-internalServerException"></a>
An internal server error occurred. Retry your request.  
Type: Exception  
HTTP Status Code: 500

 ** [resourceNotFoundException](#API_agent-runtime_InvokeInlineAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-response-resourceNotFoundException"></a>
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.   
Type: Exception  
HTTP Status Code: 404

 ** [returnControl](#API_agent-runtime_InvokeInlineAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-response-returnControl"></a>
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.  
Type: [InlineAgentReturnControlPayload](API_agent-runtime_InlineAgentReturnControlPayload.md) object

 ** [serviceQuotaExceededException](#API_agent-runtime_InvokeInlineAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-response-serviceQuotaExceededException"></a>
The number of requests exceeds the service quota. Resubmit your request later.  
Type: Exception  
HTTP Status Code: 400

 ** [throttlingException](#API_agent-runtime_InvokeInlineAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-response-throttlingException"></a>
The number of requests exceeds the limit. Resubmit your request later.  
Type: Exception  
HTTP Status Code: 429

 ** [trace](#API_agent-runtime_InvokeInlineAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-response-trace"></a>
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](https://docs.aws.amazon.com/bedrock/latest/userguide/trace-events.html).   
Type: [InlineAgentTracePart](API_agent-runtime_InlineAgentTracePart.md) object

 ** [validationException](#API_agent-runtime_InvokeInlineAgent_ResponseSyntax) **   <a name="bedrock-agent-runtime_InvokeInlineAgent-response-validationException"></a>
Input validation failed. Check your request parameters and retry the request.  
Type: Exception  
HTTP Status Code: 400

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** BadGatewayException **   
There was an issue with a dependency due to a server issue. Retry your request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 502

 ** ConflictException **   
There was a conflict performing an operation. Resolve the conflict and retry your request.  
HTTP Status Code: 409

 ** DependencyFailedException **   
There was an issue with a dependency. Check the resource configurations and retry the request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 424

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ServiceQuotaExceededException **   
The number of requests exceeds the service quota. Resubmit your request later.  
HTTP Status Code: 400

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/InvokeInlineAgent) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/InvokeInlineAgent) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/InvokeInlineAgent) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/InvokeInlineAgent) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/InvokeInlineAgent) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/InvokeInlineAgent) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/InvokeInlineAgent) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/InvokeInlineAgent) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/InvokeInlineAgent) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/InvokeInlineAgent) 

# ListFlowExecutionEvents


Lists events that occurred during a flow execution. Events provide detailed information about the execution progress, including node inputs and outputs, flow inputs and outputs, condition results, and failure events.

**Note**  
Flow executions is in preview release for Amazon Bedrock and is subject to change.

## Request Syntax


```
GET /flows/flowIdentifier/aliases/flowAliasIdentifier/executions/executionIdentifier/events?eventType=eventType&maxResults=maxResults&nextToken=nextToken HTTP/1.1
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [eventType](#API_agent-runtime_ListFlowExecutionEvents_RequestSyntax) **   <a name="bedrock-agent-runtime_ListFlowExecutionEvents-request-uri-eventType"></a>
The type of events to retrieve. Specify `Node` for node-level events or `Flow` for flow-level events.  
Valid Values: `Node | Flow`   
Required: Yes

 ** [executionIdentifier](#API_agent-runtime_ListFlowExecutionEvents_RequestSyntax) **   <a name="bedrock-agent-runtime_ListFlowExecutionEvents-request-uri-executionIdentifier"></a>
The unique identifier of the flow execution.  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `[a-zA-Z0-9-]{1,36}$|^(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10}/alias/[0-9a-zA-Z]{10}/execution/[a-zA-Z0-9-]{1,36})`   
Required: Yes

 ** [flowAliasIdentifier](#API_agent-runtime_ListFlowExecutionEvents_RequestSyntax) **   <a name="bedrock-agent-runtime_ListFlowExecutionEvents-request-uri-flowAliasIdentifier"></a>
The unique identifier of the flow alias used for the execution.  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10}/alias/[0-9a-zA-Z]{10})|(\bTSTALIASID\b|[0-9a-zA-Z]+)`   
Required: Yes

 ** [flowIdentifier](#API_agent-runtime_ListFlowExecutionEvents_RequestSyntax) **   <a name="bedrock-agent-runtime_ListFlowExecutionEvents-request-uri-flowIdentifier"></a>
The unique identifier of the flow.  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10})|([0-9a-zA-Z]{10})`   
Required: Yes

 ** [maxResults](#API_agent-runtime_ListFlowExecutionEvents_RequestSyntax) **   <a name="bedrock-agent-runtime_ListFlowExecutionEvents-request-uri-maxResults"></a>
The maximum number of events to return in a single response. If more events exist than the specified maxResults value, a token is included in the response so that the remaining results can be retrieved.  
Valid Range: Minimum value of 1. Maximum value of 1000.

 ** [nextToken](#API_agent-runtime_ListFlowExecutionEvents_RequestSyntax) **   <a name="bedrock-agent-runtime_ListFlowExecutionEvents-request-uri-nextToken"></a>
A token to retrieve the next set of results. This value is returned in the response if more results are available.  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `\S*` 

## Request Body


The request does not have a request body.

## Response Syntax


```
HTTP/1.1 200
Content-type: application/json

{
   "flowExecutionEvents": [ 
      { ... }
   ],
   "nextToken": "string"
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [flowExecutionEvents](#API_agent-runtime_ListFlowExecutionEvents_ResponseSyntax) **   <a name="bedrock-agent-runtime_ListFlowExecutionEvents-response-flowExecutionEvents"></a>
A list of events that occurred during the flow execution. Events can include node inputs and outputs, flow inputs and outputs, condition results, and failure events.  
Type: Array of [FlowExecutionEvent](API_agent-runtime_FlowExecutionEvent.md) objects  
Array Members: Minimum number of 0 items. Maximum number of 10 items.

 ** [nextToken](#API_agent-runtime_ListFlowExecutionEvents_ResponseSyntax) **   <a name="bedrock-agent-runtime_ListFlowExecutionEvents-response-nextToken"></a>
A token to retrieve the next set of results. This value is returned if more results are available.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `\S*` 

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/ListFlowExecutionEvents) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/ListFlowExecutionEvents) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/ListFlowExecutionEvents) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/ListFlowExecutionEvents) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/ListFlowExecutionEvents) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/ListFlowExecutionEvents) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/ListFlowExecutionEvents) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/ListFlowExecutionEvents) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/ListFlowExecutionEvents) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/ListFlowExecutionEvents) 

# ListFlowExecutions


Lists all executions of a flow. Results can be paginated and include summary information about each execution, such as status, start and end times, and the execution's Amazon Resource Name (ARN).

**Note**  
Flow executions is in preview release for Amazon Bedrock and is subject to change.

## Request Syntax


```
GET /flows/flowIdentifier/executions?flowAliasIdentifier=flowAliasIdentifier&maxResults=maxResults&nextToken=nextToken HTTP/1.1
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [flowAliasIdentifier](#API_agent-runtime_ListFlowExecutions_RequestSyntax) **   <a name="bedrock-agent-runtime_ListFlowExecutions-request-uri-flowAliasIdentifier"></a>
The unique identifier of the flow alias to list executions for.  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10}/alias/[0-9a-zA-Z]{10})|(\bTSTALIASID\b|[0-9a-zA-Z]+)` 

 ** [flowIdentifier](#API_agent-runtime_ListFlowExecutions_RequestSyntax) **   <a name="bedrock-agent-runtime_ListFlowExecutions-request-uri-flowIdentifier"></a>
The unique identifier of the flow to list executions for.  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10})|([0-9a-zA-Z]{10})`   
Required: Yes

 ** [maxResults](#API_agent-runtime_ListFlowExecutions_RequestSyntax) **   <a name="bedrock-agent-runtime_ListFlowExecutions-request-uri-maxResults"></a>
The maximum number of flow executions to return in a single response. If more executions exist than the specified `maxResults` value, a token is included in the response so that the remaining results can be retrieved.  
Valid Range: Minimum value of 1. Maximum value of 1000.

 ** [nextToken](#API_agent-runtime_ListFlowExecutions_RequestSyntax) **   <a name="bedrock-agent-runtime_ListFlowExecutions-request-uri-nextToken"></a>
A token to retrieve the next set of results. This value is returned in the response if more results are available.  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `\S*` 

## Request Body


The request does not have a request body.

## Response Syntax


```
HTTP/1.1 200
Content-type: application/json

{
   "flowExecutionSummaries": [ 
      { 
         "createdAt": "string",
         "endedAt": "string",
         "executionArn": "string",
         "flowAliasIdentifier": "string",
         "flowIdentifier": "string",
         "flowVersion": "string",
         "status": "string"
      }
   ],
   "nextToken": "string"
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [flowExecutionSummaries](#API_agent-runtime_ListFlowExecutions_ResponseSyntax) **   <a name="bedrock-agent-runtime_ListFlowExecutions-response-flowExecutionSummaries"></a>
A list of flow execution summaries. Each summary includes the execution ARN, flow identifier, flow alias identifier, flow version, status, and timestamps.  
Type: Array of [FlowExecutionSummary](API_agent-runtime_FlowExecutionSummary.md) objects  
Array Members: Minimum number of 0 items. Maximum number of 10 items.

 ** [nextToken](#API_agent-runtime_ListFlowExecutions_ResponseSyntax) **   <a name="bedrock-agent-runtime_ListFlowExecutions-response-nextToken"></a>
A token to retrieve the next set of results. This value is returned if more results are available.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `\S*` 

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/ListFlowExecutions) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/ListFlowExecutions) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/ListFlowExecutions) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/ListFlowExecutions) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/ListFlowExecutions) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/ListFlowExecutions) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/ListFlowExecutions) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/ListFlowExecutions) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/ListFlowExecutions) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/ListFlowExecutions) 

# ListInvocations


Lists all invocations associated with a specific session. For more information about sessions, see [Store and retrieve conversation history and context with Amazon Bedrock sessions](https://docs.aws.amazon.com/bedrock/latest/userguide/sessions.html).

## Request Syntax


```
POST /sessions/sessionIdentifier/invocations/?maxResults=maxResults&nextToken=nextToken HTTP/1.1
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [maxResults](#API_agent-runtime_ListInvocations_RequestSyntax) **   <a name="bedrock-agent-runtime_ListInvocations-request-uri-maxResults"></a>
The maximum number of results 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.  
Valid Range: Minimum value of 1. Maximum value of 1000.

 ** [nextToken](#API_agent-runtime_ListInvocations_RequestSyntax) **   <a name="bedrock-agent-runtime_ListInvocations-request-uri-nextToken"></a>
If the total number of results is greater than the `maxResults` 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.   
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `\S*` 

 ** [sessionIdentifier](#API_agent-runtime_ListInvocations_RequestSyntax) **   <a name="bedrock-agent-runtime_ListInvocations-request-uri-sessionIdentifier"></a>
The unique identifier for the session to list invocations for. You can specify either the session's `sessionId` or its Amazon Resource Name (ARN).  
Pattern: `(arn:aws(-[^:]+)?:bedrock:[a-z0-9-]+:[0-9]{12}:session/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})|([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})`   
Required: Yes

## Request Body


The request does not have a request body.

## Response Syntax


```
HTTP/1.1 200
Content-type: application/json

{
   "invocationSummaries": [ 
      { 
         "createdAt": "string",
         "invocationId": "string",
         "sessionId": "string"
      }
   ],
   "nextToken": "string"
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [invocationSummaries](#API_agent-runtime_ListInvocations_ResponseSyntax) **   <a name="bedrock-agent-runtime_ListInvocations-response-invocationSummaries"></a>
A list of invocation summaries associated with the session.  
Type: Array of [InvocationSummary](API_agent-runtime_InvocationSummary.md) objects

 ** [nextToken](#API_agent-runtime_ListInvocations_ResponseSyntax) **   <a name="bedrock-agent-runtime_ListInvocations-response-nextToken"></a>
If the total number of results is greater than the `maxResults` value provided in the request, use this token when making another request in the `nextToken` field to return the next batch of results.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `\S*` 

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## Examples


### Example request


This example illustrates one usage of ListInvocations.

```
POST bedrock-agent-runtime.us-east-1.amazonaws.com/sessions/12345abc-1234-abcd-1234-abcdef123456/invocations/?maxResults=10&nextToken=abc123 HTTP/1.1
```

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/ListInvocations) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/ListInvocations) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/ListInvocations) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/ListInvocations) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/ListInvocations) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/ListInvocations) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/ListInvocations) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/ListInvocations) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/ListInvocations) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/ListInvocations) 

# ListInvocationSteps


Lists all invocation steps associated with a session and optionally, an invocation within the session. For more information about sessions, see [Store and retrieve conversation history and context with Amazon Bedrock sessions](https://docs.aws.amazon.com/bedrock/latest/userguide/sessions.html).

## Request Syntax


```
POST /sessions/sessionIdentifier/invocationSteps/?maxResults=maxResults&nextToken=nextToken HTTP/1.1
Content-type: application/json

{
   "invocationIdentifier": "string"
}
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [maxResults](#API_agent-runtime_ListInvocationSteps_RequestSyntax) **   <a name="bedrock-agent-runtime_ListInvocationSteps-request-uri-maxResults"></a>
The maximum number of results 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.  
Valid Range: Minimum value of 1. Maximum value of 1000.

 ** [nextToken](#API_agent-runtime_ListInvocationSteps_RequestSyntax) **   <a name="bedrock-agent-runtime_ListInvocationSteps-request-uri-nextToken"></a>
If the total number of results is greater than the `maxResults` 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.   
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `\S*` 

 ** [sessionIdentifier](#API_agent-runtime_ListInvocationSteps_RequestSyntax) **   <a name="bedrock-agent-runtime_ListInvocationSteps-request-uri-sessionIdentifier"></a>
The unique identifier for the session associated with the invocation steps. You can specify either the session's `sessionId` or its Amazon Resource Name (ARN).  
Pattern: `(arn:aws(-[^:]+)?:bedrock:[a-z0-9-]+:[0-9]{12}:session/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})|([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})`   
Required: Yes

## Request Body


The request accepts the following data in JSON format.

 ** [invocationIdentifier](#API_agent-runtime_ListInvocationSteps_RequestSyntax) **   <a name="bedrock-agent-runtime_ListInvocationSteps-request-invocationIdentifier"></a>
The unique identifier (in UUID format) for the invocation to list invocation steps for.  
Type: String  
Pattern: `[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}`   
Required: No

## Response Syntax


```
HTTP/1.1 200
Content-type: application/json

{
   "invocationStepSummaries": [ 
      { 
         "invocationId": "string",
         "invocationStepId": "string",
         "invocationStepTime": "string",
         "sessionId": "string"
      }
   ],
   "nextToken": "string"
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [invocationStepSummaries](#API_agent-runtime_ListInvocationSteps_ResponseSyntax) **   <a name="bedrock-agent-runtime_ListInvocationSteps-response-invocationStepSummaries"></a>
A list of summaries for each invocation step associated with a session and if you specified it, an invocation within the session.  
Type: Array of [InvocationStepSummary](API_agent-runtime_InvocationStepSummary.md) objects

 ** [nextToken](#API_agent-runtime_ListInvocationSteps_ResponseSyntax) **   <a name="bedrock-agent-runtime_ListInvocationSteps-response-nextToken"></a>
If the total number of results is greater than the `maxResults` value provided in the request, use this token when making another request in the `nextToken` field to return the next batch of results.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `\S*` 

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## Examples


### Example request


This example illustrates one usage of ListInvocationSteps.

```
POST bedrock-agent-runtime.us-east-1.amazonaws.com/sessions/12345abc-1234-abcd-1234-abcdef123456/invocationSteps/?maxResults=10&nextToken=abc123 HTTP/1.1
Content-type: application/json

{
    "invocationIdentifier": "abc-1234-abcd-1234-abcdef123456"
}
```

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/ListInvocationSteps) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/ListInvocationSteps) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/ListInvocationSteps) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/ListInvocationSteps) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/ListInvocationSteps) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/ListInvocationSteps) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/ListInvocationSteps) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/ListInvocationSteps) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/ListInvocationSteps) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/ListInvocationSteps) 

# ListSessions


Lists all sessions in your AWS account. For more information about sessions, see [Store and retrieve conversation history and context with Amazon Bedrock sessions](https://docs.aws.amazon.com/bedrock/latest/userguide/sessions.html).

## Request Syntax


```
POST /sessions/?maxResults=maxResults&nextToken=nextToken HTTP/1.1
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [maxResults](#API_agent-runtime_ListSessions_RequestSyntax) **   <a name="bedrock-agent-runtime_ListSessions-request-uri-maxResults"></a>
The maximum number of results 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.  
Valid Range: Minimum value of 1. Maximum value of 1000.

 ** [nextToken](#API_agent-runtime_ListSessions_RequestSyntax) **   <a name="bedrock-agent-runtime_ListSessions-request-uri-nextToken"></a>
If the total number of results is greater than the `maxResults` 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.   
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `\S*` 

## Request Body


The request does not have a request body.

## Response Syntax


```
HTTP/1.1 200
Content-type: application/json

{
   "nextToken": "string",
   "sessionSummaries": [ 
      { 
         "createdAt": "string",
         "lastUpdatedAt": "string",
         "sessionArn": "string",
         "sessionId": "string",
         "sessionStatus": "string"
      }
   ]
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [nextToken](#API_agent-runtime_ListSessions_ResponseSyntax) **   <a name="bedrock-agent-runtime_ListSessions-response-nextToken"></a>
If the total number of results is greater than the `maxResults` value provided in the request, use this token when making another request in the `nextToken` field to return the next batch of results.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `\S*` 

 ** [sessionSummaries](#API_agent-runtime_ListSessions_ResponseSyntax) **   <a name="bedrock-agent-runtime_ListSessions-response-sessionSummaries"></a>
A list of summaries for each session in your AWS account.  
Type: Array of [SessionSummary](API_agent-runtime_SessionSummary.md) objects

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## Examples


### Example request


This example illustrates one usage of ListSessions.

```
POST bedrock-agent-runtime.us-east-1.amazonaws.com/sessions/?maxResults=10&nextToken=nextToken HTTP/1.1
```

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/ListSessions) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/ListSessions) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/ListSessions) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/ListSessions) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/ListSessions) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/ListSessions) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/ListSessions) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/ListSessions) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/ListSessions) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/ListSessions) 

# ListTagsForResource


List all the tags for the resource you specify.

## Request Syntax


```
GET /tags/resourceArn HTTP/1.1
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [resourceArn](#API_agent-runtime_ListTagsForResource_RequestSyntax) **   <a name="bedrock-agent-runtime_ListTagsForResource-request-uri-resourceArn"></a>
The Amazon Resource Name (ARN) of the resource for which to list tags.  
Length Constraints: Minimum length of 20. Maximum length of 1011.  
Pattern: `.*(^arn:aws(-[^:]+)?:bedrock:[a-zA-Z0-9-]+:[0-9]{12}:(session)/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$).*`   
Required: Yes

## Request Body


The request does not have a request body.

## Response Syntax


```
HTTP/1.1 200
Content-type: application/json

{
   "tags": { 
      "string" : "string" 
   }
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [tags](#API_agent-runtime_ListTagsForResource_ResponseSyntax) **   <a name="bedrock-agent-runtime_ListTagsForResource-response-tags"></a>
The key-value pairs for the tags associated with the resource.  
Type: String to string map  
Map Entries: Maximum number of 200 items.  
Key Length Constraints: Minimum length of 1. Maximum length of 128.  
Key Pattern: `[a-zA-Z0-9\s._:/=+@-]*`   
Value Length Constraints: Minimum length of 0. Maximum length of 256.  
Value Pattern: `[a-zA-Z0-9\s._:/=+@-]*` 

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## Examples


### Example request


This example illustrates one usage of ListTagsForResource.

```
GET /tags/arn:aws:bedrock:us-west-2:123456789012:session/12345abc-1234-abcd-1234-abcdef123456 HTTP/1.1
```

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/ListTagsForResource) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/ListTagsForResource) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/ListTagsForResource) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/ListTagsForResource) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/ListTagsForResource) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/ListTagsForResource) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/ListTagsForResource) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/ListTagsForResource) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/ListTagsForResource) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/ListTagsForResource) 

# OptimizePrompt


Optimizes a prompt for the task that you specify. For more information, see [Optimize a prompt](https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management-optimize.html) in the [Amazon Bedrock User Guide](https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html).

## Request Syntax


```
POST /optimize-prompt HTTP/1.1
Content-type: application/json

{
   "input": { ... },
   "targetModelId": "string"
}
```

## URI Request Parameters


The request does not use any URI parameters.

## Request Body


The request accepts the following data in JSON format.

 ** [input](#API_agent-runtime_OptimizePrompt_RequestSyntax) **   <a name="bedrock-agent-runtime_OptimizePrompt-request-input"></a>
Contains the prompt to optimize.  
Type: [InputPrompt](API_agent-runtime_InputPrompt.md) object  
 **Note: **This object is a Union. Only one member of this object can be specified or returned.  
Required: Yes

 ** [targetModelId](#API_agent-runtime_OptimizePrompt_RequestSyntax) **   <a name="bedrock-agent-runtime_OptimizePrompt-request-targetModelId"></a>
The unique identifier of the model that you want to optimize the prompt for.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `(arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}:(([0-9]{12}:custom-model/[a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}/[a-z0-9]{12})|(:foundation-model/[a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}([.:]?[a-z0-9-]{1,63}))|([0-9]{12}:provisioned-model/[a-z0-9]{12})))|([a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}([.:]?[a-z0-9-]{1,63}))|(([0-9a-zA-Z][_-]?)+)`   
Required: Yes

## Response Syntax


```
HTTP/1.1 200
Content-type: application/json

{
   "accessDeniedException": { 
   },
   "analyzePromptEvent": { 
      "message": "string"
   },
   "badGatewayException": { 
   },
   "dependencyFailedException": { 
   },
   "internalServerException": { 
   },
   "optimizedPromptEvent": { 
      "optimizedPrompt": { ... }
   },
   "throttlingException": { 
   },
   "validationException": { 
   }
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [accessDeniedException](#API_agent-runtime_OptimizePrompt_ResponseSyntax) **   <a name="bedrock-agent-runtime_OptimizePrompt-response-accessDeniedException"></a>
The request is denied because of missing access permissions. Check your permissions and retry your request.  
Type: Exception  
HTTP Status Code: 403

 ** [analyzePromptEvent](#API_agent-runtime_OptimizePrompt_ResponseSyntax) **   <a name="bedrock-agent-runtime_OptimizePrompt-response-analyzePromptEvent"></a>
An event in which the prompt was analyzed in preparation for optimization.  
Type: [AnalyzePromptEvent](API_agent-runtime_AnalyzePromptEvent.md) object

 ** [badGatewayException](#API_agent-runtime_OptimizePrompt_ResponseSyntax) **   <a name="bedrock-agent-runtime_OptimizePrompt-response-badGatewayException"></a>
There was an issue with a dependency due to a server issue. Retry your request.  
Type: Exception  
HTTP Status Code: 502

 ** [dependencyFailedException](#API_agent-runtime_OptimizePrompt_ResponseSyntax) **   <a name="bedrock-agent-runtime_OptimizePrompt-response-dependencyFailedException"></a>
There was an issue with a dependency. Check the resource configurations and retry the request.  
Type: Exception  
HTTP Status Code: 424

 ** [internalServerException](#API_agent-runtime_OptimizePrompt_ResponseSyntax) **   <a name="bedrock-agent-runtime_OptimizePrompt-response-internalServerException"></a>
An internal server error occurred. Retry your request.  
Type: Exception  
HTTP Status Code: 500

 ** [optimizedPromptEvent](#API_agent-runtime_OptimizePrompt_ResponseSyntax) **   <a name="bedrock-agent-runtime_OptimizePrompt-response-optimizedPromptEvent"></a>
An event in which the prompt was optimized.  
Type: [OptimizedPromptEvent](API_agent-runtime_OptimizedPromptEvent.md) object

 ** [throttlingException](#API_agent-runtime_OptimizePrompt_ResponseSyntax) **   <a name="bedrock-agent-runtime_OptimizePrompt-response-throttlingException"></a>
Your request was throttled because of service-wide limitations. Resubmit your request later or in a different region. You can also purchase [Provisioned Throughput](https://docs.aws.amazon.com/bedrock/latest/userguide/prov-throughput.html) to increase the rate or number of tokens you can process.  
Type: Exception  
HTTP Status Code: 429

 ** [validationException](#API_agent-runtime_OptimizePrompt_ResponseSyntax) **   <a name="bedrock-agent-runtime_OptimizePrompt-response-validationException"></a>
Input validation failed. Check your request parameters and retry the request.  
Type: Exception  
HTTP Status Code: 400

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** BadGatewayException **   
There was an issue with a dependency due to a server issue. Retry your request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 502

 ** DependencyFailedException **   
There was an issue with a dependency. Check the resource configurations and retry the request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 424

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## Examples


### Example


This example illustrates one usage of OptimizePrompt.

```
POST /optimize-prompt HTTP/1.1
Content-type: application/json

{
    "input": {
        "textPrompt": {
            "text": "Please summarize this text: "
        }
    },
    "targetModelId": "anthropic.claude-3-sonnet-20240229-v1:0"
}
```

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/OptimizePrompt) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/OptimizePrompt) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/OptimizePrompt) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/OptimizePrompt) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/OptimizePrompt) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/OptimizePrompt) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/OptimizePrompt) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/OptimizePrompt) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/OptimizePrompt) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/OptimizePrompt) 

# PutInvocationStep


Add an invocation step to an invocation in a session. An invocation step stores fine-grained state checkpoints, including text and images, for each interaction. For more information about sessions, see [Store and retrieve conversation history and context with Amazon Bedrock sessions](https://docs.aws.amazon.com/bedrock/latest/userguide/sessions.html).

Related APIs:
+  [GetInvocationStep](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_GetInvocationStep.html) 
+  [ListInvocationSteps](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_ListInvocationSteps.html) 
+  [ListInvocations](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_ListInvocations.html) 
+  [ListSessions](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_ListInvocations.html) 

## Request Syntax


```
PUT /sessions/sessionIdentifier/invocationSteps/ HTTP/1.1
Content-type: application/json

{
   "invocationIdentifier": "string",
   "invocationStepId": "string",
   "invocationStepTime": "string",
   "payload": { ... }
}
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [sessionIdentifier](#API_agent-runtime_PutInvocationStep_RequestSyntax) **   <a name="bedrock-agent-runtime_PutInvocationStep-request-uri-sessionIdentifier"></a>
The unique identifier for the session to add the invocation step to. You can specify either the session's `sessionId` or its Amazon Resource Name (ARN).  
Pattern: `(arn:aws(-[^:]+)?:bedrock:[a-z0-9-]+:[0-9]{12}:session/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})|([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})`   
Required: Yes

## Request Body


The request accepts the following data in JSON format.

 ** [invocationIdentifier](#API_agent-runtime_PutInvocationStep_RequestSyntax) **   <a name="bedrock-agent-runtime_PutInvocationStep-request-invocationIdentifier"></a>
The unique identifier (in UUID format) of the invocation to add the invocation step to.  
Type: String  
Pattern: `[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}`   
Required: Yes

 ** [invocationStepId](#API_agent-runtime_PutInvocationStep_RequestSyntax) **   <a name="bedrock-agent-runtime_PutInvocationStep-request-invocationStepId"></a>
The unique identifier of the invocation step in UUID format.  
Type: String  
Pattern: `[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}`   
Required: No

 ** [invocationStepTime](#API_agent-runtime_PutInvocationStep_RequestSyntax) **   <a name="bedrock-agent-runtime_PutInvocationStep-request-invocationStepTime"></a>
The timestamp for when the invocation step occurred.  
Type: Timestamp  
Required: Yes

 ** [payload](#API_agent-runtime_PutInvocationStep_RequestSyntax) **   <a name="bedrock-agent-runtime_PutInvocationStep-request-payload"></a>
The payload for the invocation step, including text and images for the interaction.  
Type: [InvocationStepPayload](API_agent-runtime_InvocationStepPayload.md) object  
 **Note: **This object is a Union. Only one member of this object can be specified or returned.  
Required: Yes

## Response Syntax


```
HTTP/1.1 201
Content-type: application/json

{
   "invocationStepId": "string"
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 201 response.

The following data is returned in JSON format by the service.

 ** [invocationStepId](#API_agent-runtime_PutInvocationStep_ResponseSyntax) **   <a name="bedrock-agent-runtime_PutInvocationStep-response-invocationStepId"></a>
The unique identifier of the invocation step in UUID format.  
Type: String  
Pattern: `[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}` 

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** ConflictException **   
There was a conflict performing an operation. Resolve the conflict and retry your request.  
HTTP Status Code: 409

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ServiceQuotaExceededException **   
The number of requests exceeds the service quota. Resubmit your request later.  
HTTP Status Code: 400

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## Examples


### Example request


This example illustrates one usage of PutInvocationStep.

```
PUT bedrock-agent-runtime.us-east-1.amazonaws.com/sessions/12345abc-1234-abcd-1234-abcdef123456/invocationSteps/ HTTP/1.1
Content-type: application/json

{
    "invocationIdentifier": "11111111-2222-3333-4444-555555555555",
    "invocationStepId": "abc-1234-abcd-1234-abcdef123456", 
    "invocationStepTime": "2023-08-08T12:00:00Z",
    "payload": {
        "contentBlocks": [
            {
                "text": "What's the weather in Seattle?"
            },
            {
                "image": {
                    "format": "png",
                    "source": {
                        "bytes": "base64_encoded_image_data"
                    }
                }
            }
        ]
    }
}
```

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/PutInvocationStep) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/PutInvocationStep) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/PutInvocationStep) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/PutInvocationStep) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/PutInvocationStep) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/PutInvocationStep) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/PutInvocationStep) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/PutInvocationStep) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/PutInvocationStep) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/PutInvocationStep) 

# Rerank


Reranks the relevance of sources based on queries. For more information, see [Improve the relevance of query responses with a reranker model](https://docs.aws.amazon.com/bedrock/latest/userguide/rerank.html).

## Request Syntax


```
POST /rerank HTTP/1.1
Content-type: application/json

{
   "nextToken": "string",
   "queries": [ 
      { 
         "textQuery": { 
            "text": "string"
         },
         "type": "string"
      }
   ],
   "rerankingConfiguration": { 
      "bedrockRerankingConfiguration": { 
         "modelConfiguration": { 
            "additionalModelRequestFields": { 
               "string" : JSON value 
            },
            "modelArn": "string"
         },
         "numberOfResults": number
      },
      "type": "string"
   },
   "sources": [ 
      { 
         "inlineDocumentSource": { 
            "jsonDocument": JSON value,
            "textDocument": { 
               "text": "string"
            },
            "type": "string"
         },
         "type": "string"
      }
   ]
}
```

## URI Request Parameters


The request does not use any URI parameters.

## Request Body


The request accepts the following data in JSON format.

 ** [nextToken](#API_agent-runtime_Rerank_RequestSyntax) **   <a name="bedrock-agent-runtime_Rerank-request-nextToken"></a>
If the total number of results was greater than could fit in a response, a token is returned in the `nextToken` field. You can enter that token in this field to return the next batch of results.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `\S*`   
Required: No

 ** [queries](#API_agent-runtime_Rerank_RequestSyntax) **   <a name="bedrock-agent-runtime_Rerank-request-queries"></a>
An array of objects, each of which contains information about a query to submit to the reranker model.  
Type: Array of [RerankQuery](API_agent-runtime_RerankQuery.md) objects  
Array Members: Fixed number of 1 item.  
Required: Yes

 ** [rerankingConfiguration](#API_agent-runtime_Rerank_RequestSyntax) **   <a name="bedrock-agent-runtime_Rerank-request-rerankingConfiguration"></a>
Contains configurations for reranking.  
Type: [RerankingConfiguration](API_agent-runtime_RerankingConfiguration.md) object  
Required: Yes

 ** [sources](#API_agent-runtime_Rerank_RequestSyntax) **   <a name="bedrock-agent-runtime_Rerank-request-sources"></a>
An array of objects, each of which contains information about the sources to rerank.  
Type: Array of [RerankSource](API_agent-runtime_RerankSource.md) objects  
Array Members: Minimum number of 1 item. Maximum number of 1000 items.  
Required: Yes

## Response Syntax


```
HTTP/1.1 200
Content-type: application/json

{
   "nextToken": "string",
   "results": [ 
      { 
         "document": { 
            "jsonDocument": JSON value,
            "textDocument": { 
               "text": "string"
            },
            "type": "string"
         },
         "index": number,
         "relevanceScore": number
      }
   ]
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [nextToken](#API_agent-runtime_Rerank_ResponseSyntax) **   <a name="bedrock-agent-runtime_Rerank-response-nextToken"></a>
If the total number of results is greater than can fit in the response, use this token in the `nextToken` field when making another request to return the next batch of results.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `\S*` 

 ** [results](#API_agent-runtime_Rerank_ResponseSyntax) **   <a name="bedrock-agent-runtime_Rerank-response-results"></a>
An array of objects, each of which contains information about the results of reranking.  
Type: Array of [RerankResult](API_agent-runtime_RerankResult.md) objects

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** BadGatewayException **   
There was an issue with a dependency due to a server issue. Retry your request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 502

 ** ConflictException **   
There was a conflict performing an operation. Resolve the conflict and retry your request.  
HTTP Status Code: 409

 ** DependencyFailedException **   
There was an issue with a dependency. Check the resource configurations and retry the request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 424

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ServiceQuotaExceededException **   
The number of requests exceeds the service quota. Resubmit your request later.  
HTTP Status Code: 400

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/Rerank) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/Rerank) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/Rerank) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/Rerank) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/Rerank) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/Rerank) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/Rerank) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/Rerank) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/Rerank) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/Rerank) 

# Retrieve


Queries a knowledge base and retrieves information from it.

## Request Syntax


```
POST /knowledgebases/knowledgeBaseId/retrieve HTTP/1.1
Content-type: application/json

{
   "guardrailConfiguration": { 
      "guardrailId": "string",
      "guardrailVersion": "string"
   },
   "nextToken": "string",
   "retrievalConfiguration": { 
      "vectorSearchConfiguration": { 
         "filter": { ... },
         "implicitFilterConfiguration": { 
            "metadataAttributes": [ 
               { 
                  "description": "string",
                  "key": "string",
                  "type": "string"
               }
            ],
            "modelArn": "string"
         },
         "numberOfResults": number,
         "overrideSearchType": "string",
         "rerankingConfiguration": { 
            "bedrockRerankingConfiguration": { 
               "metadataConfiguration": { 
                  "selectionMode": "string",
                  "selectiveModeConfiguration": { ... }
               },
               "modelConfiguration": { 
                  "additionalModelRequestFields": { 
                     "string" : JSON value 
                  },
                  "modelArn": "string"
               },
               "numberOfRerankedResults": number
            },
            "type": "string"
         }
      }
   },
   "retrievalQuery": { 
      "image": { 
         "format": "string",
         "inlineContent": blob
      },
      "text": "string",
      "type": "string"
   }
}
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [knowledgeBaseId](#API_agent-runtime_Retrieve_RequestSyntax) **   <a name="bedrock-agent-runtime_Retrieve-request-uri-knowledgeBaseId"></a>
The unique identifier of the knowledge base to query.  
Length Constraints: Minimum length of 0. Maximum length of 10.  
Pattern: `[0-9a-zA-Z]+`   
Required: Yes

## Request Body


The request accepts the following data in JSON format.

 ** [guardrailConfiguration](#API_agent-runtime_Retrieve_RequestSyntax) **   <a name="bedrock-agent-runtime_Retrieve-request-guardrailConfiguration"></a>
Guardrail settings.  
Type: [GuardrailConfiguration](API_agent-runtime_GuardrailConfiguration.md) object  
Required: No

 ** [nextToken](#API_agent-runtime_Retrieve_RequestSyntax) **   <a name="bedrock-agent-runtime_Retrieve-request-nextToken"></a>
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.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `\S*`   
Required: No

 ** [retrievalConfiguration](#API_agent-runtime_Retrieve_RequestSyntax) **   <a name="bedrock-agent-runtime_Retrieve-request-retrievalConfiguration"></a>
Contains configurations for the knowledge base query and retrieval process. For more information, see [Query configurations](https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html).  
Type: [KnowledgeBaseRetrievalConfiguration](API_agent-runtime_KnowledgeBaseRetrievalConfiguration.md) object  
Required: No

 ** [retrievalQuery](#API_agent-runtime_Retrieve_RequestSyntax) **   <a name="bedrock-agent-runtime_Retrieve-request-retrievalQuery"></a>
Contains the query to send the knowledge base.  
Type: [KnowledgeBaseQuery](API_agent-runtime_KnowledgeBaseQuery.md) object  
Required: Yes

## Response Syntax


```
HTTP/1.1 200
Content-type: application/json

{
   "guardrailAction": "string",
   "nextToken": "string",
   "retrievalResults": [ 
      { 
         "content": { 
            "audio": { 
               "s3Uri": "string",
               "transcription": "string"
            },
            "byteContent": "string",
            "row": [ 
               { 
                  "columnName": "string",
                  "columnValue": "string",
                  "type": "string"
               }
            ],
            "text": "string",
            "type": "string",
            "video": { 
               "s3Uri": "string",
               "summary": "string"
            }
         },
         "location": { 
            "confluenceLocation": { 
               "url": "string"
            },
            "customDocumentLocation": { 
               "id": "string"
            },
            "kendraDocumentLocation": { 
               "uri": "string"
            },
            "s3Location": { 
               "uri": "string"
            },
            "salesforceLocation": { 
               "url": "string"
            },
            "sharePointLocation": { 
               "url": "string"
            },
            "sqlLocation": { 
               "query": "string"
            },
            "type": "string",
            "webLocation": { 
               "url": "string"
            }
         },
         "metadata": { 
            "string" : JSON value 
         },
         "score": number
      }
   ]
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [guardrailAction](#API_agent-runtime_Retrieve_ResponseSyntax) **   <a name="bedrock-agent-runtime_Retrieve-response-guardrailAction"></a>
Specifies if there is a guardrail intervention in the response.  
Type: String  
Valid Values: `INTERVENED | NONE` 

 ** [nextToken](#API_agent-runtime_Retrieve_ResponseSyntax) **   <a name="bedrock-agent-runtime_Retrieve-response-nextToken"></a>
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.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 2048.  
Pattern: `\S*` 

 ** [retrievalResults](#API_agent-runtime_Retrieve_ResponseSyntax) **   <a name="bedrock-agent-runtime_Retrieve-response-retrievalResults"></a>
A list of results from querying the knowledge base.  
Type: Array of [KnowledgeBaseRetrievalResult](API_agent-runtime_KnowledgeBaseRetrievalResult.md) objects

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** BadGatewayException **   
There was an issue with a dependency due to a server issue. Retry your request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 502

 ** ConflictException **   
There was a conflict performing an operation. Resolve the conflict and retry your request.  
HTTP Status Code: 409

 ** DependencyFailedException **   
There was an issue with a dependency. Check the resource configurations and retry the request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 424

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ServiceQuotaExceededException **   
The number of requests exceeds the service quota. Resubmit your request later.  
HTTP Status Code: 400

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## Examples


### Send a basic query


The following example queries a knowledge base.

#### Sample Request


```
POST /knowledgebases/KB12345678/retrieve HTTP/1.1
Content-type: application/json

{
    "retrievalQuery": {
        "text": "What is AWS?"
    }
}
```

### Send a query and include filters


To include filters in a knowledge base query, at least one of the data source files must include a `.metadata.json` file. For example, if you had a data source of articles called `articles.pdf`, accompanied by a metadata file called `articles.pdf.metadata.json`, you could tag it for `genre`, `year`, and `author`. In the `Retrieve` request, you could apply the following filter to return all entertainment articles written after `2018`, in addition to `cooking` or `sports` articles written by authors starting with `C`.

#### Sample Request


```
POST /knowledgebases/KB12345678/retrieve HTTP/1.1
Content-type: application/json

{
    "retrievalQuery": {
        "text": "What is AWS?",
    },
    "vectorSearchConfiguration": {
        "numberOfResults": 5,
        "filter": {
            "orAll": [
                {
                    "andAll": [
                        {
                            "equals": {
                                "key": "genre",
                                "value": "entertainment"
                            }
                        },
                        {
                            "greaterThan": {
                                "key": "year",
                                "value": 2018
                            }
                        }
                    ]
                },
                {
                    "andAll": [
                        {
                            "in": {
                                "key": "genre",
                                "value": ["cooking", "sports"]
                            }
                        },
                        {
                            "startsWith": {
                                "key": "author",
                                "value": "C"
                            }
                        }
                    ]
                }
            ]
        }
    }
}
```

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/Retrieve) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/Retrieve) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/Retrieve) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/Retrieve) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/Retrieve) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/Retrieve) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/Retrieve) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/Retrieve) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/Retrieve) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/Retrieve) 

# RetrieveAndGenerate


Queries a knowledge base and generates responses based on the retrieved results and using the specified foundation model or [inference profile](https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference.html). The response only cites sources that are relevant to the query.

## Request Syntax


```
POST /retrieveAndGenerate HTTP/1.1
Content-type: application/json

{
   "input": { 
      "text": "string"
   },
   "retrieveAndGenerateConfiguration": { 
      "externalSourcesConfiguration": { 
         "generationConfiguration": { 
            "additionalModelRequestFields": { 
               "string" : JSON value 
            },
            "guardrailConfiguration": { 
               "guardrailId": "string",
               "guardrailVersion": "string"
            },
            "inferenceConfig": { 
               "textInferenceConfig": { 
                  "maxTokens": number,
                  "stopSequences": [ "string" ],
                  "temperature": number,
                  "topP": number
               }
            },
            "performanceConfig": { 
               "latency": "string"
            },
            "promptTemplate": { 
               "textPromptTemplate": "string"
            }
         },
         "modelArn": "string",
         "sources": [ 
            { 
               "byteContent": { 
                  "contentType": "string",
                  "data": blob,
                  "identifier": "string"
               },
               "s3Location": { 
                  "uri": "string"
               },
               "sourceType": "string"
            }
         ]
      },
      "knowledgeBaseConfiguration": { 
         "generationConfiguration": { 
            "additionalModelRequestFields": { 
               "string" : JSON value 
            },
            "guardrailConfiguration": { 
               "guardrailId": "string",
               "guardrailVersion": "string"
            },
            "inferenceConfig": { 
               "textInferenceConfig": { 
                  "maxTokens": number,
                  "stopSequences": [ "string" ],
                  "temperature": number,
                  "topP": number
               }
            },
            "performanceConfig": { 
               "latency": "string"
            },
            "promptTemplate": { 
               "textPromptTemplate": "string"
            }
         },
         "knowledgeBaseId": "string",
         "modelArn": "string",
         "orchestrationConfiguration": { 
            "additionalModelRequestFields": { 
               "string" : JSON value 
            },
            "inferenceConfig": { 
               "textInferenceConfig": { 
                  "maxTokens": number,
                  "stopSequences": [ "string" ],
                  "temperature": number,
                  "topP": number
               }
            },
            "performanceConfig": { 
               "latency": "string"
            },
            "promptTemplate": { 
               "textPromptTemplate": "string"
            },
            "queryTransformationConfiguration": { 
               "type": "string"
            }
         },
         "retrievalConfiguration": { 
            "vectorSearchConfiguration": { 
               "filter": { ... },
               "implicitFilterConfiguration": { 
                  "metadataAttributes": [ 
                     { 
                        "description": "string",
                        "key": "string",
                        "type": "string"
                     }
                  ],
                  "modelArn": "string"
               },
               "numberOfResults": number,
               "overrideSearchType": "string",
               "rerankingConfiguration": { 
                  "bedrockRerankingConfiguration": { 
                     "metadataConfiguration": { 
                        "selectionMode": "string",
                        "selectiveModeConfiguration": { ... }
                     },
                     "modelConfiguration": { 
                        "additionalModelRequestFields": { 
                           "string" : JSON value 
                        },
                        "modelArn": "string"
                     },
                     "numberOfRerankedResults": number
                  },
                  "type": "string"
               }
            }
         }
      },
      "type": "string"
   },
   "sessionConfiguration": { 
      "kmsKeyArn": "string"
   },
   "sessionId": "string"
}
```

## URI Request Parameters


The request does not use any URI parameters.

## Request Body


The request accepts the following data in JSON format.

 ** [input](#API_agent-runtime_RetrieveAndGenerate_RequestSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerate-request-input"></a>
Contains the query to be made to the knowledge base.  
Type: [RetrieveAndGenerateInput](API_agent-runtime_RetrieveAndGenerateInput.md) object  
Required: Yes

 ** [retrieveAndGenerateConfiguration](#API_agent-runtime_RetrieveAndGenerate_RequestSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerate-request-retrieveAndGenerateConfiguration"></a>
Contains configurations for the knowledge base query and retrieval process. For more information, see [Query configurations](https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html).  
Type: [RetrieveAndGenerateConfiguration](API_agent-runtime_RetrieveAndGenerateConfiguration.md) object  
Required: No

 ** [sessionConfiguration](#API_agent-runtime_RetrieveAndGenerate_RequestSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerate-request-sessionConfiguration"></a>
Contains details about the session with the knowledge base.  
Type: [RetrieveAndGenerateSessionConfiguration](API_agent-runtime_RetrieveAndGenerateSessionConfiguration.md) object  
Required: No

 ** [sessionId](#API_agent-runtime_RetrieveAndGenerate_RequestSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerate-request-sessionId"></a>
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.  
Type: String  
Length Constraints: Minimum length of 2. Maximum length of 100.  
Pattern: `[0-9a-zA-Z._:-]+`   
Required: No

## Response Syntax


```
HTTP/1.1 200
Content-type: application/json

{
   "citations": [ 
      { 
         "generatedResponsePart": { 
            "textResponsePart": { 
               "span": { 
                  "end": number,
                  "start": number
               },
               "text": "string"
            }
         },
         "retrievedReferences": [ 
            { 
               "content": { 
                  "audio": { 
                     "s3Uri": "string",
                     "transcription": "string"
                  },
                  "byteContent": "string",
                  "row": [ 
                     { 
                        "columnName": "string",
                        "columnValue": "string",
                        "type": "string"
                     }
                  ],
                  "text": "string",
                  "type": "string",
                  "video": { 
                     "s3Uri": "string",
                     "summary": "string"
                  }
               },
               "location": { 
                  "confluenceLocation": { 
                     "url": "string"
                  },
                  "customDocumentLocation": { 
                     "id": "string"
                  },
                  "kendraDocumentLocation": { 
                     "uri": "string"
                  },
                  "s3Location": { 
                     "uri": "string"
                  },
                  "salesforceLocation": { 
                     "url": "string"
                  },
                  "sharePointLocation": { 
                     "url": "string"
                  },
                  "sqlLocation": { 
                     "query": "string"
                  },
                  "type": "string",
                  "webLocation": { 
                     "url": "string"
                  }
               },
               "metadata": { 
                  "string" : JSON value 
               }
            }
         ]
      }
   ],
   "guardrailAction": "string",
   "output": { 
      "text": "string"
   },
   "sessionId": "string"
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [citations](#API_agent-runtime_RetrieveAndGenerate_ResponseSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerate-response-citations"></a>
A list of segments of the generated response that are based on sources in the knowledge base, alongside information about the sources.  
Type: Array of [Citation](API_agent-runtime_Citation.md) objects

 ** [guardrailAction](#API_agent-runtime_RetrieveAndGenerate_ResponseSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerate-response-guardrailAction"></a>
Specifies if there is a guardrail intervention in the response.  
Type: String  
Valid Values: `INTERVENED | NONE` 

 ** [output](#API_agent-runtime_RetrieveAndGenerate_ResponseSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerate-response-output"></a>
Contains the response generated from querying the knowledge base.  
Type: [RetrieveAndGenerateOutput](API_agent-runtime_RetrieveAndGenerateOutput.md) object

 ** [sessionId](#API_agent-runtime_RetrieveAndGenerate_ResponseSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerate-response-sessionId"></a>
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.  
Type: String  
Length Constraints: Minimum length of 2. Maximum length of 100.  
Pattern: `[0-9a-zA-Z._:-]+` 

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** BadGatewayException **   
There was an issue with a dependency due to a server issue. Retry your request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 502

 ** ConflictException **   
There was a conflict performing an operation. Resolve the conflict and retry your request.  
HTTP Status Code: 409

 ** DependencyFailedException **   
There was an issue with a dependency. Check the resource configurations and retry the request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 424

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ServiceQuotaExceededException **   
The number of requests exceeds the service quota. Resubmit your request later.  
HTTP Status Code: 400

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## Examples


### Send a basic query


The following example uses the minimally required fields to generate a response after querying a knowledge base.

#### Sample Request


```
POST /retrieveAndGenerate HTTP/1.1
Content-type: application/json

{
    "input": {
        "text": "What is AWS?"
    },
    "retrieveAndGenerateConfiguration": {
        "knowledgeBaseConfiguration": {
            "knowledgeBaseId": "KB12345678",
            "modelArn": "anthropic.claude-v2:1"
        },
        "type": "KNOWLEDGE_BASE"
    }
}
```

### Send a query and include filters


To include filters in a knowledge base query, at least one of the data source files must include a `.metadata.json` file. For example, if you had a data source of articles called `articles.pdf`, accompanied by a metadata file called `articles.pdf.metadata.json`, you could tag it for `genre`, `year`, and `author`. In the `Retrieve` request, you could apply the following filter to return all entertainment articles written after `2018`, in addition to `cooking` or `sports` articles written by authors starting with `C`.

#### Sample Request


```
POST /retrieveAndGenerate HTTP/1.1
Content-type: application/json

{
    "input": {
        "text": "What is AWS?",
    },
    "retrieveAndGenerateConfiguration": {
        "knowledgeBaseConfiguration": {
            "knowledgeBaseId": "KB12345678",
            "modelArn": "anthropic.claude-v2:1",
            "retrievalConfiguration": {
                "vectorSearchConfiguration": {
                    "numberOfResults": 5,
                    "filter": {
                        "orAll": [
                            {
                                "andAll": [
                                    {
                                        "equals": {
                                            "key": "genre",
                                            "value": "entertainment"
                                        }
                                    },
                                    {
                                        "greaterThan": {
                                            "key": "year",
                                            "value": 2018
                                        }
                                    }
                                ]
                            },
                            {
                                "andAll": [
                                    {
                                        "in": {
                                            "key": "genre",
                                            "value": ["cooking", "sports"]
                                        }
                                    },
                                    {
                                        "startsWith": {
                                            "key": "author",
                                            "value": "C"
                                        }
                                    }
                                ]
                            }
                        ]
                    }
                }
            }
        },
        "type": "KNOWLEDGE_BASE"
    }
}
```

### Use an inference profile when generating a response


The following example uses an inference profile in generating a response after querying a knowledge base.

#### Sample Request


```
POST /retrieveAndGenerate HTTP/1.1
Content-type: application/json

{
    "input": {
        "text": "What is AWS?"
    },
    "retrieveAndGenerateConfiguration": {
        "knowledgeBaseConfiguration": {
            "knowledgeBaseId": "KB12345678",
            "modelArn": "arn:aws:bedrock:us-west-2:123456789012:inference-profile/us.anthropic.claude-3-5-sonnet-20240620-v1:0"
        },
        "type": "KNOWLEDGE_BASE"
    }
}
```

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/RetrieveAndGenerate) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/RetrieveAndGenerate) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/RetrieveAndGenerate) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/RetrieveAndGenerate) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/RetrieveAndGenerate) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/RetrieveAndGenerate) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/RetrieveAndGenerate) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/RetrieveAndGenerate) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/RetrieveAndGenerate) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/RetrieveAndGenerate) 

# RetrieveAndGenerateStream


Queries a knowledge base and generates responses based on the retrieved results, with output in streaming format.

**Note**  
The AWS CLI doesn't support streaming operations in Amazon Bedrock, including `InvokeModelWithResponseStream`.

This operation requires permission for the ` bedrock:RetrieveAndGenerate` action.

## Request Syntax


```
POST /retrieveAndGenerateStream HTTP/1.1
Content-type: application/json

{
   "input": { 
      "text": "string"
   },
   "retrieveAndGenerateConfiguration": { 
      "externalSourcesConfiguration": { 
         "generationConfiguration": { 
            "additionalModelRequestFields": { 
               "string" : JSON value 
            },
            "guardrailConfiguration": { 
               "guardrailId": "string",
               "guardrailVersion": "string"
            },
            "inferenceConfig": { 
               "textInferenceConfig": { 
                  "maxTokens": number,
                  "stopSequences": [ "string" ],
                  "temperature": number,
                  "topP": number
               }
            },
            "performanceConfig": { 
               "latency": "string"
            },
            "promptTemplate": { 
               "textPromptTemplate": "string"
            }
         },
         "modelArn": "string",
         "sources": [ 
            { 
               "byteContent": { 
                  "contentType": "string",
                  "data": blob,
                  "identifier": "string"
               },
               "s3Location": { 
                  "uri": "string"
               },
               "sourceType": "string"
            }
         ]
      },
      "knowledgeBaseConfiguration": { 
         "generationConfiguration": { 
            "additionalModelRequestFields": { 
               "string" : JSON value 
            },
            "guardrailConfiguration": { 
               "guardrailId": "string",
               "guardrailVersion": "string"
            },
            "inferenceConfig": { 
               "textInferenceConfig": { 
                  "maxTokens": number,
                  "stopSequences": [ "string" ],
                  "temperature": number,
                  "topP": number
               }
            },
            "performanceConfig": { 
               "latency": "string"
            },
            "promptTemplate": { 
               "textPromptTemplate": "string"
            }
         },
         "knowledgeBaseId": "string",
         "modelArn": "string",
         "orchestrationConfiguration": { 
            "additionalModelRequestFields": { 
               "string" : JSON value 
            },
            "inferenceConfig": { 
               "textInferenceConfig": { 
                  "maxTokens": number,
                  "stopSequences": [ "string" ],
                  "temperature": number,
                  "topP": number
               }
            },
            "performanceConfig": { 
               "latency": "string"
            },
            "promptTemplate": { 
               "textPromptTemplate": "string"
            },
            "queryTransformationConfiguration": { 
               "type": "string"
            }
         },
         "retrievalConfiguration": { 
            "vectorSearchConfiguration": { 
               "filter": { ... },
               "implicitFilterConfiguration": { 
                  "metadataAttributes": [ 
                     { 
                        "description": "string",
                        "key": "string",
                        "type": "string"
                     }
                  ],
                  "modelArn": "string"
               },
               "numberOfResults": number,
               "overrideSearchType": "string",
               "rerankingConfiguration": { 
                  "bedrockRerankingConfiguration": { 
                     "metadataConfiguration": { 
                        "selectionMode": "string",
                        "selectiveModeConfiguration": { ... }
                     },
                     "modelConfiguration": { 
                        "additionalModelRequestFields": { 
                           "string" : JSON value 
                        },
                        "modelArn": "string"
                     },
                     "numberOfRerankedResults": number
                  },
                  "type": "string"
               }
            }
         }
      },
      "type": "string"
   },
   "sessionConfiguration": { 
      "kmsKeyArn": "string"
   },
   "sessionId": "string"
}
```

## URI Request Parameters


The request does not use any URI parameters.

## Request Body


The request accepts the following data in JSON format.

 ** [input](#API_agent-runtime_RetrieveAndGenerateStream_RequestSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerateStream-request-input"></a>
Contains the query to be made to the knowledge base.  
Type: [RetrieveAndGenerateInput](API_agent-runtime_RetrieveAndGenerateInput.md) object  
Required: Yes

 ** [retrieveAndGenerateConfiguration](#API_agent-runtime_RetrieveAndGenerateStream_RequestSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerateStream-request-retrieveAndGenerateConfiguration"></a>
Contains configurations for the knowledge base query and retrieval process. For more information, see [Query configurations](https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html).  
Type: [RetrieveAndGenerateConfiguration](API_agent-runtime_RetrieveAndGenerateConfiguration.md) object  
Required: No

 ** [sessionConfiguration](#API_agent-runtime_RetrieveAndGenerateStream_RequestSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerateStream-request-sessionConfiguration"></a>
Contains details about the session with the knowledge base.  
Type: [RetrieveAndGenerateSessionConfiguration](API_agent-runtime_RetrieveAndGenerateSessionConfiguration.md) object  
Required: No

 ** [sessionId](#API_agent-runtime_RetrieveAndGenerateStream_RequestSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerateStream-request-sessionId"></a>
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.  
Type: String  
Length Constraints: Minimum length of 2. Maximum length of 100.  
Pattern: `[0-9a-zA-Z._:-]+`   
Required: No

## Response Syntax


```
HTTP/1.1 200
x-amzn-bedrock-knowledge-base-session-id: sessionId
Content-type: application/json

{
   "accessDeniedException": { 
   },
   "badGatewayException": { 
   },
   "citation": { 
      "citation": { 
         "generatedResponsePart": { 
            "textResponsePart": { 
               "span": { 
                  "end": number,
                  "start": number
               },
               "text": "string"
            }
         },
         "retrievedReferences": [ 
            { 
               "content": { 
                  "audio": { 
                     "s3Uri": "string",
                     "transcription": "string"
                  },
                  "byteContent": "string",
                  "row": [ 
                     { 
                        "columnName": "string",
                        "columnValue": "string",
                        "type": "string"
                     }
                  ],
                  "text": "string",
                  "type": "string",
                  "video": { 
                     "s3Uri": "string",
                     "summary": "string"
                  }
               },
               "location": { 
                  "confluenceLocation": { 
                     "url": "string"
                  },
                  "customDocumentLocation": { 
                     "id": "string"
                  },
                  "kendraDocumentLocation": { 
                     "uri": "string"
                  },
                  "s3Location": { 
                     "uri": "string"
                  },
                  "salesforceLocation": { 
                     "url": "string"
                  },
                  "sharePointLocation": { 
                     "url": "string"
                  },
                  "sqlLocation": { 
                     "query": "string"
                  },
                  "type": "string",
                  "webLocation": { 
                     "url": "string"
                  }
               },
               "metadata": { 
                  "string" : JSON value 
               }
            }
         ]
      },
      "generatedResponsePart": { 
         "textResponsePart": { 
            "span": { 
               "end": number,
               "start": number
            },
            "text": "string"
         }
      },
      "retrievedReferences": [ 
         { 
            "content": { 
               "audio": { 
                  "s3Uri": "string",
                  "transcription": "string"
               },
               "byteContent": "string",
               "row": [ 
                  { 
                     "columnName": "string",
                     "columnValue": "string",
                     "type": "string"
                  }
               ],
               "text": "string",
               "type": "string",
               "video": { 
                  "s3Uri": "string",
                  "summary": "string"
               }
            },
            "location": { 
               "confluenceLocation": { 
                  "url": "string"
               },
               "customDocumentLocation": { 
                  "id": "string"
               },
               "kendraDocumentLocation": { 
                  "uri": "string"
               },
               "s3Location": { 
                  "uri": "string"
               },
               "salesforceLocation": { 
                  "url": "string"
               },
               "sharePointLocation": { 
                  "url": "string"
               },
               "sqlLocation": { 
                  "query": "string"
               },
               "type": "string",
               "webLocation": { 
                  "url": "string"
               }
            },
            "metadata": { 
               "string" : JSON value 
            }
         }
      ]
   },
   "conflictException": { 
   },
   "dependencyFailedException": { 
   },
   "guardrail": { 
      "action": "string"
   },
   "internalServerException": { 
   },
   "output": { 
      "text": "string"
   },
   "resourceNotFoundException": { 
   },
   "serviceQuotaExceededException": { 
   },
   "throttlingException": { 
   },
   "validationException": { 
   }
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The response returns the following HTTP headers.

 ** [sessionId](#API_agent-runtime_RetrieveAndGenerateStream_ResponseSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerateStream-response-sessionId"></a>
The session ID.  
Length Constraints: Minimum length of 2. Maximum length of 100.  
Pattern: `[0-9a-zA-Z._:-]+` 

The following data is returned in JSON format by the service.

 ** [accessDeniedException](#API_agent-runtime_RetrieveAndGenerateStream_ResponseSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerateStream-response-accessDeniedException"></a>
The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see [AccessDeniedException](https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-access-denied) in the Amazon Bedrock User Guide.  
Type: Exception  
HTTP Status Code: 403

 ** [badGatewayException](#API_agent-runtime_RetrieveAndGenerateStream_ResponseSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerateStream-response-badGatewayException"></a>
The request failed due to a bad gateway error.  
Type: Exception  
HTTP Status Code: 502

 ** [citation](#API_agent-runtime_RetrieveAndGenerateStream_ResponseSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerateStream-response-citation"></a>
A citation event.  
Type: [CitationEvent](API_agent-runtime_CitationEvent.md) object

 ** [conflictException](#API_agent-runtime_RetrieveAndGenerateStream_ResponseSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerateStream-response-conflictException"></a>
Error occurred because of a conflict while performing an operation.  
Type: Exception  
HTTP Status Code: 409

 ** [dependencyFailedException](#API_agent-runtime_RetrieveAndGenerateStream_ResponseSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerateStream-response-dependencyFailedException"></a>
The request failed due to a dependency error.  
Type: Exception  
HTTP Status Code: 424

 ** [guardrail](#API_agent-runtime_RetrieveAndGenerateStream_ResponseSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerateStream-response-guardrail"></a>
A guardrail event.  
Type: [GuardrailEvent](API_agent-runtime_GuardrailEvent.md) object

 ** [internalServerException](#API_agent-runtime_RetrieveAndGenerateStream_ResponseSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerateStream-response-internalServerException"></a>
An internal server error occurred. Retry your request.  
Type: Exception  
HTTP Status Code: 500

 ** [output](#API_agent-runtime_RetrieveAndGenerateStream_ResponseSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerateStream-response-output"></a>
An output event.  
Type: [RetrieveAndGenerateOutputEvent](API_agent-runtime_RetrieveAndGenerateOutputEvent.md) object

 ** [resourceNotFoundException](#API_agent-runtime_RetrieveAndGenerateStream_ResponseSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerateStream-response-resourceNotFoundException"></a>
The specified resource ARN was not found. For troubleshooting this error, see [ResourceNotFound](https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-resource-not-found) in the Amazon Bedrock User Guide.  
Type: Exception  
HTTP Status Code: 404

 ** [serviceQuotaExceededException](#API_agent-runtime_RetrieveAndGenerateStream_ResponseSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerateStream-response-serviceQuotaExceededException"></a>
Your request exceeds the service quota for your account. You can view your quotas at [Viewing service quotas](https://docs.aws.amazon.com/servicequotas/latest/userguide/gs-request-quota.html). You can resubmit your request later.  
Type: Exception  
HTTP Status Code: 400

 ** [throttlingException](#API_agent-runtime_RetrieveAndGenerateStream_ResponseSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerateStream-response-throttlingException"></a>
Your request was denied due to exceeding the account quotas for *Amazon Bedrock*. For troubleshooting this error, see [ThrottlingException](https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-throttling-exception) in the Amazon Bedrock User Guide.  
Type: Exception  
HTTP Status Code: 429

 ** [validationException](#API_agent-runtime_RetrieveAndGenerateStream_ResponseSyntax) **   <a name="bedrock-agent-runtime_RetrieveAndGenerateStream-response-validationException"></a>
The input fails to satisfy the constraints specified by *Amazon Bedrock*. For troubleshooting this error, see [ValidationError](https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-validation-error) in the Amazon Bedrock User Guide.  
Type: Exception  
HTTP Status Code: 400

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** BadGatewayException **   
There was an issue with a dependency due to a server issue. Retry your request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 502

 ** ConflictException **   
There was a conflict performing an operation. Resolve the conflict and retry your request.  
HTTP Status Code: 409

 ** DependencyFailedException **   
There was an issue with a dependency. Check the resource configurations and retry the request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 424

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ServiceQuotaExceededException **   
The number of requests exceeds the service quota. Resubmit your request later.  
HTTP Status Code: 400

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/RetrieveAndGenerateStream) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/RetrieveAndGenerateStream) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/RetrieveAndGenerateStream) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/RetrieveAndGenerateStream) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/RetrieveAndGenerateStream) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/RetrieveAndGenerateStream) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/RetrieveAndGenerateStream) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/RetrieveAndGenerateStream) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/RetrieveAndGenerateStream) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/RetrieveAndGenerateStream) 

# StartFlowExecution


Starts an execution of an Amazon Bedrock flow. Unlike flows that run until completion or time out after five minutes, flow executions let you run flows asynchronously for longer durations. Flow executions also yield control so that your application can perform other tasks.

This operation returns an Amazon Resource Name (ARN) that you can use to track and manage your flow execution.

**Note**  
Flow executions is in preview release for Amazon Bedrock and is subject to change.

## Request Syntax


```
POST /flows/flowIdentifier/aliases/flowAliasIdentifier/executions HTTP/1.1
Content-type: application/json

{
   "flowExecutionName": "string",
   "inputs": [ 
      { 
         "content": { ... },
         "nodeInputName": "string",
         "nodeName": "string",
         "nodeOutputName": "string"
      }
   ],
   "modelPerformanceConfiguration": { 
      "performanceConfig": { 
         "latency": "string"
      }
   }
}
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [flowAliasIdentifier](#API_agent-runtime_StartFlowExecution_RequestSyntax) **   <a name="bedrock-agent-runtime_StartFlowExecution-request-uri-flowAliasIdentifier"></a>
The unique identifier of the flow alias to use for the flow execution.  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10}/alias/[0-9a-zA-Z]{10})|(\bTSTALIASID\b|[0-9a-zA-Z]+)`   
Required: Yes

 ** [flowIdentifier](#API_agent-runtime_StartFlowExecution_RequestSyntax) **   <a name="bedrock-agent-runtime_StartFlowExecution-request-uri-flowIdentifier"></a>
The unique identifier of the flow to execute.  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10})|([0-9a-zA-Z]{10})`   
Required: Yes

## Request Body


The request accepts the following data in JSON format.

 ** [flowExecutionName](#API_agent-runtime_StartFlowExecution_RequestSyntax) **   <a name="bedrock-agent-runtime_StartFlowExecution-request-flowExecutionName"></a>
The unique name for the flow execution. If you don't provide one, a system-generated name is used.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 36.  
Pattern: `[a-zA-Z0-9-]{1,36}`   
Required: No

 ** [inputs](#API_agent-runtime_StartFlowExecution_RequestSyntax) **   <a name="bedrock-agent-runtime_StartFlowExecution-request-inputs"></a>
The input data required for the flow execution. This must match the input schema defined in the flow.  
Type: Array of [FlowInput](API_agent-runtime_FlowInput.md) objects  
Array Members: Fixed number of 1 item.  
Required: Yes

 ** [modelPerformanceConfiguration](#API_agent-runtime_StartFlowExecution_RequestSyntax) **   <a name="bedrock-agent-runtime_StartFlowExecution-request-modelPerformanceConfiguration"></a>
The performance settings for the foundation model used in the flow execution.  
Type: [ModelPerformanceConfiguration](API_agent-runtime_ModelPerformanceConfiguration.md) object  
Required: No

## Response Syntax


```
HTTP/1.1 200
Content-type: application/json

{
   "executionArn": "string"
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [executionArn](#API_agent-runtime_StartFlowExecution_ResponseSyntax) **   <a name="bedrock-agent-runtime_StartFlowExecution-response-executionArn"></a>
The Amazon Resource Name (ARN) that uniquely identifies the flow execution.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `[a-zA-Z0-9-]{1,36}$|^(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10}/alias/[0-9a-zA-Z]{10}/execution/[a-zA-Z0-9-]{1,36})` 

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** BadGatewayException **   
There was an issue with a dependency due to a server issue. Retry your request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 502

 ** ConflictException **   
There was a conflict performing an operation. Resolve the conflict and retry your request.  
HTTP Status Code: 409

 ** DependencyFailedException **   
There was an issue with a dependency. Check the resource configurations and retry the request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 424

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ServiceQuotaExceededException **   
The number of requests exceeds the service quota. Resubmit your request later.  
HTTP Status Code: 400

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/StartFlowExecution) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/StartFlowExecution) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/StartFlowExecution) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/StartFlowExecution) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/StartFlowExecution) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/StartFlowExecution) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/StartFlowExecution) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/StartFlowExecution) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/StartFlowExecution) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/StartFlowExecution) 

# StopFlowExecution


Stops an Amazon Bedrock flow's execution. This operation prevents further processing of the flow and changes the execution status to `Aborted`.

## Request Syntax


```
POST /flows/flowIdentifier/aliases/flowAliasIdentifier/executions/executionIdentifier/stop HTTP/1.1
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [executionIdentifier](#API_agent-runtime_StopFlowExecution_RequestSyntax) **   <a name="bedrock-agent-runtime_StopFlowExecution-request-uri-executionIdentifier"></a>
The unique identifier of the flow execution to stop.  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `[a-zA-Z0-9-]{1,36}$|^(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10}/alias/[0-9a-zA-Z]{10}/execution/[a-zA-Z0-9-]{1,36})`   
Required: Yes

 ** [flowAliasIdentifier](#API_agent-runtime_StopFlowExecution_RequestSyntax) **   <a name="bedrock-agent-runtime_StopFlowExecution-request-uri-flowAliasIdentifier"></a>
The unique identifier of the flow alias used for the execution.  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10}/alias/[0-9a-zA-Z]{10})|(\bTSTALIASID\b|[0-9a-zA-Z]+)`   
Required: Yes

 ** [flowIdentifier](#API_agent-runtime_StopFlowExecution_RequestSyntax) **   <a name="bedrock-agent-runtime_StopFlowExecution-request-uri-flowIdentifier"></a>
The unique identifier of the flow.  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10})|([0-9a-zA-Z]{10})`   
Required: Yes

## Request Body


The request does not have a request body.

## Response Syntax


```
HTTP/1.1 200
Content-type: application/json

{
   "executionArn": "string",
   "status": "string"
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [executionArn](#API_agent-runtime_StopFlowExecution_ResponseSyntax) **   <a name="bedrock-agent-runtime_StopFlowExecution-response-executionArn"></a>
The Amazon Resource Name (ARN) that uniquely identifies the flow execution that was stopped.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 2048.  
Pattern: `[a-zA-Z0-9-]{1,36}$|^(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10}/alias/[0-9a-zA-Z]{10}/execution/[a-zA-Z0-9-]{1,36})` 

 ** [status](#API_agent-runtime_StopFlowExecution_ResponseSyntax) **   <a name="bedrock-agent-runtime_StopFlowExecution-response-status"></a>
The updated status of the flow execution after the stop request. This will typically be ABORTED if the execution was successfully stopped.  
Type: String  
Valid Values: `Running | Succeeded | Failed | TimedOut | Aborted` 

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** BadGatewayException **   
There was an issue with a dependency due to a server issue. Retry your request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 502

 ** ConflictException **   
There was a conflict performing an operation. Resolve the conflict and retry your request.  
HTTP Status Code: 409

 ** DependencyFailedException **   
There was an issue with a dependency. Check the resource configurations and retry the request.    
 ** resourceName **   
The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or AWS STS.
HTTP Status Code: 424

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/StopFlowExecution) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/StopFlowExecution) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/StopFlowExecution) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/StopFlowExecution) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/StopFlowExecution) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/StopFlowExecution) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/StopFlowExecution) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/StopFlowExecution) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/StopFlowExecution) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/StopFlowExecution) 

# TagResource


Associate tags with a resource. For more information, see [Tagging resources](https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html) in the Amazon Bedrock User Guide.

## Request Syntax


```
POST /tags/resourceArn HTTP/1.1
Content-type: application/json

{
   "tags": { 
      "string" : "string" 
   }
}
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [resourceArn](#API_agent-runtime_TagResource_RequestSyntax) **   <a name="bedrock-agent-runtime_TagResource-request-uri-resourceArn"></a>
The Amazon Resource Name (ARN) of the resource to tag.  
Length Constraints: Minimum length of 20. Maximum length of 1011.  
Pattern: `.*(^arn:aws(-[^:]+)?:bedrock:[a-zA-Z0-9-]+:[0-9]{12}:(session)/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$).*`   
Required: Yes

## Request Body


The request accepts the following data in JSON format.

 ** [tags](#API_agent-runtime_TagResource_RequestSyntax) **   <a name="bedrock-agent-runtime_TagResource-request-tags"></a>
An object containing key-value pairs that define the tags to attach to the resource.  
Type: String to string map  
Map Entries: Maximum number of 200 items.  
Key Length Constraints: Minimum length of 1. Maximum length of 128.  
Key Pattern: `[a-zA-Z0-9\s._:/=+@-]*`   
Value Length Constraints: Minimum length of 0. Maximum length of 256.  
Value Pattern: `[a-zA-Z0-9\s._:/=+@-]*`   
Required: Yes

## Response Syntax


```
HTTP/1.1 200
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ServiceQuotaExceededException **   
The number of requests exceeds the service quota. Resubmit your request later.  
HTTP Status Code: 400

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## Examples


### Example request


This example illustrates one usage of TagResource.

```
POST /tags/arn:aws:bedrock:us-west-2:123456789012:session/12345abc-1234-abcd-1234-abcdef123456 HTTP/1.1
Content-type: application/json

{
   "tags": { 
      "cost-center" : "Tech" 
   }
}
```

### Example response


This example illustrates one usage of TagResource.

```
HTTP/1.1 200
```

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/TagResource) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/TagResource) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/TagResource) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/TagResource) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/TagResource) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/TagResource) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/TagResource) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/TagResource) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/TagResource) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/TagResource) 

# UntagResource


Remove tags from a resource.

## Request Syntax


```
DELETE /tags/resourceArn?tagKeys=tagKeys HTTP/1.1
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [resourceArn](#API_agent-runtime_UntagResource_RequestSyntax) **   <a name="bedrock-agent-runtime_UntagResource-request-uri-resourceArn"></a>
The Amazon Resource Name (ARN) of the resource from which to remove tags.  
Length Constraints: Minimum length of 20. Maximum length of 1011.  
Pattern: `.*(^arn:aws(-[^:]+)?:bedrock:[a-zA-Z0-9-]+:[0-9]{12}:(session)/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$).*`   
Required: Yes

 ** [tagKeys](#API_agent-runtime_UntagResource_RequestSyntax) **   <a name="bedrock-agent-runtime_UntagResource-request-uri-tagKeys"></a>
A list of keys of the tags to remove from the resource.  
Array Members: Minimum number of 1 item. Maximum number of 200 items.  
Length Constraints: Minimum length of 1. Maximum length of 128.  
Pattern: `[a-zA-Z0-9\s._:/=+@-]*`   
Required: Yes

## Request Body


The request does not have a request body.

## Response Syntax


```
HTTP/1.1 200
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## Examples


### Example request


This example illustrates one usage of UntagResource.

```
DELETE /tags/arn:aws:bedrock:us-west-2:123456789012:session/12345abc-1234-abcd-1234-abcdef123456 HTTP/1.1
```

### Example response


This example illustrates one usage of UntagResource.

```
HTTP/1.1 200
```

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/UntagResource) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/UntagResource) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/UntagResource) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/UntagResource) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/UntagResource) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/UntagResource) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/UntagResource) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/UntagResource) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/UntagResource) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/UntagResource) 

# UpdateSession


Updates the metadata or encryption settings of a session. For more information about sessions, see [Store and retrieve conversation history and context with Amazon Bedrock sessions](https://docs.aws.amazon.com/bedrock/latest/userguide/sessions.html).

## Request Syntax


```
PUT /sessions/sessionIdentifier/ HTTP/1.1
Content-type: application/json

{
   "sessionMetadata": { 
      "string" : "string" 
   }
}
```

## URI Request Parameters


The request uses the following URI parameters.

 ** [sessionIdentifier](#API_agent-runtime_UpdateSession_RequestSyntax) **   <a name="bedrock-agent-runtime_UpdateSession-request-uri-sessionIdentifier"></a>
The unique identifier of the session to modify. You can specify either the session's `sessionId` or its Amazon Resource Name (ARN).  
Pattern: `(arn:aws(-[^:]+)?:bedrock:[a-z0-9-]+:[0-9]{12}:session/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})|([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})`   
Required: Yes

## Request Body


The request accepts the following data in JSON format.

 ** [sessionMetadata](#API_agent-runtime_UpdateSession_RequestSyntax) **   <a name="bedrock-agent-runtime_UpdateSession-request-sessionMetadata"></a>
A map of key-value pairs containing attributes to be persisted across the session. For example the user's ID, their language preference, and the type of device they are using.  
Type: String to string map  
Map Entries: Minimum number of 0 items. Maximum number of 50 items.  
Key Length Constraints: Minimum length of 1. Maximum length of 100.  
Value Length Constraints: Minimum length of 0. Maximum length of 5000.  
Required: No

## Response Syntax


```
HTTP/1.1 200
Content-type: application/json

{
   "createdAt": "string",
   "lastUpdatedAt": "string",
   "sessionArn": "string",
   "sessionId": "string",
   "sessionStatus": "string"
}
```

## Response Elements


If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [createdAt](#API_agent-runtime_UpdateSession_ResponseSyntax) **   <a name="bedrock-agent-runtime_UpdateSession-response-createdAt"></a>
The timestamp for when the session was created.  
Type: Timestamp

 ** [lastUpdatedAt](#API_agent-runtime_UpdateSession_ResponseSyntax) **   <a name="bedrock-agent-runtime_UpdateSession-response-lastUpdatedAt"></a>
The timestamp for when the session was last modified.  
Type: Timestamp

 ** [sessionArn](#API_agent-runtime_UpdateSession_ResponseSyntax) **   <a name="bedrock-agent-runtime_UpdateSession-response-sessionArn"></a>
The Amazon Resource Name (ARN) of the session that was updated.  
Type: String  
Pattern: `arn:aws(-[^:]+)?:bedrock:[a-z0-9-]+:[0-9]{12}:session/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}` 

 ** [sessionId](#API_agent-runtime_UpdateSession_ResponseSyntax) **   <a name="bedrock-agent-runtime_UpdateSession-response-sessionId"></a>
The unique identifier of the session you updated.  
Type: String  
Pattern: `[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}` 

 ** [sessionStatus](#API_agent-runtime_UpdateSession_ResponseSyntax) **   <a name="bedrock-agent-runtime_UpdateSession-response-sessionStatus"></a>
The status of the session you updated.  
Type: String  
Valid Values: `ACTIVE | EXPIRED | ENDED` 

## Errors


For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The request is denied because of missing access permissions. Check your permissions and retry your request.  
HTTP Status Code: 403

 ** ConflictException **   
There was a conflict performing an operation. Resolve the conflict and retry your request.  
HTTP Status Code: 409

 ** InternalServerException **   
An internal server error occurred. Retry your request.    
 ** reason **   
The reason for the exception. If the reason is `BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE`, the model invocation service is unavailable. Retry your request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.  
HTTP Status Code: 404

 ** ThrottlingException **   
The number of requests exceeds the limit. Resubmit your request later.  
HTTP Status Code: 429

 ** ValidationException **   
Input validation failed. Check your request parameters and retry the request.  
HTTP Status Code: 400

## Examples


### Example request


This example illustrates one usage of UpdateSession.

```
PUT bedrock-agent-runtime.us-east-1.amazonaws.com/sessions/12345abc-1234-abcd-1234-abcdef123456/ HTTP/1.1
Content-type: application/json

{
   "sessionMetadata": { 
      "userLanguage" : "French" 
   }
}
```

## See Also


For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/bedrock-agent-runtime-2023-07-26/UpdateSession) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/bedrock-agent-runtime-2023-07-26/UpdateSession) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/bedrock-agent-runtime-2023-07-26/UpdateSession) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/bedrock-agent-runtime-2023-07-26/UpdateSession) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/bedrock-agent-runtime-2023-07-26/UpdateSession) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/bedrock-agent-runtime-2023-07-26/UpdateSession) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/bedrock-agent-runtime-2023-07-26/UpdateSession) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/bedrock-agent-runtime-2023-07-26/UpdateSession) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/bedrock-agent-runtime-2023-07-26/UpdateSession) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/bedrock-agent-runtime-2023-07-26/UpdateSession) 