AWS GenAI Use Case 5: Retail Banking Agent
An advanced, autonomous AI Agent for a retail bank built on Amazon Bedrock Agents. This agent can not only answer questions about banking policies (via Knowledge Bases) but also take actions on behalf of the user, such as checking their account balance or transferring funds.
Architecture Overview
This replaces the chaotic code required to build a LangGraph agent with a fully managed AWS service.
- Amazon Bedrock Agents (The Brain): An autonomous orchestrator powered by Anthropic's Claude 3. It receives a top-level prompt ("You are a bank teller...") and decides what to do next.
- Bedrock Knowledge Base (The Memory): If the user asks "What is the penalty for early CD withdrawal?", the Agent autonomously queries its attached Knowledge Base (which holds the bank's PDF terms of service) to retrieve the answer.
- Action Groups (AWS Lambda): If the user says "Transfer $50 to my savings account", the LLM realizes it needs to perform an action. It structures the data and triggers an attached AWS Lambda function (the "Action Group").
- Core Banking APIs (Mocked Database): The Lambda function executes the actual SQL code to update the user's balance and returns a success code to the Bedrock Agent.
- The Reply: The Agent generates a polite english sentence ("I have successfully transferred $50 to your savings account") and returns it to the user.
Component Breakdown
1. terraform/ (Infrastructure as Code)
Warning: Creating full Bedrock Agents with attached Action Groups via Terraform requires massive OpenAPI schema definitions. This main.tf creates the Lambda Function (the Action Group compute) and its IAM permissions. The physical Bedrock Agent is usually wired up in the Console for ease of testing.
2. src/ (Action Group Logic)
lambda_handler.py: The Python code that the Bedrock Agent triggers when it decides it needs to perform a physical banking action (Check Balance or Transfer Funds).openapi_schema.yaml: The strictly typed schema that you upload to the Bedrock Console. This schema teaches the LLM exactly what actions the Lambda function is capable of so the LLM knows when to call it!
3. CI/CD (.github/workflows/deploy.yml)
Automates the deployment of the Action Group Lambda function.