Site icon becoration

Improve the customer experience with a smart email automation solution using Amazon Bedrock.

Organizations invest numerous resources, effort, and money in carrying out their customer service operations to respond to their inquiries and provide solutions. Customers can ask questions through various channels, such as email, chat, or phone, and deploying a team to handle these queries can be resource-intensive, time-consuming, and unproductive if the responses to those questions are repetitive.

Although the organization may have the necessary data to respond to customer inquiries, they may still face challenges in implementing an automated process to address those inquiries. These challenges may include unstructured data, different languages, and a lack of expertise in artificial intelligence (AI) and machine learning (ML) technologies.

In this article, we show how to overcome these challenges using Amazon Bedrock to automate email responses to customer inquiries. With our solution, the intent of customer emails can be identified, and an automated response can be sent if the intent matches the existing knowledge base or data sources. If the intent does not have a match, the email is sent to the support team for manual response.

Amazon Bedrock is a fully managed service that provides fundamental models from leading AI startups and Amazon through an API, allowing you to choose from a wide range of models to find the most suitable model for the use case. Amazon Bedrock offers a serverless experience to quickly get started, privately customize the models with your own data, and integrate and deploy them in applications using AWS tools without the need to manage infrastructure.

Below are some common customer intentions when contacting customer service:
– Transaction status (e.g., status of a money transfer)
– Password reset
– Promotional code or discount
– Hours of operation
– Agent location
– Reporting fraud
– Unlock account
– Close account

Agents for Amazon Bedrock can help with classification and entity detection in emails for these intentions. For this solution, we show how to classify customer emails for the first three intentions. Agents for Amazon Bedrock can also be used to detect key information in emails, in order to automate business processes with some actions. For example, agents can be used to automatically respond to a customer request with specific information related to that query.

Additionally, agents for Amazon Bedrock can serve as an intelligent conversational interface, facilitating seamless interactions with internal team members and external customers, efficiently handling inquiries and implementing desired actions. Currently, agents for Amazon Bedrock support models such as the Anthropic Claude models and the Amazon Titan Text G1 – Premier model.

Solution Overview

To build our email response workflow for customers, we used the following services:
Although we illustrate this use case using WorkMail, another email tool that allows integration with serverless functions or webhooks can be used to carry out similar email automation workflows. Agents for Amazon Bedrock allows you to build and configure autonomous agents in the application. An agent helps users complete actions based on organizational data and user input. Agents orchestrate interactions between models, data sources, software applications, and user conversations. Additionally, agents automatically call APIs to carry out actions and invoke knowledge bases to supplement information for these actions. Developers can save weeks of development effort by integrating agents to accelerate the delivery of generative AI applications. For this use case, we used the Anthropic Claude 3 Sonnet model.

When the agent is created, details are input to instruct the agent on what to do and how to interact with users. The instructions replace the $instructions$ placeholder in the orchestration message template.

The following is an example of the instructions we used for our use cases:

“You are a classification and entity recognition agent.
Task 1: Classify the given text into one of the following categories: ‘Transfer status,’ ‘Password reset,’ or ‘Promotional code.’ Return only the category without additional text.
Task 2: If the classified category is ‘Transfer status,’ find the 10-digit ‘money_transfer_id’ entity (e.g., ‘MTN1234567’) in the text. Call the ‘GetTransferStatus’ action, passing the money_transfer_id as an argument, to retrieve the transfer status.
Task 3: Write an email response for the customer based on the received text, the classified category, and the transfer status (if applicable). Include the money_transfer_id in the response if the category is ‘Transfer status.’
Task 4: Use the email signature ‘Best regards, Intelligent Corp’ at the end of the email response.”

A group of actions defines the actions the agent can assist the user in performing. For example, a group of actions named GetTransferStatus could be defined with an OpenAPI schema and an attached Lambda function. Agents for Amazon Bedrock handles building the API based on the OpenAPI schema and fulfills actions using the Lambda function to retrieve the status from the DynamoDB money_transfer_status table.

The following architecture diagram highlights the end-to-end solution:

The solution workflow includes the following steps:
1. A customer initiates the process by sending an email to the customer support email address created within WorkMail.
2. Upon receiving the email, WorkMail invokes a Lambda function, triggering the subsequent workflow.
3. The Lambda function seamlessly forwards the email content to Agents for Amazon Bedrock for further processing.
4. The agent leverages the natural language processing capabilities of the Anthropic Claude 3 Sonnet model to understand the classification of the email content based on the agent’s predefined instruction settings. If relevant entities are detected within the email, such as a money transfer ID, the agent invokes a Lambda function to retrieve the corresponding payment status.
5. If the email classification does not relate to a query about the status of a money transfer, the agent generates an appropriate email response (e.g., instructions for password reset) and calls a Lambda function to facilitate the delivery of the response.
6. For inquiries related to the status of a money transfer, the agent’s action group Lambda function queries the DynamoDB table to retrieve relevant status information based on the provided transfer ID and passes the response back to the agent.
7. With the retrieved information, the agent crafts a personalized email response for the customer and invokes a Lambda function to initiate the delivery process.
8. The Lambda function uses Amazon SES to send the email response, providing the email body, subject, and customer email address.
9. Amazon SES delivers the email message to the customer’s inbox, ensuring seamless communication.
10. In scenarios where the agent cannot accurately discern the customer’s intent, it is capable of escalating the issue by pushing the message to an SNS topic. This mechanism allows the ticketing system subscribed to the topic to receive the notification and create a support ticket for further investigation and resolution.

Prerequisites
Refer to the README.md file in the GitHub repository to ensure you meet the prerequisites for deploying this solution.

Deploying the Solution
The solution consists of three AWS Cloud Deployment Kit (AWS CDK) stacks:
– WorkmailOrgUserStack: creates the WorkMail account with domain, user, and inbox access.
– BedrockAgentCreation: creates the Bedrock agent, agent action group, OpenAPI schema, S3 bucket, DynamoDB table, and agent group action Lambda function to retrieve transfer status from DynamoDB.
– EmailAutomationWorkflowStack: creates the classification Lambda function that interacts with the agent and the integration Lambda function that integrates with WorkMail.

To deploy the solution, some manual configurations must also be done using the AWS management console. For complete instructions, refer to the README.md file in the GitHub repository.

Testing the Solution
To test the solution, send an email from your personal email to the support address created as part of the AWS CDK deployment. We used the following three intentions in our sample data for custom classification training:
– MONEYTRANSFER: Customer wants to know the status of a money transfer.
– PASSRESET: Customer has a locked account or a password request.
– PROMOCODE: Customer wants to know about a discount or promotional code available for a money transfer.

The following screenshot shows an example of an email from a customer requesting the status of a money transfer.

If the customer email is unclassified, the email content is forwarded to an SNS topic. Subscribers of the topic receive the email content as a notification message.

Cleanup
To avoid ongoing costs, the resources created as part of this solution should be deleted once finished. For instructions, refer to the README.md file in the GitHub repository.

Conclusion

In this article, you learned how to set up an intelligent email automation solution using Agents for Amazon Bedrock, WorkMail, Lambda, DynamoDB, Amazon SNS, and Amazon SES. This solution can provide the following benefits:
– Improved email response times
– Enhanced customer satisfaction
– Cost savings in terms of time and resources
– Ability to focus on key customer issues

You can expand this solution to other areas of your business and industries. Additionally, you can use this solution to build a self-service chatbot by deploying the BedrockAgentCreation stack to respond to customer or internal user inquiries using Agents for Amazon Bedrock. As next steps, explore Agents for Amazon Bedrock to start using its features and follow Amazon Bedrock on the AWS Machine Learning Blog to stay updated on new capabilities and use cases.

Source: MiMub in Spanish

Exit mobile version