Building DreamCanvas: An AI Agent That Imagines a New World Every Day
10 Days of Building AI Agents on AWS | Day 10
Tag: #agents
DreamCanvas is an always-on AI creative agent that imagines a new fictional world every day before you even open the app.
Vision: Creativity That Does Not Wait
Most creative applications wait for a user to open them, enter a prompt, and request something new.
I wanted to explore a different idea:
What if a creative application could continue creating even when nobody was actively using it?
That idea became DreamCanvas.
DreamCanvas is an autonomous AI creative agent that generates a brand-new fictional world every day.
Instead of opening an application and asking an AI to imagine something, the user can return later and discover that a completely new world has already been created.
The experience is simple:
You leave → DreamCanvas keeps working → You return → A new world is waiting
The goal was to create an experience where inspiration is already waiting.
What Does DreamCanvas Create?
Each generated world has its own identity and creative details.
A world can include:
- Unique world name
- Genre
- Atmosphere
- Tagline
- World overview
- Environment
- Inhabitants
- A special rule of the universe
- Main conflict
- A surprising discovery
- A story seed that could become the beginning of a larger story
This means DreamCanvas does not simply generate a short idea or random paragraph.
It creates the foundation of an entirely new fictional universe.
Every day, the agent has the opportunity to create something completely different.
One day, it might imagine a civilization living beneath an endless ocean.
The next day, it could create a city where memories are traded as currency.
Another day, it might imagine a forgotten kingdom floating between planets.
The user does not need to ask for these worlds.
They are already waiting.
The Always-On Agent Workflow
DreamCanvas works differently:
User leaves
↓
EventBridge wakes the agent automatically
↓
Agent checks recent worlds
↓
Agent remembers previous creative directions
↓
Agent chooses a different direction
↓
Groq generates a new fictional world
↓
Lambda validates the response
↓
World is stored in DynamoDB
↓
User returns later
↓
A new world is already waiting
The application does useful creative work without waiting for a user to request it.
That is the main idea I wanted to explore.
Lightweight Agent Memory
One of the important features of DreamCanvas is memory.
Before generating a new world, the agent retrieves recent creations from Amazon DynamoDB.
The recent worlds provide context such as:
- Previous world names
- Genres
- Atmospheres
- Settings
- Main concepts
- Inhabitants
- Conflicts
- Summaries
This information is provided to the AI during the next generation.
The agent is instructed to avoid repeating similar creative directions.
For example, if recent worlds have focused on:
- Futuristic cities
- Fantasy kingdoms
- Dark mysterious worlds
The next generation can be encouraged to explore something meaningfully different.
Perhaps:
- A peaceful alien ecosystem
- A world inside a living machine
- A civilization existing in people's dreams
- An ancient world where time moves differently
This gives DreamCanvas a lightweight form of memory.
I deliberately did not use a vector database or a complicated AI framework.
For this use case, recent DynamoDB records provide enough context to influence future generations while keeping the architecture simple.
This was an important design decision.
Not every AI agent needs a complex memory system. Sometimes remembering the most recent actions is enough.
How I Built It
I intentionally kept the project architecture simple and focused.
Frontend
The frontend uses:
- HTML
- CSS
- Vanilla JavaScript
I did not use a large frontend framework because the main purpose of the project was to demonstrate the always-on AI agent architecture.
The website allows users to:
- View today's generated world
- Explore complete world details
- Browse previously imagined worlds
When the user opens the application, the frontend requests the latest generated world from the backend.
Because the autonomous workflow has already run, the new world is ready to display.
The Autonomous Backend
The most important part of DreamCanvas runs on AWS.
An Amazon EventBridge schedule automatically wakes the agent every day.
The scheduled event invokes an AWS Lambda function.
The workflow begins with an important check.
Step 1: Check for Today's World
Lambda first checks whether a world has already been generated for the current day.
This makes the workflow idempotent.
Has today's world already been created?
YES → Stop
NO → Continue generation
This prevents accidental duplicate generations and unnecessary AI API usage.
Step 2: Retrieve Recent Memory
If no world exists for the current day, Lambda retrieves several recent worlds from Amazon DynamoDB.
These records act as the agent's memory.
Step 3: Choose a New Creative Direction
The recent worlds are used as context.
The AI is instructed to create something meaningfully different from recent generations.
The goal is not simply randomness.
The goal is informed variety.
The agent knows what it recently created and uses that information when creating something new.
Step 4: Generate the World
Lambda sends the creative context to the AI through the Groq API.
Groq acts as the creative generation engine.
Step 5: Validate the AI Response
The backend does not blindly store the AI response.
The Lambda validates the generated data before saving it.
This is important because the application expects structured information.
The validation checks that the required data exists and that the response can be safely processed.
If the AI response is malformed, the application handles the problem safely and can retry generation rather than storing invalid data.
Step 6: Save the New World
Once validation succeeds, the new world is stored in Amazon DynamoDB.
The generated world then becomes available through the application's API.
When the user returns later, the frontend can immediately display it.
Separating AI Generation from Infrastructure
One of the key architectural decisions was separating the AI generation service from the always-on application infrastructure.
Groq handles creative AI generation.
AWS handles:
- Scheduling
- Serverless execution
- Storage
- API access
- Security
- Logging
- Monitoring
- Deployment
The separation looks like this:
AWS EventBridge
↓
AWS Lambda
↓
DynamoDB Memory
↓
Groq API
↓
AWS Lambda Validation
↓
DynamoDB Storage
This allows the application to combine an external AI model with AWS serverless infrastructure.
AWS Services Used
DreamCanvas uses a lightweight serverless architecture built with the following AWS services.
AWS Lambda
AWS Lambda runs the DreamCanvas agent and backend API logic.
It handles:
- Daily world generation
- Checking for duplicates
- Retrieving recent worlds
- Preparing AI prompts
- Calling the Groq API
- Validating responses
- Storing new worlds
- Serving API requests
Amazon EventBridge
Amazon EventBridge automatically triggers the DreamCanvas agent every day.
This is what transforms the project from a normal AI application into an always-on system.
The user does not need to press a button.
The scheduled event wakes the agent automatically.
Amazon DynamoDB
Amazon DynamoDB stores the generated fictional worlds.
It also acts as lightweight agent memory.
Before creating a new world, the agent retrieves recent records and uses them as context to avoid repetitive output.
Amazon API Gateway
Amazon API Gateway provides API endpoints for the frontend.
The frontend can use these endpoints to:
- Retrieve today's world
- Browse previous worlds
- View individual world details
Amazon S3
Amazon S3 hosts the static frontend.
The frontend consists of:
- HTML
- CSS
- JavaScript
AWS Secrets Manager
AWS Secrets Manager securely stores the Groq API key.
The key is never exposed in browser code or committed to the repository.
The Lambda backend retrieves the secret using AWS permissions.
The security flow looks like this:
Frontend
↓
API Gateway
↓
Lambda
↓
Secrets Manager
↓
Retrieve Groq API Key
↓
Groq API
Amazon CloudWatch
Amazon CloudWatch provides logs and monitoring.
It helps monitor:
- Scheduled generation events
- Lambda execution
- Validation failures
- API errors
- Application debugging
AWS SAM
I used AWS SAM to define and deploy the serverless infrastructure.
SAM uses AWS CloudFormation underneath and makes it easier to define serverless resources as infrastructure as code.
This means the AWS environment can be deployed consistently from the project instead of manually creating resources one by one.
DreamCanvas is an always-on AI creative agent that remembers recently imagined worlds, automatically creates a new one every day using Groq, and uses AWS serverless services to make sure the next world is waiting before the user even opens the application.
App and Source Code
Live App:
[http://dreamcanvas-frontend-305218268847-us-east-1.s3-website-us-east-1.amazonaws.com/]
Top comments (0)