Amazon Bedrock is a fully managed service that offers a choice of wide range of foundation models (FMs) from companies like AI21 Labs, Anthropic, Cohere, Meta, Stability AI, and Amazon via a single API, along with a broad set of capabilities you need to build generative AI applications including Agent and Knowledge Base functionality. The purpose of this post is to share with you what these features mean and also provide you with useful links and materials on how to get started with them.
First of all — what are the Agents and Knowledge Bases in Amazon Bedrock and how could they help you with building your applications? To put it simply, agent is an extension of a Large Language Model (LLM) that you could delegate the responsibilities to perform certain actions. As an example, the LLM could delegate the agent to book a flight or schedule a meeting, draft an email and automatically send it, or do a google search for you and return the result. The possibilities are limitless. There are various of tools that help you building the agents, like LangChain framework, GPTs from OpenAI, Amazon Bedrock Agents and many more. LangChain is an awesome framework and is really capable of doing a lot of things, but it takes some knowledge on how to create the application using it. If you are already invested and familiar with AWS then using Agents and Knowledge Bases will be easy to grasp. You can create AWS Lambda function where you write a custom logic and your agent would use this Lambda function as a tool whenever it “infers” that it needs to call this function from the conversations with the user. In our fictional example, you would write a custom code in your AWS Lambda function that sends an email through some API call and inserts inside the email body text that the user prompted to the agent. This “hand off” of the information between an agent and Lambda function works because of an Open API json or yaml file that works as a guide for an agent. You need to create this configuration file and attach to the agent through its action group where you specify things like parameters, description and api paths. I encourage you to learn more about creating an agent here.
Knowledge base is what your Agent could get additional context from. Building RAG implementation by hand could be challenging and require special training. I encourage you to read more about Knowledge Bases here as it is a great guide if you want to learn more. What Knowledge Base concept does behind the scene is it creates a vector database for you (you can select from Pinecone, Redis Enterprise Cloud, Amazon Aurora and Amazon OpenSearch Serverless) and configures the embeddings. All you need to do is point the Knowledge Base to a data source (this would be an S3 bucket with files that you want to use as a context for your agent) and it will create embeddings for you.
Useful training and demo materials
- An AWS workshop that gives you hand on exposure with Amazon Bedrock, including subsection on Bedrock Agents.
- Great video from re:Invent 2023 talking about how you can simplify generative AI applications development with Bedrock Agents.
- Take a look at the GitHub repo with some samples on how to use Agents (here) and Knowledge Bases (here).
- Check out this great Medium article that walks you through on how to get started with AWS Bedrock Agents as code. Great overview as well as code step-by-step walkthrough.
- Take a look at my own repository where I built a custom CDK construct that you could download from NPM, PyPi or Go registries and incorporate in your own CDK projects. You will find some deployment samples.
- AWS SDK code examples with actions for Agents for Amazon Bedrock.
Bonus: take a look at this repository with Gen AI CDK constructs. You can find a lot of CDK examples with constructs such as Data ingestion pipeline, Question answering and many more.
Conclusion
I hope I provided you with some brief introduction and materials where you could learn more. Stay tuned as I will be releasing a prototype demo with the Agent and Knowledge Bases use cases soon!
I work for AWS but all of the opinions, ideas and solution implementations in my blogs are purely of my own.
Author
-
View all posts
Max is a Media and Entertainment Solutions Architect based in Seattle, Washington. Specializes in designing and building scalable backend applications. AWS Machine Learning Specialty Certified, AWS Certified Solutions Architect Professional, and former NCAA Divison I tennis player at Oklahoma State University. Speaks Russian and English.



3 thoughts on “Introduction into Amazon Bedrock Agents and Knowledge Bases”
Pingback: Mastering Your Brand: A Tech Professional’s Guide to Scaling Yourself – GetNerdyin30
Pingback: Tips and Best Practices to get the most out of Bedrock Prompt Engineering – GetNerdyin30
Pingback: Using Amazon Bedrock Knowledge Bases to power up sports stats – GetNerdyin30