Skip to content

This is a demo application of supervisor + tool call architecture pattern of agentic ai. This script generates stories appropriate for ages 5-10 with the ability to modify the story, rename characters, change the setting, etc. Primary purpose is to demonstrate agentic task execution using crewai

Notifications You must be signed in to change notification settings

suraj-phanindra/Childrens-Story-Generator-Agentic-Demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Interactive Children's Storytelling System - User Guide

๐ŸŒŸ Overview

The Interactive Children's Storytelling System is an AI-powered storytelling application designed for children ages 5-10. It creates safe, engaging, and educational stories that adapt to user preferences and feedback in real-time.

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.8 or higher
  • OpenAI API key
  • Virtual environment (recommended)

Installation

  1. Clone or download the project files

    main.py
    requirements.txt
    README.md
    
  2. Set up a virtual environment (recommended)

    python -m venv .venv
    .venv\Scripts\Activate.ps1  # On Windows
    source .venv/bin/activate    # On macOS/Linux
  3. Install dependencies

    pip install -r requirements.txt
  4. Set up your OpenAI API key

    • Get an API key from OpenAI Platform
    • Create a .env file in the project directory
    • Add your API key: OPENAI_API_KEY=your_api_key_here
  5. Run the application

    python main.py

๐Ÿ“– How to Use

Starting a Story

  1. Launch the application

    python main.py
  2. Enter your story request

    • The system will ask: "What kind of story would you like to hear?"
    • Examples:
      • "A story about a brave little mouse"
      • "A magical adventure in a forest"
      • "A story about friendship and sharing"
      • "A Hindu mythological story about Prahlada and Narasimha"
  3. Wait for story generation

    • The system will generate and validate the story for safety
    • It may take a few moments to create the perfect opening

Interactive Story Options

After the story begins, you'll see a menu with 9 options:

๐Ÿ“š What would you like to do next?
1. Continue the story
2. End the story here
3. Continue with a suggestion
4. Request changes to the story
5. Change story tone or style
6. Add a new character
7. Change the setting
8. Start a new story
9. Exit the system

Option 1: Continue the Story

  • The system continues the story naturally
  • Maintains character consistency and plot flow
  • Adds new story segments automatically

Option 2: End the Story

  • Creates a satisfying conclusion
  • Wraps up all plot threads
  • Provides a positive ending message

Option 3: Continue with a Suggestion

  • You can suggest what happens next
  • Examples:
    • "The character finds a magical key"
    • "They meet a friendly dragon"
    • "They solve the puzzle together"

Option 4: Request Changes to the Story

  • Make any type of change to the existing story
  • Examples:
    • "Make the character braver"
    • "Add more magic to the story"
    • "Make it more exciting"
    • "Change character names"

Option 5: Change Story Tone or Style

  • Modify how the story is told
  • Examples:
    • "Make it more funny"
    • "Make it more magical"
    • "Make it more adventurous"
    • "Make it more educational"

Option 6: Add a New Character

  • Introduce new characters to the story
  • Examples:
    • "Add a wise owl"
    • "Add a friendly robot"
    • "Add a magical fairy"

Option 7: Change the Setting

  • Move the story to a different location
  • Examples:
    • "Change it to a space station"
    • "Move it to an underwater city"
    • "Set it in a magical forest"

Option 8: Start a New Story

  • Begin a completely fresh story
  • Resets all characters, setting, and plot
  • Prompts for a new story request
  • Perfect for when you want to try something completely different

Option 9: Exit the System

  • Safely exit the storytelling system
  • Saves your current session
  • Displays a friendly goodbye message

๐Ÿ›ก๏ธ Safety Features

The system includes multiple safety measures:

  • Age-Appropriate Content: All content is validated for children ages 5-10
  • Content Filtering: Stories are checked for inappropriate themes
  • Positive Messaging: Promotes good values and behaviors
  • Educational Value: Includes learning opportunities
  • Safe Language: Uses simple, clear language appropriate for young readers

๐Ÿ”ง Technical Features

Rate Limiting

  • Built-in retry logic with exponential backoff
  • Handles OpenAI API rate limits gracefully
  • Automatic waiting between requests

Error Handling

  • Graceful error recovery
  • Fallback content if generation fails
  • Clear error messages for users

Story State Management

  • Tracks characters, setting, and theme
  • Maintains story continuity
  • Preserves user choices and modifications

๐Ÿ“ Example Session

๐ŸŒŸ Welcome to the Interactive Children's Storytelling System! ๐ŸŒŸ
I'll create a safe, engaging story just for you!
------------------------------------------------------------
What kind of story would you like to hear? A story about a brave little mouse

๐ŸŽฏ Creating a story about: A story about a brave little mouse
โณ Generating and checking story safety...

============================================================
๐Ÿ“– YOUR STORY BEGINS:
============================================================
Once upon a time, there was a brave little mouse named Max who lived in a cozy burrow under an old oak tree...

============================================================
๐Ÿ“š What would you like to do next?
1. Continue the story
2. End the story here
3. Continue with a suggestion
4. Request changes to the story
5. Change story tone or style
6. Add a new character
7. Change the setting
============================================================
Your choice (1-9): 3

What would you like to happen next? Max finds a magical acorn

โณ Adding your idea: Max finds a magical acorn

============================================================
๐Ÿ“– STORY CONTINUES:
============================================================
As Max continued his journey, he noticed something special on the forest floor...

๐ŸŽฏ Best Practices

For Parents and Educators

  • Supervise young children while using the system
  • Discuss the stories with children to enhance learning
  • Use the change features to customize stories for specific lessons
  • Encourage creativity by letting children suggest story elements

For Children

  • Be specific when making suggestions
  • Try different options to explore storytelling
  • Ask for changes if you want something different
  • Have fun experimenting with different story elements
  • Start fresh when you want a completely new adventure
  • Exit safely when you're done with your storytelling session

๐Ÿ” Troubleshooting

Common Issues

"Rate limit reached" error

  • Wait a few minutes and try again
  • The system includes automatic retry logic

"API key not found" error

  • Check that your .env file exists
  • Verify your OpenAI API key is correct
  • Ensure the .env file is in the project directory

Story generation fails

  • The system will use fallback content
  • Try again with a different story request
  • Check your internet connection

Getting Help

  • Ensure all dependencies are installed correctly
  • Check that your OpenAI API key is valid and has credits
  • Verify you're using Python 3.8 or higher

๐ŸŽจ Customization

The system is designed to be flexible and adaptable:

  • Story Themes: Request any type of story (adventure, friendship, learning, etc.)
  • Character Types: Add any kind of character (animals, magical beings, robots, etc.)
  • Settings: Change to any location (forest, space, underwater, etc.)
  • Tones: Modify the storytelling style (funny, serious, magical, etc.)

๐Ÿ“š Educational Benefits

This system supports learning in multiple ways:

  • Language Development: Exposure to rich vocabulary and storytelling
  • Creativity: Encourages imaginative thinking and story creation
  • Critical Thinking: Interactive choices help develop decision-making skills
  • Values Education: Stories promote positive behaviors and moral lessons
  • Engagement: Interactive elements maintain attention and interest

๐Ÿ”ฎ Future Enhancements

The system is designed for future expansion:

  • Character personality persistence
  • Enhanced safety monitoring
  • Story export functionality
  • Audio narration capabilities
  • Multi-language support

Enjoy your storytelling adventure! ๐ŸŒŸ

About

This is a demo application of supervisor + tool call architecture pattern of agentic ai. This script generates stories appropriate for ages 5-10 with the ability to modify the story, rename characters, change the setting, etc. Primary purpose is to demonstrate agentic task execution using crewai

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages