logo
Menu

Building an AWS Solution Architect Agent with Amazon Bedrock

Tips and guidance on building a Generative AI Agents

Banjo Obayomi
Amazon Employee
Published Apr 23, 2024
Wow lots of changed since I built my original Agent AWS in June 2023. Newer models and new frameworks have made it easier to build generative AI Agents.
An "agent" is a Large Language Model (LLM) with a predefined prompt and access to a specific set of “tools”, which are self-contained functions designed to perform a specific task.
For instance, these tools could include getting external data or posting content. Agent AWS leverages custom built tools to query AWS documentation, generate code, and create architectural diagrams.
Lets walk through how I was able to recreate Agent AWS with the new features that are on Amazon Bedrock.

Creating the Agent

The Agent setup process is very smooth, I can select my system prompt, and choose the latest models. Having Claude Haiku is a gamer changer. It's speed and intelligence have been well highlighted, and having it act as the "brains" for my agent is a huge improvement from the old LLMs from last year.
Starting the Agent

Adding a Knowledge Base

My previous agent, I had to create a standalone tool to perform Retrieval augmented generation (RAG). This required me to write code to mange the embedding function and to use the vector database. But now Amazon Bedrock supports Knowledge Bases which allows me to upload documents to an S3 bucket, and then I'm able to create a RAG endpoint without having to write a single line of code!
Creating a Knowledge Base
Once the knowledge base is up, I can test it right then and there. There is even an option to upload a document without creating a knowledge base if you just wanted to test chatting with your documents.
Once the knowledge base is created, it was simple to add it as a "tool" for my agent. You can even customize a prompt for how the RAG function should operate.
Add Knowledge base to Agent
.

Creating Tools

Previously I had to write lots of boilerplate code, and helps to wrap logic to create tools for my older agents. This time I wanted to test how the new action groups work for creating tools for Agent AWS.
I started off with a simple writing code tool using the new lambda quick create feature which creates a lambda function for you.
Create tool with Lambda
When I go to the Lambda console, a new function ready to go. I can add my custom business logic into the template.
Fresh Lambda Function

Using the Agent

With my custom tools added, it was quite easy to use the agent in the console and inspect how it makes its decisions. Also using Claude Haiku made this very fast!! Agent AWS can also be invoked via code as well.
Using the Agent
Overall the agent experience is much improved, and I'm looking forward to see what type of agents the community will build!!!
 

Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.

1 Comment