Transforms classic literature into personalized, illustrated stories adapted for different audiences using Google's Agent Development Kit (ADK).
Classic literature contains timeless stories but faces modern challenges:
- Dense Victorian prose makes stories inaccessible
- Same text given to all age groups without adaptation
- Visual engagement expected by modern readers
- Significant time investment to read full texts
Solution: Multi-agent system that personalizes classics by adapting vocabulary, tone, length, and adding AI-generated illustrations while preserving core themes.
10-agent system with nested Sequential and Loop workflows:
StoryCrafterAgent (Root Orchestrator)
├── LibraryAgent (Book discovery)
├── PersonalizationAgent (User preferences)
└── StoryCreationPipeline (SequentialAgent)
├── RobustStoryGenerator (LoopAgent - max 2 iterations)
│ ├── StoryTellerAgent (Story generation)
│ └── QualityCheckerAgent (Quality validation)
├── IllustrationAgent (Image generation)
└── FormatterAgent (Output formatting)
- 10-agent orchestration with nested workflow patterns
- Quality-driven generation with objective validation metrics
- Personalized storytelling for different ages and preferences
- AI-generated illustrations with Airbrush.ai integration
- File-based memory with 5 pre-cached classic books
- Graceful error handling for external API failures
- Tool-based control flow for dynamic agent behavior
- Production-quality output as formatted markdown
- Offline capability with pre-cached book data
- Bounded execution with configurable iteration limits
- Framework: Google Agent Development Kit (ADK)
- LLM Models: Gemini 2.0 Flash (orchestration), Gemini 2.5 Pro (storytelling)
- Agent Patterns: SequentialAgent, LoopAgent, nested workflows
- Image Generation: Airbrush.ai API (optional)
- Memory: File-based caching with JSON
- Runtime: FastAPI with uvicorn
- Python: 3.10+
story_crafter_agent/
├── __init__.py # Package initialization
├── agent.py # Root StoryCrafterAgent orchestrator
├── fast_api_app.py # FastAPI web service
├── sub_agents/ # Domain-specific agents
│ ├── library_agent.py # Book discovery
│ ├── personalization_agent.py # User preferences
│ ├── storyteller_agent.py # Story generation
│ ├── illustration_agent.py # Image generation
│ └── formatter_agent.py # Output formatting
├── tools/ # Custom tools
│ ├── library_tools.py
│ ├── personalization_tools.py
│ ├── storyteller_tools.py
│ ├── image_generation_tools.py
│ └── formatting_tools.py
├── prompts/ # Agent system prompts
│ ├── root_agent_mvp.md
│ ├── storyteller_agent.md
│ └── formatter_agent.md
└── cache/ # Pre-cached data
├── books/ # Classic book texts
└── exports/ # Generated exports
- Python 3.10+
- Google API Key (for Gemini models)
# Clone repository
git clone https://github.com/yourusername/story-crafter-agent.git
cd story-crafter-agent
# Install dependencies
pip install -e .
# Configure environment
cp .env.example .env
# Edit .env and add your GOOGLE_API_KEYfrom google.adk.runners import InMemoryRunner
from story_crafter_agent.agent import root_agent
runner = InMemoryRunner(agent=root_agent)
events = await runner.run_debug("Show me available books")python -m story_crafter_agent.fast_api_app
# Visit http://localhost:8086/docsCreate a .env file with:
# Required - Choose ONE authentication method:
# Option 1: Gemini API (free tier, rate limited)
GOOGLE_API_KEY=your-gemini-api-key
# Option 2: Vertex AI (paid quota, recommended for production)
GOOGLE_GENAI_USE_VERTEXAI=True
GOOGLE_CLOUD_PROJECT=your-gcp-project-id
GOOGLE_CLOUD_LOCATION=us-central1
# Optional - image generation
AIRBRUSH_API_KEY=your-airbrush-key
AIRBRUSH_BASE_URL=https://api.airbrush.aiNote: If you experience 429 RESOURCE_EXHAUSTED errors with Vertex AI, see VERTEX_AI_SETUP.md for configuration troubleshooting.
- StoryCrafterAgent greets user and coordinates workflow
- LibraryAgent lists 5 available classic books
- PersonalizationAgent collects user preferences:
- Target audience (age group)
- Tone (whimsical, serious, etc.)
- Length preference (short, medium, long)
- Originality level (0.0-1.0)
- StoryCreationPipeline executes sequentially:
- RobustStoryGenerator (LoopAgent) with quality validation
- IllustrationAgent generates images for story sections
- FormatterAgent formats output as markdown
- Final story saved with timestamp
Includes 5 pre-cached classic books:
- Moby-Dick by Herman Melville (Adventure)
- Pride and Prejudice by Jane Austen (Romance)
- Alice's Adventures in Wonderland by Lewis Carroll (Fantasy)
- Frankenstein by Mary Shelley (Gothic Horror)
- The Adventures of Sherlock Holmes by Arthur Conan Doyle (Mystery)
pytest story_crafter_agent/tests/pip install build
python -m build- Multi-agent orchestration with 10 specialized agents
- Sequential workflow for ordered execution
- Loop workflow with quality-based exit conditions
- Nested workflows (Sequential + Loop)
- Tool context integration for dynamic control
- Custom domain-specific tools
- External API integration via MCP
- Long-term memory via file-based caching
- Error resilience with graceful degradation
- Bounded execution with configurable limits
- Parallel agent patterns for concurrent processing
- Session management for extended interactions
- Context optimization for longer conversations
- Expanded book library from Project Gutenberg
- Multi-language support
- Audio narration capability
- Web UI for interactive story creation
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
Apache License 2.0 - See LICENSE file for details
Built with Google Agent Development Kit (ADK)