Skip to content

Experimenting with AutoGen to see if an entire book can be written with AI agents

Notifications You must be signed in to change notification settings

psylsph/ai-book-writer

 
 

Repository files navigation

AI Book Writer

A Python-based system that uses AutoGen to generate complete books through collaborative AI agents. The system employs multiple specialized agents working together to create coherent, structured narratives from initial prompts.

Features

  • Multi-agent collaborative writing system
  • Structured chapter generation with consistent formatting
  • Maintains story continuity and character development
  • Automated world-building and setting management
  • Support for complex, multi-chapter narratives
  • Built-in validation and error handling

Architecture

The system uses several specialized agents:

  • Story Planner: Creates high-level story arcs and plot points
  • World Builder: Establishes and maintains consistent settings
  • Memory Keeper: Tracks continuity and context
  • Writer: Generates the actual prose
  • Editor: Reviews and improves content
  • Outline Creator: Creates detailed chapter outlines

Installation

  1. Clone the repository:
git clone https://https://github.com/psylsph/ai-book-writer.git
cd ai-book-writer
  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Set your API Key
  • Update config.py with your DeepSeek API Key

Usage

  1. Basic usage: python main.py

Configuration

The system can be configured through config.py. Key configurations include:

  • LLM endpoint URL
  • LLM API Key

Output Structure

Generated content is saved in the book_output directory:

book_output/
├── outline.txt
├── chapter_01.txt
├── chapter_02.txt
└── ...

Requirements

  • Python 3.8+
  • AutoGen 0.2.0+
  • Other dependencies listed in requirements.txt

Development

To contribute to the project:

  1. Fork the repository
  2. Create a new branch for your feature
  3. Install development dependencies:
pip install -r requirements.txt
  1. Make your changes
  2. Run tests:
pytest
  1. Submit a pull request

Error Handling

The system includes robust error handling:

  • Validates chapter completeness
  • Ensures proper formatting
  • Maintains backup copies of generated content
  • Implements retry logic for failed generations

Limitations

  • Requires significant computational resources
  • Generation time increases with chapter count
  • Quality depends on the underlying LLM model
  • May require manual review for final polish

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Built using the AutoGen framework
  • Inspired by collaborative writing systems

About

Experimenting with AutoGen to see if an entire book can be written with AI agents

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%