AI Learning Factory: from a vague idea to a publishable course

An agent-driven educational content factory for research, lessons, slides, voice, video and publishing—with contracts, versioning, cost tracking and human control.

8/5/202612 min

Asking an LLM to “make me a course” is easy. Getting it to research reliable sources, maintain a coherent learning journey, produce editable artifacts, follow a visual identity, synthesize a voice, assemble a video and keep track of the cost of every decision is another story.

AI Learning Factory was born in that uncomfortable space between a demo that looks impressive for five minutes and a system people can actually use. It is a web application that turns a still-fuzzy idea into an educational production line: brief, research, plan, lessons, slides, teaching script, narration, video and publishing package.

The video above is not a mockup. It is a 45-second excerpt from a real 20:20 artifact generated by the platform for a course on classical NLP, complete with rendered slides, TTS narration and automatic editing.

AI Learning Factory project dashboard

The thesis: manufacturing is not the same as pressing a button

The factory metaphor is deliberate, but it is not meant to hide the instructor behind a conveyor belt. Quite the opposite: every stage has a clear responsibility, an input and output contract, an active version and, whenever necessary, a stop for human review.

That nuance changes the product. Instead of an endless conversation whose state lives inside the model context, the system works with explicit artifacts. A course_idea_brief feeds the Curator; the research_brief feeds the Course Designer; the course_plan gives the lessons their structure; and the chain continues all the way to video and publishing. Every output can be inspected, downloaded, edited, regenerated or replaced with the user's own material.

This is not a rigid pipeline. The complete workflow can run from end to end, but it is also possible to enter halfway through—for example, by uploading a slide deck and generating only the script and video. Being able to recombine stages makes the project a platform rather than one long script containing seven API calls.

Start with a good question

The first component is an ideation assistant. It accepts prompts such as “I want a short course about RAG” and responds with concrete questions to define the audience, level, scope, duration and intended outcome. It also lets the user decide how research will work: the open web, a private corpus supplemented by web sources, or provided sources only.

Ideation assistant and source selection

The goal is not to keep the chat going; it is to bring it to a close with a structured brief. Once the problem is defined well enough, the conversation becomes a reproducible project. This boundary between natural language and a typed contract prevents the rest of the pipeline from having to guess what the user meant twenty messages earlier.

Workflows you can see, understand and stop

The application includes templates for research, slide creation, full video production and partial journeys. Users can also duplicate them and build their own workflows.

Library of complete and partial workflows

The complete workflow chains seven steps: Curator, Course Plan, Lessons, Slides, Teaching Script, Voice Adaptation and Video. Publishing is prepared afterwards as an explicit phase because uploading to YouTube has external consequences and should never happen silently.

Visual pipeline of seven agents

The engine uses LangGraph with SQLite checkpoints. A run can be paused for review, approved, rejected with feedback and resumed even after the service restarts. The interface receives progress through SSE, so it does not need to hold an HTTP request open while a production job runs for several minutes.

The architecture: contracts at the center, models at the edge

The solution lives in a monorepo with three main components:

Browser
   │
   ▼
Next.js ── /api proxy ──► FastAPI (REST + SSE)
                              │
                 ┌────────────┼────────────┐
                 ▼            ▼            ▼
          Workflow engine   Job runner   Domain services
            (LangGraph)                 projects / artifacts
                 │            │          costs / auth / OAuth
                 └──────┬─────┘
                        ▼
              SQLite + Alembic + filesystem
          checkpoints · events · wiki · versions
                        │
                        ▼
             factory_agents package
       agents · Pydantic contracts · tools
          │              │                │
          ▼              ▼                ▼
   OpenRouter/web   Marp/Chromium     TTS/FFmpeg/YouTube

apps/web contains the Spanish-language Next.js experience. apps/api exposes the FastAPI API, authentication, run engine, events, costs and repositories. packages/factory_agents brings together the agents, their tools and the artifact contracts.

The important decision is not the framework. It is that the AI provider stays at the edge. The domain does not exchange ambiguous paragraphs; it exchanges validated objects. This makes it possible to switch models, retry a stage or regenerate a single output without losing the project's history.

Ten specialists instead of one super-prompt

The Agents screen makes each role's capabilities, inputs, outputs and available tools visible. There are specialists for ideation, curation, course design, lessons, slides, scripts, voice, video, publishing and performance analysis.

Agent catalog with input and output contracts

Each agent supports multiple profiles. A profile combines soul.md—personality, taste and editorial judgment—with agents.md—verifiable operating rules—alongside the model, review policy and stage-specific settings. Versions are frozen when a run starts, so a future change cannot rewrite the past.

For Slides, for example, a profile controls 16:9 or 9:16 orientation, palette, logo, position, opacity, image generation and visual style. It also determines whether an automatic evaluation will run and how many regeneration attempts are allowed.

Versioned profile for the Slides agent

This design solves a common problem in AI products: whenever an output changes, the system must be able to answer which model, prompt, profile and inputs produced it. Without that traceability, improvement stops being engineering and becomes superstition.

Versioned artifacts and costs that do not disappear

A run never overwrites previous files. It produces new versions and records which one is selected. Slides can be downloaded as HTML, PDF or PPTX; lessons as Markdown or PDF; video as MP4 with subtitles and chapters; and the publishing package includes a title, description, tags and thumbnail.

Real project with pipeline, costs and artifacts

In the NLP project used for the sample, the dashboard recorded outputs for 8 out of 8 stages, 125 operations, 1,348,534 tokens, 20,631 TTS characters and five images. It also separated historical spend—$1.4211, including discarded versions—from the cost attributable to active artifacts—$1.2949. These figures were observed in the deployed application on August 5, 2026.

The difference is small in dollars but enormous in design terms: the system does not erase the cost of attempts that are no longer displayed. Evaluating an AI pipeline means measuring the whole process, not only the polished version that survived.

Multimedia: where demos tend to break

Generating Markdown is the easy part. The multimedia stage combines several tools with very different contracts:

  • Marp and Chromium turn slides into HTML, PDF, PPTX and images.
  • The Script Writer expands on the visual content as an instructor would instead of merely reading the screen aloud.
  • The Voice Adapter segments the text for TTS while preserving its relationship with each slide.
  • The synthesizer reuses cached segments to avoid paying for and generating unchanged audio again.
  • FFmpeg combines audio, images, subtitles and chapters into a horizontal or vertical MP4.
  • The Publisher prepares metadata and a thumbnail; the OAuth upload always requires explicit confirmation.

Player showing the generated video artifact

The editing process has configurable limits for threads, filters, preset and CRF. This is not a cosmetic detail: in a deployment with shared resources, unconstrained video composition can turn a background job into a CPU incident.

Security and control: autonomy within boundaries

Allowing an agent to write and execute Python examples calls for something more serious than a try/catch. In Docker, the sandbox uses Landlock to restrict the filesystem and seccomp to block networking, processes, namespaces and dangerous syscalls, in addition to resource limits. The backend runs as an unprivileged user, and unsafe local mode must be enabled explicitly.

The application protects projects and artifacts by owner, signs the session and keeps OAuth credentials outside the artifacts. Irreversible actions—publishing a video or applying an improvement proposal—remain behind a human decision.

Continuous improvement follows the same philosophy. The Analyst can read YouTube metrics and comments and propose changes to the channel memory or agents.md files, but cannot apply them independently.

Continuous improvement proposal inbox

How this project connects to my work

I work as a Lead AI Instructor at Factoría F5, where I design and update learning paths, teach AI bootcamps and support students with widely different backgrounds. In that setting, creating a course is never just a matter of writing content: it means researching, defining learning outcomes, sequencing concepts, building examples, preparing visual material, explaining ideas clearly and reviewing what does not work.

AI Learning Factory turns that domain knowledge into software. It does not try to replace teaching judgment; it makes that judgment configurable, observable and reusable. Project memory preserves decisions and terminology across lessons. Checkpoints make room for human review. Profiles adapt the same pipeline to a different audience, format or visual identity.

The project also brings together several areas of my technical experience: APIs and distributed systems, agents and RAG, data contracts, multimodal generation, cost observability, execution security, Docker and deployment. To me, that is its most interesting aspect. It does not merely prove that a model can write; it proves that I can design the system that decides when it should write, with which context, within which boundaries and backed by which evidence.

What I would scale next

The current architecture is a good fit for a personal tool deployed as two services with persistent storage. If the product grew to support multiple teams and concurrent runs, the next step would be to separate responsibilities: PostgreSQL for concurrency, a dedicated job queue, object storage for large binaries and multimedia workers isolated from the API.

That does not invalidate the current use of SQLite and the filesystem. Choosing a proportionate solution is engineering too. The goal of this version was to close the entire loop, observe where real complexity emerged and keep every decision explicit enough to evolve later.

AI Learning Factory started with a simple question: “How much of course production can be automated without losing pedagogical control?” The answer was not “all of it.” It was something more useful: more and more of it, as long as contracts, traceability and human decisions are part of the architecture from the very beginning.