An AI creative director powered by Google Gemini that builds evolving story worlds with interleaved text, images, and audio. Built for the Gemini Live Agent Challenge.
Interactive Mythos Director is a web app that:
- Takes a story prompt from the user (character, setting, tone)
- Generates cinematic narrative scenes with Gemini
- Creates visual assets from scene prompts (Imagen)
- Produces voice narration from story scripts (TTS)
- Returns a unified story package per turn (text + media URLs + choices)
The experience is designed like a digital storybook, not a plain chat.
| Layer | Technology |
|---|---|
| Frontend | React |
| Backend | Python (FastAPI) |
| AI SDK | Google GenAI SDK |
| Models | Gemini (logic), Imagen (images), optional Veo (cinematic clips) |
| Deployment | Google Cloud Run (containerized) |
| Storage | Google Cloud Storage (generated assets) |
| Audio | Google Cloud Text-to-Speech |
gen-ai/
βββ README.md # This file
βββ Dockerfile # Cloud Run deployment image
βββ AGENTS.md # Local coding agent instructions
β
βββ backend/
β βββ app/
β β βββ main.py # FastAPI entrypoint, routes
β β βββ director.py # System prompt + orchestration logic
β β βββ media.py # Imagen/TTS integration + GCS upload
β β βββ schemas.py # Request/response models
β βββ requirements.txt
β βββ .env # API keys and config (never commit)
β βββ .env.example
β
βββ frontend/
βββ package.json
βββ vite.config.js
βββ src/
βββ main.jsx
βββ App.jsx # Main app flow
βββ components/
βββ StoryInput.jsx # Prompt + generation controls
βββ SceneCard.jsx # Narrative + image/audio render
βββ ChoiceButtons.jsx # Branching path controls
βββ TimelinePanel.jsx # Session story history
- Python 3.11+
- Node.js 18+
- Google Cloud project with Vertex AI + Cloud Storage enabled
- Service account credentials or local
gcloud auth application-default login
1. Backend setup:
cd backend
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
# Edit .env with your project/config values2. Start backend (port 8000):
cd backend
source .venv/bin/activate
uvicorn app.main:app --reload --port 80003. Frontend setup (new terminal):
cd frontend
npm install
npm run dev4. Open in browser:
http://localhost:5173
Send user prompt and story context to generate the next scene package.
Request:
{
"prompt": "A cyberpunk samurai enters a neon temple.",
"history": [
{ "role": "user", "content": "Start a dark fantasy adventure." },
{ "role": "assistant", "content": "The moon cracked above the iron forest..." }
],
"style": "cinematic"
}Response:
{
"narrative": "Rain hissed against chrome armor as Kael stepped into the temple gate...",
"image_url": "https://storage.googleapis.com/BUCKET/scenes/scene-12.png",
"audio_url": "https://storage.googleapis.com/BUCKET/audio/scene-12.mp3",
"choices": [
"Investigate the altar",
"Challenge the masked guardian",
"Scan for hidden exits"
]
}IDLE -> GENERATING_TEXT -> GENERATING_MEDIA -> RENDERING_SCENE -> WAITING_FOR_CHOICE -> IDLE
| Component | Purpose |
|---|---|
| StoryInput.jsx | Prompt entry, tone selector, generate action |
| SceneCard.jsx | Displays scene text, artwork, and narration player |
| ChoiceButtons.jsx | Branching actions for next turn |
| TimelinePanel.jsx | Scrollable history of generated scenes |
- Narrative Segment: 100-250 words scene text
- Illustration: Generated image from scene description
- Voiceover: Narration audio for accessibility/immersion
- Choices: 2-4 branching options to continue the story
You are the Interactive Mythos Director.
Create immersive, coherent story scenes based on user input.
For each turn, produce:
1) A vivid narrative segment
2) A precise visual description for image generation
3) A clean voiceover script for narration
4) 2-4 meaningful branching choices
Maintain continuity with prior events and avoid contradictions.
docker build -t mythos-director:latest .
docker run -p 8080:8080 \
-e PORT=8080 \
-e GOOGLE_CLOUD_PROJECT=your_project_id \
-e GCS_BUCKET=your_bucket \
mythos-director:latest1. Authenticate and configure project:
gcloud auth login
gcloud config set project YOUR_PROJECT_ID2. Build container in Cloud Build:
gcloud builds submit --tag gcr.io/YOUR_PROJECT_ID/mythos-director3. Deploy to Cloud Run:
gcloud run deploy mythos-director \
--image gcr.io/YOUR_PROJECT_ID/mythos-director \
--platform managed \
--region us-central1 \
--allow-unauthenticated4. Verify service URL:
gcloud run services describe mythos-director --platform managed --region us-central1ββββββββββββββββββββββ
β React Frontend β
β (Vite SPA) β
β StoryInput/SceneUI β
βββββββββββ¬βββββββββββ
β HTTPS
βΌ
/api/generate-scene
β
βββββββββββΌβββββββββββ
β Python Backend β
β (FastAPI on β
β Cloud Run) β
β - GenAI Orchestrator
β - Media Pipeline β
ββββββββ¬ββββββ¬ββββββββ
β β
β βββββββββββββββββ
βΌ βΌ
βββββββββββββββββ βββββββββββββββββ
β Vertex AI β β Cloud Storage β
β Gemini/Imagen β β Scene Assets β
βββββββββββββββββ βββββββββββββββββ
β
βΌ
βββββββββββββββββ
β Cloud TTS β
β Narration MP3 β
βββββββββββββββββ
# backend/.env
GOOGLE_CLOUD_PROJECT=your-project-id
GOOGLE_CLOUD_LOCATION=us-central1
GCS_BUCKET=your-asset-bucket
PORT=8000
ENV=development- React frontend connected to backend API
- Python backend integrated with Google GenAI SDK
- Interleaved multimodal output (text + image + audio)
- Assets uploaded and served from GCS
- Dockerized backend running on Cloud Run
- Architecture diagram finalized
- Demo video recorded (<=4 minutes)
- Public repository and submission page ready
- Verify
gcloud auth application-default loginfor local development - Confirm Vertex AI, Cloud Storage, and Cloud Run APIs are enabled
- Check service account permissions for deployed Cloud Run service
- Ensure
GCS_BUCKETis set correctly - Validate bucket write permissions
- Inspect backend logs for failed upload operations
- Confirm backend is running on
http://localhost:8000 - Check frontend API base URL configuration
- Verify CORS settings in FastAPI
Open source for educational and hackathon use.
- Frontend: React + Vite
- Backend: Python + FastAPI
- AI: Google GenAI SDK (Gemini)
- Media: Imagen + Google Cloud Text-to-Speech
- Cloud: Google Cloud Run + Cloud Storage