
Weekend Creative Agent Challenge: InkAgent - A Small Writer That Learns From Its Past
Every day, the writer opens the notebook, looks at what it wrote before, and then tries to write something different. That is what my Creative Agent does. It creates a short original story, remembers its previous stories, and uses that history when creating the next one.
I am very new to AWS.
Before this challenge, I had used AWS Lambda before, so Lambda was not completely new to me.
But Amazon Bedrock and Amazon Bedrock AgentCore were new.
That is one of the reasons I decided to take part in this challenge.
I wanted to build something small enough that I could understand, but interesting enough that it would make me learn new AWS services.
So I built InkAgent.
The idea is simple.
Imagine giving a little writer a notebook.
Every day, the writer opens the notebook, looks at what it wrote before, and then tries to write something different.
That is what my Creative Agent does.
It creates a short original story, remembers its previous stories, and uses that history when creating the next one.
What does InkAgent do?
Creative Agent creates an original micro-story from a creative prompt.
The output contains:
titlegenrethemestorycreative_notesBut I didn't want it to simply generate a random story every time.
I wanted it to have a small memory.
For example, if it already created several stories about lighthouses and historical fiction, I want the next story to have a chance of going somewhere else.
So I give the agent its previous creative history and tell it to look for a different direction.
The goal is not to make the agent "remember" like a human.
It is much simpler.
It has a notebook.
The notebook is my
history.json file stored in Amazon S3.
How I built it
Step 1 - I started with Python
I created a Python application for my agent.
The main application is
main.py .I used the Amazon Bedrock AgentCore Python SDK and created an AgentCore Runtime entry point.
The agent receives a prompt, sends the creative instructions and history to Amazon Bedrock, and returns the generated story.
Step 2 - I gave the agent its creative instructions
I used Amazon Bedrock with Amazon Nova 2 Lite to generate the stories.
I created a system prompt that explains what a Creative Agent should do.
For example, I told it:
- create original stories
- avoid copying existing stories
- try different genres
- try different themes
- use sensory details
- avoid predictable endings
- look at previous creations
- avoid repeating the same creative patterns
I also asked the model to return JSON.
That makes the result much easier for my Python application to handle.
Step 3 - I added memory with Amazon S3
At the beginning, my
history.json file was stored locally on my computer.That was fine for testing.
But I realized that my deployed AWS application could not depend on a file sitting on my laptop.
So I created an Amazon S3 bucket and moved the history there.
The flow became:
S3 history.json ↓The Agent reads it ↓Nova creates a new story ↓New story is added ↓Updated history.json goes back to S3Now the history can stay with the application even when the agent is running in AWS.
I also keep the history limited to recent creations so that the prompt does not grow forever.
Step 3 - Fun Part..Deploying to AgentCore
This was one of the biggest learning parts for me.
I had already tested my Python application locally.
Then I wanted to put it inside AWS.
I used the AgentCore CLI and
uv for the Python project and dependencies.My first deployment did not work.
The CloudFormation stack started creating resources, IAM roles were created, and then the AgentCore Runtime failed.
The error said:
OpenTelemetry instrumentation executable not found.At first, this was confusing.
But I learned something important.
A Python program working on my computer does not automatically mean that every dependency will be included in the AWS deployment package.
I fixed the project dependencies, ran
uv sync , and deployed again.After that, Creative Agent successfully ran inside AgentCore Runtime.
That was a very exciting moment for me because AgentCore was completely new to me.
AWS documents AgentCore Runtime as a way to deploy and invoke agents using the AgentCore Runtime APIs and endpoints.
Step 3 - Finally!! I connected Lambda
I had used Lambda before, so this part felt a little more familiar.
I created a Lambda function called
InkLoopScheduler during development, which I later treated as the scheduler bridge for Creative Agent.The Lambda receives a simple JSON payload:
{ "prompt": "Create today's creative story..."}It then calls the AgentCore Runtime.
The Lambda needed permission to perform:
bedrock-agentcore:InvokeAgentRuntimeThis was another important lesson for me.
I initially received an
AccessDeniedException .I had to learn which IAM role was actually making the request and which resource it needed to access.
After fixing the permission, Lambda successfully called my AgentCore Runtime.
AgentCore's
InvokeAgentRuntime API requires the appropriate bedrock-agentcore:InvokeAgentRuntime permission.
Step 3 - Added auto scheduling
I did not want to manually run my agent every day.
So I created an Amazon EventBridge Scheduler.
Now the process can start automatically.
The Scheduler sends the prompt to Lambda.
Lambda invokes AgentCore.
AgentCore runs Creative Agent.
Creative Agent asks Nova to create the story.
The agent reads and updates the history in S3.
The complete flow is:
EventBridge Scheduler │ ▼ Lambda │ ▼ AgentCore Runtime │ ▼ Amazon Nova 2 Lite │ ┌─────────┴─────────┐ ▼ ▼ Read history Create story ▲ │ │ ▼ └──────── S3 ◄──────┘Now the agent does not need me sitting in front of my computer.
It can wake up when the schedule says it is time to write.
The AWS services I used
My project currently uses:
AWS service | What I use it for |
|---|---|
Amazon Bedrock | Accessing the foundation model |
Amazon Nova 2 Lite | Creating the stories |
Amazon Bedrock AgentCore Runtime | Running my deployed agent |
AWS Lambda | Connecting the Scheduler to AgentCore |
Amazon EventBridge Scheduler | Automatically starting the workflow |
Amazon S3 | Storing history.json |
AWS IAM | Controlling permissions |
Amazon CloudWatch | Checking logs and debugging |
AWS CloudFormation/CDK | Creating some of the AWS infrastructure |
What I learned as a beginner
For me, this challenge was not only about building an AI agent.
It was also an AWS learning experience.
I am still very new to AWS.
I had used Lambda previously, but Bedrock and AgentCore were completely new to me.
The biggest thing I learned was IAM.
Before this project, IAM roles and policies looked much more complicated to me.
During this project, I had to understand questions like:
Who is making this request?
Which role is being used?
What AWS action is being requested?
Which resource is being accessed?
For example, my Lambda needed permission to invoke my AgentCore Runtime.
My AgentCore Runtime needed permission to access my S3 history.
The EventBridge Scheduler needed permission to invoke Lambda.
These were three different relationships.
Seeing them work together helped me understand IAM much better.
I also learned that AWS error messages can actually teach you what is wrong.
My OpenTelemetry deployment error taught me about deployment dependencies.
My
AccessDeniedException taught me about IAM.My S3 permission error taught me that even something as simple as reading one file can require several different permissions.
What I have now
I started with a Python program that created stories on my computer.
Now I have:
Ink Agent │ ├── Amazon Bedrock ├── Amazon Nova 2 Lite ├── AgentCore Runtime ├── AWS Lambda ├── EventBridge Scheduler ├── Amazon S3 ├── IAM └── CloudWatchThe most satisfying part is that the agent can now run without me manually starting it.
It can receive its scheduled prompt, create a new story, and save the updated creative history.
For me, that is what made this feel like an actual agent, rather than just a Python script calling an AI model.
How to build the same project
If someone wants to build a similar project, I would suggest doing it in this order:
1. Create an AWS account2. Create a Python project3. Set up uv and pyproject.toml4. Install AgentCore and Bedrock dependencies5. Write the Creative Agent6. Test the Bedrock model call locally7. Create an S3 bucket8. Move history.json from local storage to S39. Give the AgentCore execution role S3 permissions10. Deploy the agent to AgentCore Runtime11. Test the deployed runtime12. Create a Lambda function13. Give Lambda permission to invoke AgentCore14. Test Lambda → AgentCore15. Create an EventBridge Scheduler16. Give Scheduler permission to invoke Lambda17. Test the scheduled workflow18. Check CloudWatch logs19. Check history.json in S3I would recommend doing these one at a time.
That is what helped me.
When I tried to think about everything at once, AWS felt huge.
When I treated each part like a small Lego piece, it became much easier to understand.
Final thought
I started this challenge as someone who was still very new to AWS.
I already knew a little Lambda, but Bedrock, AgentCore, IAM policies, S3-based memory, and EventBridge Scheduler were new territory for me.
The challenge gave me a reason to learn all of them by actually building something.
The result is InkAgent - a small creative writer that can run in AWS, remember its previous work, and wake up automatically to create something new.
And I think that is my favorite part.
I didn't just learn how to make an AI generate a story.
I learned how to give that little writer a place to live, a notebook to remember things, a clock to wake it up, and the permissions it needs to do its job.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article