2026-03-12 17:44:51 +00:00
# Opus Orchestrator AI
2026-03-14 01:17:51 +00:00
> A comprehensive AI-powered book generation system with LangGraph, CrewAI, and AutoGen.
2026-03-12 17:44:51 +00:00
2026-03-14 01:17:51 +00:00
<p align="center">
<img src="https://img.shields.io/badge/python-3.10+-blue.svg" alt="Python">
<img src="https://img.shields.io/badge/LangGraph-✅-green.svg" alt="LangGraph">
<img src="https://img.shields.io/badge/CrewAI-✅-green.svg" alt="CrewAI">
<img src="https://img.shields.io/badge/AutoGen-✅-green.svg" alt="AutoGen">
<img src="https://img.shields.io/badge/Pydantic-✅-green.svg" alt="Pydantic">
</p>
2026-03-12 17:44:51 +00:00
2026-03-14 01:17:51 +00:00
## 🎯 What is Opus?
2026-03-13 03:34:49 +00:00
2026-03-14 01:17:51 +00:00
Opus is an AI-powered book generation system that creates professional manuscripts using multiple AI agent frameworks. It supports **fiction** and **nonfiction** with intelligent purpose classification.
2026-03-13 03:58:53 +00:00
2026-03-14 01:17:51 +00:00
## ✨ Features
2026-03-13 03:58:53 +00:00
2026-03-14 01:17:51 +00:00
- **Multi-Framework Orchestration**: LangGraph, CrewAI, and AutoGen
- **Intelligent Purpose Classification**: Automatically determines reader purpose
- **100+ Content Frameworks**: From textbooks to RPG modules
- **Checkpoint/Resume**: Long generations can resume from failure
- **REST API + CLI**: Programmatic or command-line usage
2026-03-13 03:58:53 +00:00
2026-03-14 01:17:51 +00:00
## 🚀 Quick Start
2026-03-12 17:44:51 +00:00
2026-03-13 03:34:49 +00:00
```bash
2026-03-14 01:17:51 +00:00
# Install
pip install opus-orchestrator
2026-03-12 17:44:51 +00:00
2026-03-14 01:17:51 +00:00
# Generate a book (fiction)
opus generate --concept "A robot who dreams of being human" --genre sci-fi
2026-03-13 03:58:53 +00:00
2026-03-14 01:17:51 +00:00
# Generate a book (nonfiction)
opus generate --book-type nonfiction --purpose learn --category technology "How to build an AI app"
2026-03-13 03:58:53 +00:00
2026-03-14 01:17:51 +00:00
# Resume from checkpoint
opus generate --thread-id abc123 --resume
2026-03-12 17:44:51 +00:00
```
2026-03-13 03:34:49 +00:00
2026-03-14 01:17:51 +00:00
## 📚 Framework Library
2026-03-13 03:34:49 +00:00
2026-03-14 01:17:51 +00:00
Opus supports **100+ frameworks** organized by content type:
2026-03-13 03:34:49 +00:00
2026-03-14 01:17:51 +00:00
### Nonfiction Categories
2026-03-12 17:44:51 +00:00
2026-03-14 01:17:51 +00:00
| Category | Frameworks | Purpose |
|----------|-----------|---------|
| **Tutorial/How-To** | Tutorial, Howto, Minimalist How-To, Challenge-Response | Learn to do something |
| **Explanation** | Concept Explainer, Explainer, Socratic Method | Understand a concept |
| **Transformation** | Transformation Journey, Mountain Structure, Atomic Habits | Personal change |
| **Decision** | Big Idea, Problem-Solution, Case Study | Make informed decisions |
| **Reference** | Technical Manual, Quick Reference, Encyclopedia | Look up information |
| **Inspiration** | Visionary, Narrative, Memoir | Feel motivated |
2026-03-13 03:34:49 +00:00
2026-03-14 01:17:51 +00:00
### Educational/Academic
2026-03-13 03:34:49 +00:00
2026-03-14 01:17:51 +00:00
| Category | Frameworks |
|----------|-----------|
| **Textbooks** | Comprehensive Textbook, Textbook Chapter, Workbook |
| **Courses** | Online Course, Curriculum/Syllabus, Study Guide |
| **Academic** | Empirical Paper, Theoretical Paper, Literature Review, Thesis |
| **Research** | Position Paper, Policy Brief, Meta-Analysis |
2026-03-13 03:34:49 +00:00
2026-03-14 01:17:51 +00:00
### Creative/Interactive
2026-03-13 03:34:49 +00:00
2026-03-14 01:17:51 +00:00
| Category | Frameworks |
|----------|-----------|
| **Branching** | Choose Your Own Adventure, Gamebook, Visual Novel |
| **Epistolary** | Epistolary Novel, Found Documents |
| **Manifesto** | Manifesto, Open Letter |
| **Experimental** | Infinite Story, Fractal Narrative, Scrapbook |
| **Performance** | Podcast Script, Screenplay, Stage Play |
2026-03-13 03:34:49 +00:00
2026-03-14 01:17:51 +00:00
### RPG/Tabletop Gaming
2026-03-13 03:34:49 +00:00
2026-03-14 01:17:51 +00:00
| Category | Frameworks |
|----------|-----------|
| **Core** | Core Rulebook, Quickstart |
| **GM Guides** | Game Master Guide, Adventure Module, Campaign Setting |
| **Supplements** | Player's Companion, Monster Manual, Sourcebook |
| **Adventure Types** | Dungeon Crawl, Hex Crawl, Sandbox |
2026-03-13 03:34:49 +00:00
2026-03-14 01:17:51 +00:00
## 🔧 Configuration
2026-03-13 03:47:23 +00:00
2026-03-14 01:17:51 +00:00
### Environment Variables
2026-03-13 03:47:23 +00:00
```bash
2026-03-14 01:17:51 +00:00
export OPENAI_API_KEY = "your-key" # or
export MINIMAX_API_KEY = "your-key"
2026-03-13 03:47:23 +00:00
```
2026-03-13 03:34:49 +00:00
2026-03-14 01:17:51 +00:00
### Config File (`opus.yaml`)
2026-03-13 03:55:44 +00:00
2026-03-14 01:17:51 +00:00
```yaml
agent :
model : gpt-4o
temperature : 0.7
max_tokens : 4000
2026-03-13 03:55:44 +00:00
2026-03-14 01:17:51 +00:00
output :
format : markdown
save_to_file : true
2026-03-13 03:55:44 +00:00
```
2026-03-14 01:17:51 +00:00
## 💻 CLI Commands
2026-03-12 17:44:51 +00:00
```bash
2026-03-14 01:17:51 +00:00
# Generate a book
opus generate --concept "Your book idea" [ options]
# Options:
# --book-type {fiction,nonfiction} Book type
# --framework {snowflake,save-the-cat,...} Story framework
# --genre {sci-fi,fantasy,romance,...} Genre
# --purpose {learn,understand,transform,decide,reference,inspire} Reader purpose
# --category {business,leadership,memoir,...} Nonfiction category
# --words TARGET_WORD_COUNT Target word count
# --thread-id THREAD_ID Checkpoint ID for resume
# --resume Resume from checkpoint
# Serve API
2026-03-13 03:34:49 +00:00
opus serve --port 8000
# List frameworks
opus frameworks
2026-03-14 01:17:51 +00:00
# Ingest from GitHub
opus ingest --repo https://github.com/user/repo
2026-03-12 17:44:51 +00:00
```
2026-03-14 01:17:51 +00:00
## 🔌 REST API
2026-03-12 17:44:51 +00:00
2026-03-14 01:17:51 +00:00
```bash
# Start server
opus serve
2026-03-12 17:44:51 +00:00
2026-03-14 01:17:51 +00:00
# Generate (blocking)
curl -X POST http://localhost:8000/generate \
-H "Content-Type: application/json" \
-d '{"concept": "Your book idea", "book_type": "fiction"}'
2026-03-13 03:34:49 +00:00
2026-03-14 01:17:51 +00:00
# Generate (streaming)
curl -X POST http://localhost:8000/generate/stream \
-H "Content-Type: application/json" \
-d '{"concept": "Your book idea"}'
2026-03-13 03:34:49 +00:00
```
2026-03-14 01:17:51 +00:00
## 🧠 Architecture
2026-03-13 03:34:49 +00:00
```
2026-03-14 01:17:51 +00:00
User Input → Intent Classification → Framework Selection
↓
Purpose Detection (learn/understand/transform/decide/reference/inspire)
↓
Framework匹配 (100+ frameworks by category)
↓
Agent Selection (purpose-specific writer + critique)
↓
Generation Pipeline (LangGraph/CrewAI/AutoGen)
↓
Manuscript Output
2026-03-13 03:34:49 +00:00
```
2026-03-14 01:17:51 +00:00
## 📦 Nonfiction Purpose System
2026-03-13 03:34:49 +00:00
2026-03-14 01:17:51 +00:00
The nonfiction pipeline uses **Purpose × Structure** classification:
2026-03-13 03:34:49 +00:00
2026-03-14 01:17:51 +00:00
### Reader Purposes
2026-03-12 17:44:51 +00:00
2026-03-14 01:17:51 +00:00
1. **LEARN_HANDS_ON** — Reader wants to DO something (tutorials, how-to)
2. **UNDERSTAND** — Reader wants to GRASP a concept (explanations)
3. **TRANSFORM** — Reader wants to CHANGE themselves (self-help, memoir)
4. **DECIDE** — Reader wants to MAKE A DECISION (business, analysis)
5. **REFERENCE** — Reader wants to LOOK UP info (manuals, documentation)
6. **BE_INSPIRED** — Reader wants to FEEL motivated (stories, manifestos)
2026-03-13 03:34:49 +00:00
2026-03-14 01:17:51 +00:00
### Framework Selection
2026-03-13 03:34:49 +00:00
2026-03-14 01:17:51 +00:00
The system automatically selects the best framework based on:
- Explicit flags (`--purpose` , `--category` )
- Keyword classification from concept
- Content analysis (for existing blogs/articles)
- Conversational Q&A (when ambiguous)
2026-03-12 17:44:51 +00:00
2026-03-14 01:17:51 +00:00
## 🔄 Checkpointing/Resume
2026-03-13 03:34:49 +00:00
2026-03-14 01:17:51 +00:00
Long generations can fail. Use checkpointing to resume:
2026-03-13 03:34:49 +00:00
2026-03-14 01:17:51 +00:00
```bash
# First run - saves checkpoint
opus generate --concept "My book" --thread-id my-book-001
# If it fails...
2026-03-13 03:34:49 +00:00
2026-03-14 01:17:51 +00:00
# Resume from checkpoint
opus generate --concept "My book" --thread-id my-book-001 --resume
2026-03-13 03:34:49 +00:00
```
2026-03-14 01:17:51 +00:00
## 🤖 Multi-Agent Systems
2026-03-13 03:34:49 +00:00
2026-03-14 01:17:51 +00:00
Opus supports three orchestration backends:
2026-03-13 03:34:49 +00:00
2026-03-14 01:17:51 +00:00
1. **LangGraph** — State machine with checkpointing
2. **CrewAI** — Sequential agent crews
3. **AutoGen** — Multi-agent debate/critique
2026-03-13 03:34:49 +00:00
2026-03-14 01:17:51 +00:00
## 📁 Project Structure
2026-03-12 17:44:51 +00:00
```
opus_orchestrator/
2026-03-14 01:17:51 +00:00
├── orchestrator.py # Main orchestration
2026-03-13 03:34:49 +00:00
├── langgraph_workflow.py # LangGraph pipeline
├── crews/ # CrewAI crews
2026-03-14 01:17:51 +00:00
├── autogen_critique.py # AutoGen critique
├── agents/ # Agent definitions
│ ├── fiction/ # Fiction writers
│ └── nonfiction/ # Nonfiction writers + purpose-specific
├── frameworks.py # Fiction frameworks
├── nonfiction/ # Nonfiction system
│ ├── classifier.py # Purpose classifier
│ ├── intake.py # Intake agent
│ ├── expanded_frameworks.py # 35+ frameworks
│ ├── textbook_frameworks.py # Educational
│ ├── academic_papers.py # Academic types
│ ├── creative_frameworks.py # Interactive
│ └── rpg_frameworks.py # Tabletop RPG
├── server.py # REST API
└── cli.py # CLI
2026-03-12 17:44:51 +00:00
```
2026-03-13 03:34:49 +00:00
## 📄 License
2026-03-12 17:44:51 +00:00
2026-03-14 01:17:51 +00:00
MIT
2026-03-12 17:44:51 +00:00
2026-03-14 01:17:51 +00:00
## 👤 Author
2026-03-12 17:44:51 +00:00
2026-03-14 01:17:51 +00:00
Mark Havens
2026-03-12 17:44:51 +00:00
2026-03-14 01:17:51 +00:00
## 🔗 Links
2026-03-12 17:44:51 +00:00
2026-03-14 01:17:51 +00:00
- [GitHub ](https://github.com/mrhavens/opus-orchestrator-ai )
- [Documentation ](https://github.com/mrhavens/opus-orchestrator-ai/docs )