Welcome the Multi-Component Agents of AWS Bedrock

Issa Farhat   ☁️   June 13, 2024   ☁️  

Table of Contents

Wave “Hello World!”

The rise of Generative AI models has revolutionized the tech landscape, unlocking unprecedented creative potential and giving birth to whole new industries. This transformative technology is reshaping our world and expanding the horizons of what’s possible, yet most businesses aren’t utilizing it to its fullest extent.

Generative AI can (and should) be integrated into a variety of business areas, aiding in process automation, content and data synthesis, as well as streamlining of internal operations. Gone are the days where AI applications for most businesses constituted no more than deploying mere chatbots. Today’s agents can more than just say, they can do.

Knowledge-Based Agents using AWS Bedrock

AWS Bedrock makes it extremely easy to create AI Agents. Agents in Bedrock can be equipped with a knowledge base containing all kinds of information for them to look up in order to aid them achieve their tasks. Moreover, they can be hooked to lambda functions and external APIs via openAPI schemas, giving them the ability to call these tools when they see fit. This greatly expands the realm of what’s possible to do with this technology.

The Components of AWS Bedrock Agents

The Bedrock Agent development platform is made of 5 main components. We’ll go over each component below.

Agent details

Agent Details is the principal component to configure when building a Bedrock Agent. It’s the only required component. In Agent Details, you specify instructions to your agent, detailing everything from its purpose to its tone, behavior, the rules it has to follow, as well as information about the tools and knowledge it has access to. You also specify the agent’s AI model, its name, as well as a few extra additional features.

Pro-Tip: The clearer and more detailed your instructions, the better your agent behaves. Follow the prompt guides of the provider whose model you choose for your agent. Here are links for some:

Action groups

Action Groups allow you to add functionalities to your agents which go beyond just responding to queries. They allow your agent to call lambda functions and other APIs via API Gateway when it see fit. You can define action groups with:

  1. Lambda function details, in which you create a lambda function containing the function tools the agent will call.
  2. OpenAPI schemas, which allow you to define APIs your agent can call via lambda or an API Gateway.

Pro-Tip: Even though they’re optional, it’s important to give detailed descriptions to your action group functions and their parameters. This will help your agent call the right function at the right time. The more function tools you want to give your agent, the more it becomes important to describe in detail what every function and parameter does.

Knowledge bases

Knowledge bases allow you to equip your agent with extra domain-specific information which you want your agent to be able to access. Your agent will query the knowledge base you equip it with in order to enhance its responses and improve its ability in invoking groups. Knowledges bases take S3 as their data source, and you can attach up to 5 data sources to a single Knowledge Base.

Pro-Tip: Attach metadata files to your data source S3 files. Metadata files could greatly enhance search accuracy and open up new search techniques and possibilities for your agent. Refer to AWS’s guide on Metadata Files:

Guardrail Details

Guardrails allow you to have finer control over the content you want your agent to engage with. You can create guardrails to configure content filters, define blocked messages, as well as add denied topics, word filters, and sensitive information filters. Guardrails ensure your agent’s remains well behaved and focused on the scope of which it was created to fulfill.

Pro-Tip: Although a powerful tool to keep your agent in-check, too many guardrails can severely limit the functionality of your agent, as well as lead to potential false positives – situations where the system incorrectly identifies a risk or violation that isn’t actually present.

Advanced Prompts

Under the hood, AWS Bedrock Agents go through a 4-step prompting process before returning answers to the users. These steps are:

  1. Pre-processing
  2. Orchestration
  3. Knowledge base response generation
  4. Post-processing (disabled by default)

Advanced Prompts allow you to take a look at the prompt given to the system at each step and customize it to your will. You can also enable and disable any of those steps (except for the orchestration step if your agent has action groups and/or knowledge bases). You can also define a Lambda function to parse the raw LLM output and derive key information from it to be used in the runtime flow. This can be done for every prompt component mentioned above.

Pro-Tip: Advanced Prompts is a very powerful feature, allowing you fine control over every component of your agent system. Although might be intimidating at first, taking the time to learn and experiment with prompts at every step of the prompting process may prove very beneficial in taking your agent’s performance to the next level.

One Final Component: You

Bedrock Agents are built up from multiple components which can work together to create truly marvelous autonomous systems. Optimizing each of these components and linking them together efficiently is like assembling together a piece of art. Yet behind every great work of art, there’s a great artist, and behind every great AI system, there’s a greater engineer. These autonomous systems don’t shine on their own, but shine by the great minds which engineer them. Thus, behind all of these components which make up an AI agent, let’s not forget the most important one, you.