Integrating OpenL2
OpenL2 separates curriculum and language-knowledge definitions from learner delivery. Learning apps, flashcard tools, audio generators, and media analyzers can all consume the same compiled courses.
Core architectural boundary
Section titled “Core architectural boundary”- OpenL2 owns: Concept and Skill identities, prerequisite and introduction order, authored Tasks/Lessons/Exercises, annotations, and quality validation.
- Your application owns: Learner state (recognition vs. production mastery), spaced-repetition scheduling, modality selection, speaking/roleplay coaching, and runtime L1 adaptation.
Compiling courses in Python
Section titled “Compiling courses in Python”Use compile_level_export to load a resolved, validated level with its compiled tasks, concepts, and teaching plans:
from pathlib import Pathfrom openl2.courses.exports.compiler import compile_level_export
level = compile_level_export(Path("courses/calling-in-sick"))print(level.language, level.level, len(level.tasks))
for task in level.tasks: print(task.task_id, "→", task.outcome) for concept in task.concepts: print(" ", concept.ref, f"({concept.kind})", "sources:", len(concept.sources))Key compiled types (openl2.courses.exports.models)
Section titled “Key compiled types (openl2.courses.exports.models)”CompiledLevel:level_dir,framework,language,level,validation_closure,exercise_sourcetasks: tuple[CompiledTask, ...](alsolevel.task_by_id)level_outcomes: tuple[LevelOutcome, ...]skills,skill_records,concept_catalog,target_inventory
CompiledTask:task_id,index,outcome,register,source_path,task_sourceconcepts: tuple[CompiledConcept, ...](alsotask.concept_refs,task.concept_by_ref)level_outcome_refs,integrative_modalities,prior_teaching,prerequisites_by_ref,teaching_plan
CompiledConcept:ref,kind,concept,concept_key,sense,pos,support_onlyskill,skill_type,skill_key,realizes_conceptsources: tuple[ConceptSource, ...](every presentation, utterance, or dialogue turn where the Concept appears)
Building a learner model
Section titled “Building a learner model”Key learner mastery state on (language, concept_key) (or (library, concept_key)), not on a bare concept_key alone. Concept keys are canonical within one language library, not globally across languages—for example, both English and Dutch export payment-card (card in English vs. met pin in Dutch). For Skill Concepts, pair language with skill_key and concept_key.
Because CompiledConcept preserves kind, sense, and realizes_concept, and CompiledTask preserves prerequisites_by_ref and prior_teaching, your runtime can track recognition vs. production separately and select targeted practice for gaps.
Built-in exporters & third-party plugins
Section titled “Built-in exporters & third-party plugins”List registered exporter plugins in your environment:
openl2 plugins list- Using built-in exporters (static site, Anki
.apkg/AnkiConnect, Book, Jetway): see Export & publish a course. - Building & registering a third-party plugin (Python entry points, MCP plugins,
openl2-study): see Building plugins, andsrc/openl2/plugins/anki/,src/openl2/plugins/book/, andsrc/openl2/plugins/jetway/for reference implementations.
Jetway prerequisite boundary
Section titled “Jetway prerequisite boundary”When integrating with Jetway or mirroring its export format, note that Jetway’s exported concept_sets[].depends_on_concept_set_keys carries Concept Set–level dependencies only. Individual Concept prerequisites declared on a set (such as requiring I and you before a have possession set) are enforced by OpenL2 during validation and compilation (CompiledTask.prerequisites_by_ref) and are filtered out of depends_on_concept_set_keys. If your runtime needs Concept-level prerequisite edges for adaptive sequencing, read CompiledTask.prerequisites_by_ref directly from compile_level_export.