Amazon Bedrock Agents with AWS Lambda

Amazon Bedrock Agent → AWS Lambda

Create a agent with Amazon Bedrock with a Lambda function action group

In this pattern, we show you how to use Amazon Bedrock Agents to call an API and get the results from it for a user. Bedrock Agents is helpful in various situations such as fetching real-time information from APIs, interacting with knowledge bases, and performing actions based on user inputs.
It processes user input through a foundation model to determine its next steps. It then decides whether to invoke an action or query a knowledge base. For performing an action it has action groups defined, in this example we are using a Lambda function which invokes an API. It then either executes the action or it gathers more information from its knowledge base or the user. The agent generates an observation from these results, which it uses to update its understanding. This cycle continues until the agent can provide a final response or needs more user input, allowing for dynamic and context-aware interactions.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/bedrock-agents-lambda-cdk

Deploy

cdk deploy


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: cdk destroy.

Created by:

Reethi Joseph

Reethi Joseph

Reethi is a Senior Cloud Support Engineer at AWS who specializes in Serverless.

Follow on LinkedIn