This is a simple serverless agent built with Strands Agents SDK using mem0_memory tool to persist context across different calls.
- Python (v3.12 or later) (for the Python Lambda function)
- Node.js (v20 or later)
- Serverless Framework (v3 or later)
- AWS CLI (v2 or later)
- AWS Account (with IAM permissions to deploy Lambda functions)
- AWS credentials configured on your machine
Run the following commands to set up the project:
npm installUse the Serverless Framework to invoke the function locally. You can use the --data flag to pass a JSON object with action, user_id and content fields.
Use the following command to store the content for a specific user:
sls invoke local -f memory --data '{"content": "I like apples and grapefruit, I do not like oranges and bananas","action":"store","user_id":"1"}'Use the following command to list memories for a specific user:
sls invoke local -f memory --data '{"action":"list","user_id":"1"}'Use the following command to chat with the agent and get a response based on the stored memories for a specific user:
sls invoke local -f memory --data '{"content":"What fruit do i like?","action":"chat","user_id":"1"}'Make sure you have configured your AWS credentials and have the necessary permissions to deploy Lambda functions.
You can read more about configuring AWS credentials in the AWS CLI documentation
or use the aws configure command to set them up interactively.
You can also use serverless framework to set up your AWS credentials by running:
sls config credentials --provider aws --key YOUR_AWS_ACCESS_KEY_ID --secret YOUR_AWS_SECRET_ACCESS_KEYThen, run the following command to deploy the function to AWS:
sls deploy