Project Story: Lucky's Dream Weaver
The Vision: A Storybook That Never Ends
Our journey began with a simple, heartfelt idea: to create a magical, never-ending storybook for children. We envisioned a world where every day, a new adventure of "Lucky the puppy" and his friends would come to life, complete with its own unique illustration. We didn't just want to build a content generator; we wanted to build an automated artist, a digital storyteller that could spark imagination daily. This vision became "Lucky's Dream Weaver," an AI-powered storytelling engine.
Chapter 1: The Architecture - A Symphony of Agents
To bring this vision to life, we designed a fully autonomous, event-driven multi-agent system on Google Cloud, adhering to the principles of the Agent Development Kit (ADK). Our system is a digital assembly line for creativity, where each agent is a specialized worker that performs its task and then passes the product to the next in line via Cloud Pub/Sub.
Agent 1: The Bard (The Storyteller): The process begins every morning, triggered by Cloud Scheduler. This agent's sole purpose is to create. It reads a simple prompt from a Google Sheet, calls the Google AI Gemini API to expand it into a charming, short story, and then publishes this narrative to a Pub/Sub topic, ready for the next stage.
Agent 2: The Artist (The Illustrator): Listening to the first topic, this agent awakens upon receiving a new story. It embodies a creative "hybrid-brain" approach we developed to overcome technical challenges. It first uses the Google AI Gemini API as a "prompt engineer" to convert the story into a rich, descriptive visual prompt. Then, it uses its Vertex AI connection to call the powerful Imagen model, generating a beautiful, unique illustration that captures the essence of the story. Its final act is to save this masterpiece to a Google Cloud Storage bucket and publish a new message containing the story and the image's location to a second Pub/Sub topic.
Agent 3: The Publisher (The AI Web Designer): The final agent in our pipeline, structured using the ADK
Agentclass. This agent doesn't just execute; it thinks. It "perceives" the content of the story it receives, using Gemini to analyze its mood and emotional tone. Based on this analysis, it autonomously decides on a visual theme (e.g., 'calm_river', 'sunset_forest') from a predefined collection. It then acts on this decision, generating a new HTML page with a unique background, color scheme, and effects that match the story's feeling, before publishing the final webpage to our Google Cloud Storage static site.
Chapter 2: The Tech Stack - Our Tools of Creation
Our entire system is built on a modern, serverless Google Cloud stack, chosen for its scalability, reliability, and powerful AI capabilities:
- Compute: Google Cloud Run for serverless, containerized agent deployment.
- Orchestration: Cloud Pub/Sub for creating a resilient, decoupled, and event-driven agent communication backbone.
- AI Models: The flexible Google AI API (Gemini 1.5 Flash) and the powerful Vertex AI API (Imagen & Gemini 1.0 Pro).
- Storage & Hosting: Google Cloud Storage for both asset storage and high-performance static website hosting.
- Security & Automation: Google Cloud Secret Manager for best-practice API key management, IAM for granular permissions, and Cloud Scheduler for daily automation.
- Development & Deployment: Docker, Artifact Registry, and Google Cloud Build for an optimized, rapid CI/CD workflow.
- Core Framework: The Google Agent Development Kit (ADK) principles, with the final agent explicitly structured using the
adk.agents.Agentclass.
Chapter 3: The Journey - Challenges & Breakthroughs
Our development journey was a true hackathon experience, filled with challenges that forced us to learn and adapt under pressure.
The Build-Time Dragon: Our initial builds took over 20 minutes, crippling our ability to iterate. We solved this by pivoting to a Docker-based workflow. By building our images with optimized, multi-stage Dockerfiles and pushing them to Artifact Registry, we slashed deployment times to under 2 minutes, a game-changing optimization.
The Stubborn 404 Error: Our biggest hurdle was a persistent
404 Not Founderror when trying to access Vertex AI models from our original project. After exhausting all options, we confirmed it was a project-level access issue. This led to two key breakthroughs:- The Hybrid Agent: We engineered a creative workaround for the Illustrator Agent, using two different authentication methods (API Key for one service, Service Account for another) within the same function.
- The Final Fix: We made the bold decision to migrate the entire project to a new, clean Google Cloud project, which ultimately resolved all underlying access issues.
The "Agent vs. Function" Dilemma: Near the end, we realized our final agent was merely executing a task. We challenged ourselves to make it "smarter." This led to the final, and most rewarding, refactor: using the ADK structure and empowering the agent to analyze the story's mood and make its own design decisions, truly fulfilling the "intelligent agent" concept.
Chapter 4: What We Learned
This project was an intense and invaluable learning experience:
- The Power of Decoupling: Using Pub/Sub was a lifesaver, allowing us to build, test, and debug each agent independently before connecting them.
- Pragmatism Under Pressure: Knowing when to find a creative workaround versus when to solve a root problem is crucial. Our "hybrid agent" and static site pivot were key to finishing on time.
- A Solid Workflow is Non-Negotiable: The move to a local testing and Docker-based deployment workflow was as important as any AI model we used.
- An Agent is Defined by its Autonomy: The most satisfying part of the project was giving our final agent the ability to make its own creative decisions, transforming it from a simple script into a true AI agent.
Ultimately, Lucky's Dream Weaver is more than just a content pipeline; it's a testament to the power of modern cloud architecture and the creative potential of multi-agent AI systems.
Diagram
(START)
|
[ Cloud Scheduler ] --(1. HTTP Trigger)--> [ Agent 1: Storyteller ] --(2. Reads/Writes)--> [ Google Sheets ]
|
V (3. Publishes story)
[ Pub/Sub Topic: 'image_requests' ]
|
V (4. Event Trigger)
[ Agent 2: Illustrator ] --------------------------------------------+
| |
+--(5a. Uses Gemini for prompt via)--> [ Google AI API ] |
| (w/ key from Secret Manager) |
| |
+--(5b. Uses Imagen for image via)--> [ Vertex AI ] |
| |
V (6. Saves image to) |
[ Google Cloud Storage ] <-------------------------------------------+ (8b. Saves HTML to)
|
V (7. Publishes story + image path)
[ Pub/Sub Topic: 'publishing_requests' ]
|
V (8. Event Trigger)
[ Agent 3: Web Publisher (ADK) ]
|
+--(8a. Uses Gemini for theme via)--> [ Google AI API ]
|
V
(Updates Website)
|
V
[ End User ] <---(9. Browses Website)--- [ GCS Static Website ]
|
(END)
Built With
- adk
- gcp
- python
- vertex

Log in or sign up for Devpost to join the conversation.