updateAgent method

Future<UpdateAgentResponse> updateAgent({
  1. required String agentId,
  2. required String agentName,
  3. required String agentResourceRoleArn,
  4. required String foundationModel,
  5. AgentCollaboration? agentCollaboration,
  6. CustomOrchestration? customOrchestration,
  7. String? customerEncryptionKeyArn,
  8. String? description,
  9. GuardrailConfiguration? guardrailConfiguration,
  10. int? idleSessionTTLInSeconds,
  11. String? instruction,
  12. MemoryConfiguration? memoryConfiguration,
  13. OrchestrationType? orchestrationType,
  14. PromptOverrideConfiguration? promptOverrideConfiguration,
})

Updates the configuration of an agent.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter agentId : The unique identifier of the agent.

Parameter agentName : Specifies a new name for the agent.

Parameter agentResourceRoleArn : The Amazon Resource Name (ARN) of the IAM role with permissions to invoke API operations on the agent.

Parameter foundationModel : The identifier for the model that you want to be used for orchestration by the agent you create.

The modelId to provide depends on the type of model or throughput that you use:

Parameter agentCollaboration : The agent's collaboration role.

Parameter customOrchestration : Contains details of the custom orchestration configured for the agent.

Parameter customerEncryptionKeyArn : The Amazon Resource Name (ARN) of the KMS key with which to encrypt the agent.

Parameter description : Specifies a new description of the agent.

Parameter guardrailConfiguration : The unique Guardrail configuration assigned to the agent when it is updated.

Parameter idleSessionTTLInSeconds : The number of seconds for which Amazon Bedrock keeps information about a user's conversation with the agent.

A user interaction remains active for the amount of time specified. If no conversation occurs during this time, the session expires and Amazon Bedrock deletes any data provided before the timeout.

Parameter instruction : Specifies new instructions that tell the agent what it should do and how it should interact with users.

Parameter memoryConfiguration : Specifies the new memory configuration for the agent.

Parameter orchestrationType : Specifies the type of orchestration strategy for the agent. This is set to DEFAULT orchestration type, by default.

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

Implementation

Future<UpdateAgentResponse> updateAgent({
  required String agentId,
  required String agentName,
  required String agentResourceRoleArn,
  required String foundationModel,
  AgentCollaboration? agentCollaboration,
  CustomOrchestration? customOrchestration,
  String? customerEncryptionKeyArn,
  String? description,
  GuardrailConfiguration? guardrailConfiguration,
  int? idleSessionTTLInSeconds,
  String? instruction,
  MemoryConfiguration? memoryConfiguration,
  OrchestrationType? orchestrationType,
  PromptOverrideConfiguration? promptOverrideConfiguration,
}) async {
  _s.validateNumRange(
    'idleSessionTTLInSeconds',
    idleSessionTTLInSeconds,
    60,
    5400,
  );
  final $payload = <String, dynamic>{
    'agentName': agentName,
    'agentResourceRoleArn': agentResourceRoleArn,
    'foundationModel': foundationModel,
    if (agentCollaboration != null)
      'agentCollaboration': agentCollaboration.value,
    if (customOrchestration != null)
      'customOrchestration': customOrchestration,
    if (customerEncryptionKeyArn != null)
      'customerEncryptionKeyArn': customerEncryptionKeyArn,
    if (description != null) 'description': description,
    if (guardrailConfiguration != null)
      'guardrailConfiguration': guardrailConfiguration,
    if (idleSessionTTLInSeconds != null)
      'idleSessionTTLInSeconds': idleSessionTTLInSeconds,
    if (instruction != null) 'instruction': instruction,
    if (memoryConfiguration != null)
      'memoryConfiguration': memoryConfiguration,
    if (orchestrationType != null)
      'orchestrationType': orchestrationType.value,
    if (promptOverrideConfiguration != null)
      'promptOverrideConfiguration': promptOverrideConfiguration,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/agents/${Uri.encodeComponent(agentId)}/',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateAgentResponse.fromJson(response);
}