Introduction
As organizations grow and evolve, so do the demands on Human Resources. Internal teams often face repetitive, time-consuming tasks—like answering common policy questions, processing leave requests, or managing onboarding queries—that can slow down productivity and strain HR capacity. An AI-powered HR assistant offers a smart, scalable solution to this challenge. This not only reduces the administrative burden on HR staff but also enhances the employee experience through quick resolution of queries and more personalized support.
This blog helps you to create an AI HR assistant that can give you internal regulations, automate the Time Leave request by using Amazon Bedrock Nova Pro model.
Architecture
Prerequisites
- AWS credential grants Bedrock, Lambda, S3, Athena, Glue, OpenSearch permissions
- Linux environment
Steps
git clone https://github.com/aws-samples/amazon-bedrock-samples.git
cd amazon-bedrock-samples/tree/main/agents-and-function-calling/bedrock-agents/use-case-examples/hr-assistant/shell
Use the suitable model (in this blog I use Nova Pro) by editing file cfn
, change
/hr-resources.ymlamazon.titan-text-premier-v1:0
to amazon.nova-pro-v1:0
Run the script:
source ./create-hr-resources.sh
Check mail:
Subscribe topic:
Once the deployment is finished. You can use the Bedrock Agent Playground:
Or you can create a web frontend with streamlit. First install streamlit:
pip install -r agents-and-function-calling/bedrock-agents/use-case-examples/hr-assistant/streamlit/requirements.txt
then cd hr-assistant/streamlit
and run streamlit run agent_streamlit.py
Check history query database employee trong Athena:
Troubleshooting
Bug 1:
Bug: User: arn:aws:iam::your-account-id:user/user-name is not authorized to perform: lambda:GetLayerVersion on resource: arn:aws:lambda:us-east-1:017000801446:layer:AWSLambdaPowertoolsPythonV2:68 because no resource-based policy allows the lambda:GetLayerVersion action (Service: Lambda, Status Code: 403, ..., HandlerErrorCode: AccessDenied)
Solution: Find the line containing arn:aws:lambda:us-east-1:017000801446:layer:AWSLambdaPowertoolsPythonV2:68
in file hr-resources.yml and change the region to where you deploy.
Redeploy and bug
Bug: The script create-hr-resources.sh exits 1 and exit the terminal
Explanation: The script is created for 1 time usage as creating a database and a table. Hence when you redeploy in the same region, make sure to delete all created resources, including the CloudFormation stack. To remove the database in Athena, first delete all data in the table:
Delete table in Amazon Glue:
then run this command:
aws athena start-query-execution --query-string "DROP DATABASE employee" --result-configuration "OutputLocation=s3://<your-accound-id>--hr-resources"
You can check the status of the query in the Athena Console:
If Status Failed, ensure database has no data.
Bug 3:
Error: Runtime.ImportModuleError: Unable to import module 'lambda.index': No module named 'requests' Traceback (most recent call last)
Solution: replace from botocore.vendored import requests
(ref: https://stackoverflow.com/questions/48912253/aws-lambda-unable-to-import-module-lambda-function-no-module-named-requests)
Conclusion
Integrating an AI-powered HR assistant using Amazon Bedrock streamlines internal HR operations by automating repetitive tasks and providing instant, accurate responses to employee queries. This guide demonstrated how to deploy the solution end-to-end—from setting up resources to building a user-friendly Streamlit interface—enabling HR teams to focus on strategic initiatives while improving the employee experience. By leveraging the power of generative AI and scalable AWS services, organizations can create a more efficient, responsive, and modern HR function.
Top comments (0)