Skip to content

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.

Workflow Overview

The workflow of the AmazonBedrockAgent class consists of four components:

  1. Initialization: An agent is created in the AWS platform named Amazon Bedrock and registered in AI Refinery with the specified configuration.
  2. Sending a Query: A user query is forwarded from AI Refinery to the Amazon Bedrock Agent running on the Bedrock platform.
  3. 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.
  4. 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 under utility_agents.
  • Ensure the agent_name you chose for your AmazonBedrockAgent is listed in the agent_list under orchestrator.

AmazonBedrockAgent Agent Setup

Users can customize an Amazon Bedrock Agent through the Bedrock platform. To create an agent, follow these steps:

  1. Sign Up for an IAM user account on Bedrock.
  2. Log in to your new account.
  3. Obtain your account credentials: AWS Client Key and AWS Client Secret. You will need these to configure your agent in AIR later.
  4. Build your custom agent by adding system prompts, action groups, and knowledge bases
  5. Create an alias for your agent (version snapshot), and prepare (publish) your agent for use.

  6. 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.

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"

In this template:

  • client_key and client_secret are a mapping to the names of the environment variables that hold your actual AWS client key and client secret.
  • deployment_region is the geographical region where your AWS account and, therefore, your agents, are deployed.
  • agent_id is a unique identifier assigned to each agent within your AWS Bedrock account.
  • alias_id is a 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 is a 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.