# OpenMAIC Two-Stage Pipeline for Content Generation: From Outline to Interactive Lessons

> Discover OpenMAIC's two stage pipeline for content generation. Transform raw materials into interactive lessons, starting with an outline and ending with rich multimedia scenes.

- Repository: [MAIC/OpenMAIC](https://github.com/THU-MAIC/OpenMAIC)
- Tags: how-to-guide
- Published: 2026-09-06

---

**The OpenMAIC two-stage pipeline for content generation converts raw user materials into complete interactive lessons by first producing a structured outline, then expanding each outline item into a rich multimedia scene.**

OpenMAIC, developed by THU-MAIC, implements a sophisticated generation architecture that separates high-level lesson planning from detailed content creation. This design ensures logical coherence across the learning experience while enabling rich media integration in every component. The pipeline is housed in the `lib/generation/` directory and distributed through the `@openmaic/generation` package.

## Understanding the Two-Stage Architecture

The generation module deliberately splits work into **distinct planning and execution phases**. This separation allows the system to validate lesson structure before committing resources to expensive media generation operations.

### Stage 1: Outline Generation

In the **outline stage**, OpenMAIC analyzes supplied source material—PDF documents, PowerPoint files, plain text, images, audio, or video—and produces a **structured lesson outline**.

The outline captures the logical flow, key topics, and optimal sequencing for the learning session. Implementation resides in the `lib/generation/` directory where large-language-model prompting strategies generate this blueprint. The material pipeline (described in the project README) first extracts processable content from these varied inputs before outline synthesis begins.

This stage answers critical pedagogical questions: What concepts must be covered? In what order? How should difficulty progress?

### Stage 2: Scene Generation

The **scene stage** transforms each outline entry into a **fully realized learning component**. For every item in the outline, the system generates one of:

- **Slide decks** with structured content
- **Interactive quizzes** with immediate feedback
- **Simulations** for hands-on exploration
- **Project-based learning (PBL) activities** with guided workflows

The `generate/` subfolder within the generation module contains the scene generation pipeline implementation. This stage invokes specialized sub-pipelines for:

- **Image creation** via generative models
- **Voice synthesis (TTS)** for narration
- **Interactive module composition** for simulations and activities

Final output packs into the **OpenMAIC slide DSL**, a domain-specific language that the renderer consumes for display.

## Pipeline Implementation and API Usage

The two-stage process is orchestrated through the public API endpoint defined in `app/api/generate/`. Client applications interact with this unified interface rather than calling stages separately.

### Triggering Generation from Client Code

```typescript
import { fetch } from 'node-fetch';

// Stage 1: Submit raw material for outline generation
// Stage 2: Automatic scene expansion for each outline item
const response = await fetch('/api/generate', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    materialUrl: 'https://example.com/intro-to-python.pdf',
    // Optional parameters: language, targetDuration, difficultyLevel
  }),
});

const lessonPayload = await response.json();
// lessonPayload contains complete slide decks, quizzes, 
// interactive modules, and associated media assets

```

The endpoint internally coordinates both stages: outline production followed by per-item scene generation. The resulting payload feeds directly into `@openmaic/renderer` for student-facing display.

## Key Implementation Files

Understanding the source structure clarifies where customization and debugging should occur:

| Path | Purpose |
|------|---------|
| `lib/generation/` | Core two-stage pipeline implementation (outline → scenes) |
| `packages/@openmaic/generation/README.md` | Package contracts and public API documentation |
| `app/api/generate/` | HTTP entry point that orchestrates stage execution |
| [`README.md`](https://github.com/THU-MAIC/OpenMAIC/blob/main/README.md) (lines 894-898) | Architectural overview of the generation process |

The generation package exports stable interfaces while internal pipeline details remain encapsulated in `lib/generation/`. This separation lets THU-MAIC iterate on prompting strategies and media pipelines without breaking consumer applications.

## Design Rationale: Why Two Stages?

The strict separation between outline and scene generation delivers concrete engineering benefits:

- **Validation checkpoint**: Review and modify lesson structure before expensive media generation
- **Retry efficiency**: Failed scene generation can rerun without reconstructing the entire outline
- **Parallelization**: Independent scenes generate concurrently once the outline fixes dependencies
- **Consistency enforcement**: Global pedagogical constraints apply during outline creation, ensuring coherent learner progression

This architecture reflects lessons from early monolithic generation approaches where structure errors propagated into costly media production failures.

## Summary

- OpenMAIC implements a **two-stage generation pipeline**: outline planning followed by scene expansion
- **Stage 1** (`lib/generation/`) analyzes diverse source materials and produces structured lesson blueprints via LLM prompting
- **Stage 2** invokes specialized sub-pipelines to generate slides, quizzes, simulations, and PBL activities with full media assets
- The `app/api/generate/` endpoint exposes a unified interface that orchestrates both stages for client applications
- Output uses the **OpenMAIC slide DSL**, enabling renderer-agnostic lesson distribution

## Frequently Asked Questions

### How does OpenMAIC handle different input material formats?

The **material pipeline** extracts standardized content from PDF, PPTX, text, images, audio, and video before outline generation begins. This preprocessing ensures the LLM receives consistent input regardless of source format, with format-specific handlers living alongside the generation module.

### Can intermediate outlines be inspected or modified?

The current API abstracts both stages behind a single endpoint, but the architecture explicitly supports outline inspection. The two-stage design was chosen partly to enable future features allowing educators to review and adjust lesson structure before scene generation consumes computation resources.

### What media types can scenes include?

Each generated scene may contain **text content**, **generated or retrieved images**, **text-to-speech audio narration**, and **interactive JavaScript modules** for simulations or guided activities. The scene generation pipeline coordinates these varied outputs into coherent learning experiences.

### Where is the generation pipeline physically implemented?

Core implementation resides in `lib/generation/` at the repository root, with public package distribution through `packages/@openmaic/generation/`. API routing and request handling live in `app/api/generate/` according to the Next.js application structure used by the OpenMAIC platform.