Amazon Bedrock Agent¶
Amazon Bedrock Agent
is a third-party agent hosted on the AWS platform. These agents use the reasoning of foundation models (FMs), APIs, and data to break down user requests, gathers relevant information, and efficiently completes tasks—freeing teams to focus on high-value work.
Our AI Refinery SDK allows seamless integration with a user's customized Amazon Bedrock Agent
using the AmazonBedrockAgent
class. This integration brings the full power of the Amazon Bedrock Agent
to applications, enhancing performance and capabilities on our AI Refinery platform.
Creating Amazon Bedrock Agent ¶
Users can customize an Amazon Bedrock Agent
through the Bedrock platform. To create an agent, follow these steps:
- Sign Up for an IAM user account on Bedrock.
- Log in to your new account.
- Obtain your account credentials: AWS Client Key and AWS Client Secret. You will need these to configure your agent in AIR later.
- Build your custom agent by adding system prompts, action groups, and knowledge bases
-
Create an alias for your agent (version snapshot), and prepare (publish) your agent for use.
-
Select your agent and obtain its identifiers listed below:
- Deployment Region
- Agent ID
- Alias ID
You will also need these to configure your agent later.
Onboarding Amazon Bedrock Agent¶
To use the Amazon Bedrock agents through our AI Refinery SDK, users need the following parameters:
Variable | Description |
---|---|
client_key |
Mapping to the name of the environment variable that holds your actual AWS client key. |
client_secret |
Mapping to the name of the environment variable that holds your actual AWS client secret. |
deployment_region |
The geographical region where your AWS account is located and your agents are deployed. |
agent_id |
Unique identifier assigned to each agent within your AWS Bedrock account. |
alias_id |
Unique identifier assigned to each version of your agent. When you make changes on your agent and save them, you need to create a new alias as a version snapshot of your agent and redirect requests to that version. |
session_id |
Unique identifier that specifies the session under which the communication with the agent is happening. It is an optional parameter: If not specified, a random unique identifier will be generated. If specified, a previous conversation with the certain agent can be retrieved and the past chat history may be utilized. |
contexts |
Allows for the provision of additional information during communication with the Amazon Bedrock Agent . |
Workflow Overview¶
The workflow of the AmazonBedrockAgent
class consists of four components:
- Initialization: An agent is created in the AWS platform named Amazon Bedrock and registered in AI Refinery with the specified configuration.
- Sending a Query: A user query is forwarded from AI Refinery to the
Amazon Bedrock Agent
running on the Bedrock platform. - Bedrock-Side Processing: The
Amazon Bedrock Agent
decides whether to use predefined tools, knowledge bases, or other resources and processes the query in the Bedrock platform. - Receiving and Parsing the Response: The
Amazon Bedrock Agent
returns the processed results as its final response to AI Refinery.
Usage and Quickstart¶
To quickly set up an AI Refinery project with a AmazonBedrockAgent
, the user should first create their own Amazon Bedrock Agent
in Amazon Bedrock. Once the agent is ready, use the YAML configuration template below to integrate it into the AI Refinery project.
Specifically, ensure the following configurations are included:
- Add a utility agent with
agent_class: AmazonBedrockAgent
underutility_agents
. - Ensure the
agent_name
you chose for yourAmazonBedrockAgent
is listed in theagent_list
underorchestrator
.
Template YAML Configuration of AmazonBedrockAgent
¶
See the YAML template below for the AmazonBedrockAgent
configuration.
orchestrator:
agent_list:
- agent_name: "Amazon Assistant"
utility_agents:
- agent_class: AmazonBedrockAgent
agent_name: "Amazon Assistant"
agent_description: "The Amazon Assistant handles any questions related to the Amazon platform."
config:
client_key: "AWS_CLIENT_KEY" # Required Client Key
client_secret: "AWS_CLIENT_SECRET" # Required Client Secret
deployment_region: "DEPL-REG-1" # Required deployment region (from Bedrock platform overview)
agent_id: "YourAgentID" # Required Agent identifier (from Bedrock platform overview)
alias_id: "YourAgentAliasID" # Required alias identifier (from Bedrock platform overview)
session_id: "123456789" # Optional session identifier
contexts: # Optional additional agent contexts
- "date"
- "chat_history"