Skip to main content

agents

Creates, updates, deletes, gets or lists an agents resource.

Overview

Nameagents
TypeResource
Idaws.bedrock_agent.agents

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
agent_arnstringThe Amazon Resource Name (ARN) of the agent. (pattern: <code>arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:agent/[0-9a-zA-Z]{10}</code>)
agent_collaborationstringThe agent's collaboration settings. (SUPERVISOR, SUPERVISOR_ROUTER, DISABLED)
agent_idstringThe unique identifier of the agent. (pattern: <code>[0-9a-zA-Z]{10}</code>)
agent_namestringThe name of the agent. (pattern: <code>([0-9a-zA-Z][_-]?){1,100}</code>)
agent_resource_role_arnstringThe Amazon Resource Name (ARN) of the IAM role with permissions to invoke API operations on the agent. (pattern: <code>arn:aws(-[^:]+)?:iam::([0-9]{12})?:role/.+</code>)
agent_statusstringThe status of the agent and whether it is ready for use. The following statuses are possible: CREATING – The agent is being created. PREPARING – The agent is being prepared. PREPARED – The agent is prepared and ready to be invoked. NOT_PREPARED – The agent has been created but not yet prepared. FAILED – The agent API operation failed. UPDATING – The agent is being updated. DELETING – The agent is being deleted. (CREATING, PREPARING, PREPARED, NOT_PREPARED, DELETING, FAILED, VERSIONING, UPDATING)
agent_versionstringThe version of the agent. (pattern: <code>DRAFT</code>)
client_tokenstringA unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see Ensuring idempotency. (pattern: <code>[a-zA-Z0-9](-*[a-zA-Z0-9]){0,256}</code>)
created_atstring (date-time)The time at which the agent was created.
custom_orchestrationobjectDetails of custom orchestration.
customer_encryption_key_arnstringThe Amazon Resource Name (ARN) of the KMS key that encrypts the agent. (pattern: <code>arn:aws(|-cn|-us-gov):kms:[a-zA-Z0-9-]*:[0-9]{12}:key/[a-zA-Z0-9-]{36}</code>)
descriptionstringThe description of the agent.
failure_reasonsarrayContains reasons that the agent-related API that you invoked failed.
foundation_modelstringThe foundation model used for orchestration by the agent. (pattern: <code>(arn:aws(-[^:]{1,12})?:(bedrock|sagemaker):[a-z0-9-]{1,20}:([0-9]{12})?:([a-z-]+/)?)?([a-zA-Z0-9.-]{1,63}){0,2}(([:][a-z0-9-]{1,63}){0,2})?(/[a-z0-9]{1,12})?</code>)
guardrail_configurationobjectDetails about a guardrail associated with a resource.
idle_session_ttl_in_secondsintegerThe 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.
instructionstringInstructions that tell the agent what it should do and how it should interact with users.
memory_configurationobjectDetails of the memory configuration.
orchestration_typestringSpecifies the orchestration strategy for the agent. (DEFAULT, CUSTOM_ORCHESTRATION)
prepared_atstring (date-time)The time at which the agent was last prepared.
prompt_override_configurationobjectContains configurations to override prompts in different parts of an agent sequence. For more information, see Advanced prompts.
recommended_actionsarrayContains recommended actions to take for the agent-related API that you invoked to succeed.
updated_atstring (date-time)The time at which the agent was last updated.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_agentselectagent_id, regionGets information about an agent.
list_agentsselectregionLists the agents belonging to an account and information about each agent.
create_agentinsertregion, agentNameCreates an agent that orchestrates interactions between foundation models, data sources, software applications, user conversations, and APIs to carry out tasks to help customers. Specify the following fields for security purposes. agentResourceRoleArn – The Amazon Resource Name (ARN) of the role with permissions to invoke API operations on an agent. (Optional) customerEncryptionKeyArn – The Amazon Resource Name (ARN) of a KMS key to encrypt the creation of the agent. (Optional) idleSessionTTLinSeconds – Specify the number of seconds for which the agent should maintain session information. After this time expires, the subsequent InvokeAgent request begins a new session. To enable your agent to retain conversational context across multiple sessions, include a memoryConfiguration object. For more information, see Configure memory. To override the default prompt behavior for agent orchestration and to use advanced prompts, include a promptOverrideConfiguration object. For more information, see Advanced prompts. If your agent fails to be created, the response returns a list of failureReasons alongside a list of recommendedActions for you to troubleshoot. 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.
update_agentupdateagent_id, region, agentName, foundationModel, agentResourceRoleArnUpdates the configuration of an agent.
delete_agentdeleteagent_id, regionskipResourceInUseCheckDeletes an agent.
prepare_agentexecagent_id, regionCreates a DRAFT version of the agent that can be used for internal testing.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
agent_idstringThe unique identifier of the agent for which to create a DRAFT version.
regionstringAWS region (default: us-east-1)
skipResourceInUseCheckbooleanBy default, this value is false and deletion is stopped if the resource is in use. If you set it to true, the resource will be deleted even if the resource is in use.

SELECT examples

Gets information about an agent.

SELECT
agent_arn,
agent_collaboration,
agent_id,
agent_name,
agent_resource_role_arn,
agent_status,
agent_version,
client_token,
created_at,
custom_orchestration,
customer_encryption_key_arn,
description,
failure_reasons,
foundation_model,
guardrail_configuration,
idle_session_ttl_in_seconds,
instruction,
memory_configuration,
orchestration_type,
prepared_at,
prompt_override_configuration,
recommended_actions,
updated_at
FROM aws.bedrock_agent.agents
WHERE agent_id = '{{ agent_id }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates an agent that orchestrates interactions between foundation models, data sources, software applications, user conversations, and APIs to carry out tasks to help customers. Specify the following fields for security purposes. agentResourceRoleArn – The Amazon Resource Name (ARN) of the role with permissions to invoke API operations on an agent. (Optional) customerEncryptionKeyArn – The Amazon Resource Name (ARN) of a KMS key to encrypt the creation of the agent. (Optional) idleSessionTTLinSeconds – Specify the number of seconds for which the agent should maintain session information. After this time expires, the subsequent InvokeAgent request begins a new session. To enable your agent to retain conversational context across multiple sessions, include a memoryConfiguration object. For more information, see Configure memory. To override the default prompt behavior for agent orchestration and to use advanced prompts, include a promptOverrideConfiguration object. For more information, see Advanced prompts. If your agent fails to be created, the response returns a list of failureReasons alongside a list of recommendedActions for you to troubleshoot. 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.

INSERT INTO aws.bedrock_agent.agents (
agentName,
clientToken,
instruction,
foundationModel,
description,
orchestrationType,
customOrchestration,
idleSessionTTLInSeconds,
agentResourceRoleArn,
customerEncryptionKeyArn,
tags,
promptOverrideConfiguration,
guardrailConfiguration,
memoryConfiguration,
agentCollaboration,
region
)
SELECT
'{{ agentName }}' /* required */,
'{{ clientToken }}',
'{{ instruction }}',
'{{ foundationModel }}',
'{{ description }}',
'{{ orchestrationType }}',
'{{ customOrchestration }}',
{{ idleSessionTTLInSeconds }},
'{{ agentResourceRoleArn }}',
'{{ customerEncryptionKeyArn }}',
'{{ tags }}',
'{{ promptOverrideConfiguration }}',
'{{ guardrailConfiguration }}',
'{{ memoryConfiguration }}',
'{{ agentCollaboration }}',
'{{ region }}'
RETURNING
agent
;

UPDATE examples

Updates the configuration of an agent.

UPDATE aws.bedrock_agent.agents
SET
agentName = '{{ agentName }}',
instruction = '{{ instruction }}',
foundationModel = '{{ foundationModel }}',
description = '{{ description }}',
orchestrationType = '{{ orchestrationType }}',
customOrchestration = '{{ customOrchestration }}',
idleSessionTTLInSeconds = {{ idleSessionTTLInSeconds }},
agentResourceRoleArn = '{{ agentResourceRoleArn }}',
customerEncryptionKeyArn = '{{ customerEncryptionKeyArn }}',
promptOverrideConfiguration = '{{ promptOverrideConfiguration }}',
guardrailConfiguration = '{{ guardrailConfiguration }}',
memoryConfiguration = '{{ memoryConfiguration }}',
agentCollaboration = '{{ agentCollaboration }}'
WHERE
agent_id = '{{ agent_id }}' --required
AND region = '{{ region }}' --required
AND agentName = '{{ agentName }}' --required
AND foundationModel = '{{ foundationModel }}' --required
AND agentResourceRoleArn = '{{ agentResourceRoleArn }}' --required
RETURNING
agent;

DELETE examples

Deletes an agent.

DELETE FROM aws.bedrock_agent.agents
WHERE agent_id = '{{ agent_id }}' --required
AND region = '{{ region }}' --required
AND skipResourceInUseCheck = '{{ skipResourceInUseCheck }}'
;

Lifecycle Methods

Creates a DRAFT version of the agent that can be used for internal testing.

EXEC aws.bedrock_agent.agents.prepare_agent
@agent_id='{{ agent_id }}' --required,
@region='{{ region }}' --required
;