Skip to main content

agent_knowledge_bases

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

Overview

Nameagent_knowledge_bases
TypeResource
Idaws.bedrock_agent.agent_knowledge_bases

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
agent_idstringThe unique identifier of the agent with which the knowledge base is associated. (pattern: <code>[0-9a-zA-Z]{10}</code>)
agent_versionstringThe version of the agent with which the knowledge base is associated. (pattern: <code>(DRAFT|[0-9]{0,4}[1-9][0-9]{0,4})</code>)
created_atstring (date-time)The time at which the association between the agent and the knowledge base was created.
descriptionstringThe description of the association between the agent and the knowledge base.
knowledge_base_idstringThe unique identifier of the association between the agent and the knowledge base. (pattern: <code>[0-9a-zA-Z]{10}</code>)
knowledge_base_statestringSpecifies whether to use the knowledge base or not when sending an InvokeAgent request. (ENABLED, DISABLED)
updated_atstring (date-time)The time at which the association between the agent and the knowledge base was last updated.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_agent_knowledge_baseselectagent_id, agent_version, knowledge_base_id, regionGets information about a knowledge base associated with an agent.
list_agent_knowledge_basesselectagent_id, agent_version, regionLists knowledge bases associated with an agent and information about each one.
associate_agent_knowledge_baseupdateagent_id, agent_version, region, knowledgeBaseId, descriptionAssociates a knowledge base with an agent. If a knowledge base is associated and its indexState is set to Enabled, the agent queries the knowledge base for information to augment its response to the user.
disassociate_agent_knowledge_baseupdateagent_id, agent_version, knowledge_base_id, regionDisassociates a knowledge base from an agent.
update_agent_knowledge_baseexecagent_id, agent_version, knowledge_base_id, regionUpdates the configuration for a knowledge base that has been associated with an agent.

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 associated with the knowledge base that you want to update.
agent_versionstringThe version of the agent associated with the knowledge base that you want to update.
knowledge_base_idstringThe unique identifier of the knowledge base that has been associated with an agent.
regionstringAWS region (default: us-east-1)

SELECT examples

Gets information about a knowledge base associated with an agent.

SELECT
agent_id,
agent_version,
created_at,
description,
knowledge_base_id,
knowledge_base_state,
updated_at
FROM aws.bedrock_agent.agent_knowledge_bases
WHERE agent_id = '{{ agent_id }}' -- required
AND agent_version = '{{ agent_version }}' -- required
AND knowledge_base_id = '{{ knowledge_base_id }}' -- required
AND region = '{{ region }}' -- required
;

UPDATE examples

Associates a knowledge base with an agent. If a knowledge base is associated and its indexState is set to Enabled, the agent queries the knowledge base for information to augment its response to the user.

UPDATE aws.bedrock_agent.agent_knowledge_bases
SET
knowledgeBaseId = '{{ knowledgeBaseId }}',
description = '{{ description }}',
knowledgeBaseState = '{{ knowledgeBaseState }}'
WHERE
agent_id = '{{ agent_id }}' --required
AND agent_version = '{{ agent_version }}' --required
AND region = '{{ region }}' --required
AND knowledgeBaseId = '{{ knowledgeBaseId }}' --required
AND description = '{{ description }}' --required
RETURNING
agent_knowledge_base;

Lifecycle Methods

Updates the configuration for a knowledge base that has been associated with an agent.

EXEC aws.bedrock_agent.agent_knowledge_bases.update_agent_knowledge_base
@agent_id='{{ agent_id }}' --required,
@agent_version='{{ agent_version }}' --required,
@knowledge_base_id='{{ knowledge_base_id }}' --required,
@region='{{ region }}' --required
@@json=
'{
"description": "{{ description }}",
"knowledgeBaseState": "{{ knowledgeBaseState }}"
}'
;