Simple Python-Coded AWS AgentCore Educational Project
Бюджет: $30.0
FIXED /
⭐ 4.79 (46)
Canada
amazon-web-services, python
# Simple Python-Coded AWS AgentCore Educational Project
2 days to do
## Project Goal
I want to learn how to use AWS AgentCore for AWS automation.
The freelancer must build a simple educational Python project in which an AWS AgentCore agent automatically moves text files from one Amazon S3 bucket to another by calling AWS Lambda functions.
This must be a small and understandable learning project, not a production system.
## Required AWS Services
The project must use:
* AWS AgentCore
* Amazon S3
* AWS Lambda
* Amazon CloudWatch Logs
* AWS IAM
* Python
* Boto3
## S3 Buckets
The project must create three S3 buckets.
### B1 Source Bucket
B1 contains the original text files.
The project must automatically create many sample text files in B1.
More files may be added to B1 while the agent is running.
The number of files is not known before the process starts.
### B2 Destination Bucket
B2 contains files moved from B1.
A file should be removed from B1 only after it is copied to B2 and successfully verified.
### B3 Agent Log Bucket
B3 stores one global agent log file called LOG.
The agent must append information to this log during every step of the process.
## Required Lambda Functions
The project must include three Python Lambda functions.
### Lambda L1: Copy File
Inputs:
* B1 bucket name
* B2 bucket name
* File name
L1 must:
1. Read the selected file from B1.
2. Calculate the SHA-256 hash of the original file.
3. Copy the file from B1 to B2.
4. Return success or failure.
5. Return the original file hash.
6. Write execution information to CloudWatch Logs.
L1 output must include:
* File name
* Yes or no result
* Original file hash
* Error information when the copy fails
### Lambda L2: Verify File
Inputs:
* B2 bucket name
* File name
* Original file hash returned by L1
L2 must:
1. Read the copied file from B2.
2. Calculate the SHA-256 hash of the copied file.
3. Compare the copied file hash with the original hash from L1.
4. Return whether the hashes are equal.
5. Return the copied file hash.
6. Write verification information to CloudWatch Logs.
L2 output must include:
* File name
* Original hash
* Copied file hash
* Hashes match yes or no
* Error information when verification fails
### Lambda L3: Create a Copy Error
L3 is used only to simulate a failure.
L3 must:
1. Read a copied text file from B2.
2. Remove the last 10 lines.
3. Save the changed file back to B2.
4. Write information about the simulated error to CloudWatch Logs.
The agent must call L3 randomly for some files so that the project can demonstrate how the agent detects a corrupted or incorrectly copied file.
## Agent Workflow
The AWS AgentCore agent must automatically process files without receiving a user request.
The agent must use a while loop.
The loop continues while files exist in B1.
For every loop iteration, the agent must:
1. Check whether files exist in B1.
2. Select one file from B1.
3. Record the selected file name in the global LOG file in B3.
4. Call Lambda L1 to copy the file from B1 to B2.
5. Receive the yes or no result and original file hash from L1.
6. Read the related CloudWatch log entries.
7. Use the CloudWatch log text to decide whether the copy was successful.
8. Compare its text-based conclusion with the structured yes or no result returned by L1.
9. Save both conclusions and the comparison result to the global LOG file in B3.
10. Randomly decide whether to call L3.
11. When L3 is called, intentionally damage the copied file by removing its last 10 lines.
12. Call L2 to calculate the destination hash and compare it with the original hash.
13. Read the L2 CloudWatch logs.
14. Decide whether verification passed.
15. Record the decision, evidence, and result in the global LOG file.
16. If verification succeeds, delete the original file from B1.
17. If verification fails, keep the original file in B1 and record the failure.
18. Continue to the next file.
19. End only when no files remain in B1.
## Dynamic File Requirement
Files may be added to B1 while the agent is running.
The agent must not receive a fixed list of files at the beginning.
At the start of every loop iteration, the agent must inspect B1 again and select one currently available file.
The agent must continue until B1 is empty.
## Agent Decision Requirements
The purpose of the project is to demonstrate that the agent can observe AWS results and make decisions.
The agent must compare two sources of evidence:
* Structured Lambda output
* CloudWatch log text
For example:
* L1 returns yes.
* The agent reads the CloudWatch log.
* The agent concludes from the log whether the operation succeeded.
* The agent compares its conclusion with the L1 result.
* The comparison is saved to the global LOG file.
The project must demonstrate cases where:
* L1 reports a successful copy and the logs support that result.
* L1 reports a failure and the logs explain the failure.
* L3 corrupts a copied file.
* L2 detects that the hashes do not match.
* The agent does not delete the original file from B1 after verification failure.
* The agent continues processing other files.
## Global LOG File
The global LOG file in B3 must document every important step.
For each file, the log must include:
* Timestamp
* File name
* Loop iteration number
* Agent action
* Lambda function called
* Lambda input summary
* Lambda structured output
* CloudWatch log text
* Agent conclusion from the log
* Comparison between Lambda output and agent conclusion
* Original SHA-256 hash
* Destination SHA-256 hash
* Hash comparison result
* Whether L3 was called
* Whether the destination file was corrupted
* Final file status
* Whether the original file was deleted from B1
* Error information
The log must be understandable to a person learning how the agent works.
## Required Test Cases
The freelancer must develop tests for all implemented functionality.
At minimum, the project must demonstrate:
1. A file is copied successfully.
2. The original and destination hashes match.
3. The original file is deleted from B1 only after verification succeeds.
4. L3 removes the last 10 lines from a destination file.
5. L2 detects the hash mismatch created by L3.
6. The agent keeps the original file in B1 after verification fails.
7. The agent reads CloudWatch logs and produces a text conclusion.
8. The agent compares its log-based conclusion with the Lambda structured output.
9. Multiple files are processed one at a time through the while loop.
10. A new file added to B1 during execution is discovered and processed.
The freelancer must add any additional tests needed to test every developed agent function.
## Required Deliverables
### Complete Source Code
Provide all source code, including:
* AWS AgentCore agent
* Python agent loop
* Lambda L1
* Lambda L2
* Lambda L3
* S3 bucket creation
* Sample text-file creation
* IAM policies
* CloudWatch log-reading code
* Global LOG-writing code
* Deployment scripts
* Test scripts
* Cleanup scripts
No AWS passwords, access keys, or secrets may be hardcoded.
### Step-by-Step DOCX Document
Provide a Microsoft Word DOCX file with complete step-by-step instructions.
The document must include a screenshot for every important step.
It must explain:
* How to prepare a Windows laptop
* How to install Python and required packages
* How to configure AWS access
* How to create the project
* How to create the three S3 buckets
* How to develop and deploy L1, L2, and L3
* How to configure IAM permissions
* How to configure CloudWatch Logs
* How to develop the AgentCore agent
* How to implement the while loop
* How the agent reads Lambda outputs
* How the agent reads CloudWatch logs
* How the agent writes the global LOG file to B3
* How to run every test
* How to add files dynamically during execution
* How to inspect the results
* How to troubleshoot errors
* How to delete all created AWS resources
Every important step must include:
* Purpose
* Exact command
* AWS Console location
* Screenshot
* Expected result
* Common errors
### End-to-End Instructional Video
Provide a complete instructional video showing the project being developed from the beginning.
The video must show:
* Creating the project files
* Writing the Python code
* Creating the S3 buckets
* Creating sample text files
* Developing L1
* Developing L2
* Developing L3
* Configuring IAM permissions
* Configuring CloudWatch
* Developing the AgentCore agent
* Implementing the while loop
* Deploying the project
* Running the successful scenario
* Running the corrupted-file scenario
* Reading CloudWatch logs
* Reviewing agent decisions
* Reviewing the global LOG file
* Adding a new file during execution
* Running all tests
* Debugging at least one failure
* Cleaning up all AWS resources
A video showing only the finished project will not be accepted.
The video must teach the development and testing process.
## Acceptance Criteria
The project will be accepted only when:
1. The solution uses AWS AgentCore.
2. The code is written in Python.
3. The solution uses three S3 buckets named logically as B1, B2, and B3.
4. The solution uses three Lambda functions named logically as L1, L2, and L3.
5. The agent processes files automatically without a user request.
6. The agent continues processing while files exist in B1.
7. Files added dynamically to B1 are discovered.
8. L1 copies one file and returns success or failure and the original hash.
9. L2 calculates the destination hash and compares it with the original hash.
10. L3 creates a controlled error by removing the last 10 lines.
11. The agent reads CloudWatch logs for each operation.
12. The agent creates a text-based conclusion from the logs.
13. The agent compares its conclusion with the Lambda structured output.
14. Every step is recorded in the global LOG file in B3.
15. The original file is deleted from B1 only after successful verification.
16. A failed verification leaves the original file in B1.
17. All developed agent functions are tested.
18. I can deploy and run the project in my own AWS account from my Windows laptop.
19. A complete DOCX document with screenshots for every important step is delivered.
20. A complete end-to-end development and testing video is delivered.
21. I can reproduce the complete project by following the DOCX document and video.
Отвори в Upwork