Building autonomous agents using Amazon Bedrock
Image credit: Unsplash.com

Building autonomous agents using Amazon Bedrock

Generative AI at AWS re:Invent 2023

Last year I had the opportunity to attend AWS re:Invent 2023 in Las Vegas and some of the key announcements for generative AI included the general availability of Agents for Amazon Bedrock on 28 November 2023 .

Like me you may have experience working with data in contact centres in government, wealth management, funds management and even insurance claims. AI agents present a new opportunity to help us move from chatbots to orchestration with multi-step tasks. We need human input and our own data.

Lesson Objectives

In this short post you will learn how to:

  • Define AI agents
  • Explain their customer benefits
  • Identify key product features
  • Explore common use cases
  • Get started

What are AI agents?

AI agents in Amazon Bedrock allows you to automate tasks and configure conversation agents into your business applications in the real-world.

This autonomous agent can help a business user to complete actions based on :

  1. Their enterprise data
  2. Human or user input

What are the benefits to the business user?

AI agents can automate tasks for business users and also answer questions for them .

Developers can save time to ship generative AI business applications.

You do not need to manage any cloud infrastructure or write any code.

What are the key features?

The AI agent will orchestrate interactions between third-party foundation models e.g. Llama, enterprise data sources, software applications, and user conversations .

How do we use an AI agent?

As per the Amazon Bedrock User Guide, the agent performs the following tasks :

  • Use foundation models to understand user requests
  • Beak down the tasks into smaller steps
  • Collect additional information from a user through NLP
  • Take actions to fulfill a customer's request by making API calls to your business applications
  • Augment performance and accuracy by querying data sources

What are the common use cases?

AI agents may be applied across different business applications and industries such as:

  • Make travel reservations
  • Process an insurance claim
  • Healthcare patient discharge

How do I get started?

To create an agent we need to:

  • Configure an Amazon Bedrock agent for your use case i.e. define the purpose of the agent and the foundation model for the prompt input and response

The foundation models used by Amazon Bedrock agents include the below:

Image: Amazon Bedrock User Guide

You may create or configure an agent using the console, API, SDK or CLI.

In Preview

Working Draft

This a draft that you can use to make iterations once the agent is built. Use this working draft to test and troubleshoot agent behaviour.

Customize the AI agent

You may customize the behaviour of the agent for your use case with:

  • Advanced prompts
  • Session states

Tutorial: Build an Amazon Bedrock Travel Agent

  1. Sign into the AWS Management Console as an IAM Admin User and navigate to AWS Sydney region.
  2. Navigate in the search bar and type 'Amazon Bedrock' and click Get Started.


Image credit: Wendy Wong

3. Navigate to the left and select Agent. Next select Create Agent.

Image credit: Wendy Wong

4. Select a base model i.e. foundation model on the left-handside and request model access.

I selected Anthropic's Claude 3 Haiku foundation model.


Image credit: Wendy Wong
Image credit: Wendy Wong

5. Submit request to access Anthropic's Claude 3 Haiku foundation model.

Image credit: Wendy Wong

Read the terms and conditions and then select Submit.

Image credit: Wendy Wong

In a few seconds, model access is granted.

Image credit: Wendy Wong

6. Provide a name for your agent e.g. Travel. You may optionally provide a description for the agent.

Save the agent.

Image credit: Wendy Wong

7. The agent is created.

Image credit: Wendy Wong

8. Under Agent resource role, select an appropriate option. E.g. Create an use a new service role.

Under Select Model, provide the instructions for the Agent i.e. the specific actions the agent can perform.

Image credit: Wendy Wong

9. Create Action Group by creating a Lambda function.

Image credit: Wendy Wong

Select Create.

Image credit: Wendy Wong

10. Select Create a knowledge base.

Image credit: Wendy Wong

11. Provide a name for the knowledge base. e.g. Macau

Image credit: Wendy Wong

12. Select the data source for the knowledge base as Web crawler - Preview. ImageNext.

Image credit: Wendy Wong

Provide the URL for the website Flight Centre click Next.


Image credit: Flight Centre Australia
Image credit: Wendy Wong

13. Select an embeddings model e.g. Cohere's Embed English V3. Leave the default selection for Vector database and select Next.

An AWS OpenSearch Serverless vector store will be created on my behalf by Amazon Web Services.

Image Credit: Wendy Wong

14. Review your settings and select Create knowledge base.

Image credit: Wendy Wong

The knowledge base has successfully been created.

Image credit: Wendy Wong

15. Request model access for Anthropic's Claude 3 Haiku and add the existing knowledge base for Macau.

Enter instructions in the knowledge base.

Image credit: Wendy Wong

16. The Action Group and Knowledge Base were both added successfully.

Image credit: Wendy Wong

17. Test the agent by asking a few questions with query and search with prompt engineering.

Do I need a visa to travel from Sydney to Hong Kong?        
Image credit: Wendy Wong
What is the best way to travel from Hong Kong to Macau?        
Image credit: Wendy Wong
What are the tourist attractions in Hong Kong for a 1 day trip?        
Image credit: Wendy Wong
What are the tourist attractions in Macau?        
Image credit: Wendy Wong
Do I need to pay for a visa from Sydney to Macau?        
Image credit: Wendy Wong

18. Delete your Agent after you end your session. Enter the word 'Delete' in the field provided.

Image credit: Wendy Wong

19. Delete your Knowledge Base if you no longer require use after your session has ended.

Image credit: Wendy Wong

20. Navigate to Model Access to remove access after you have ended your session. This will ensure that you will not have any surprise monthly bills.

Click Submit.

Image credit: Wendy Wong

Conclusion

You may quickly build an AI agent to perform actions based on your knowledge base that could include your enterprise data or data that is crawled from public websites in preview.

You also provide instructions for the knowledge base and agent to perform based on your given use case or business application to solve real-world problems.

AWS re: Invent 2023

If you would like to learn more about Agents on Amazon Bedrock you may watch the following presentations:

AWS re: Invent 2023 - Simplify generative AI app development with Agents for Amazon Bedrock (AIM353)

AWS re:Invent 2023: AWS On Air ft. Agents for Amazon Bedrock


AWS re:Invent 2023 - Building an AWS solutions architect agent with Amazon Bedrock (BOA306)

This Month

AWS Innovate - 26 September 2024

You are invited this later month to join us for AWS Innovate in APJ to learn how to modernize your applications and also implement generative AI solutions for your industry.

You may register at this link .

Image credit: Amazon Web Services

Until the next update, Happy Learning ! ??

要查看或添加评论,请登录

社区洞察

其他会员也浏览了