Edu SDKEdu SDK

createStudySession

Generate a timed study session plan and matching materials from content.

Builds a timed study agenda from your content for a given durationMinutes.

Two phases: (1) the model plans topic, goals, tips, block sequence, and a material allocation; (2) materials are generated via createLearningSet() from that allocation. There is no React session runner — compose UI from blocks and materials (see Study session flow).

Usage

import { createStudySession } from "edu-sdk";

const session = await createStudySession({
  model: "google/gemini-3.6-flash",
  content,
  durationMinutes: 45,
  difficulty: "medium",
});

Options

OptionTypeRequiredDefault
modelstring | LanguageModelYes—
contentstring | FileContentYes—
durationMinutesnumber (integer, 5–240)Yes—
difficulty"easy" | "medium" | "hard"No"medium"
topicstringNoDerived from content
goalsstring[]NoDerived from content

content may be a string or FileContent (PDF / text / markdown bytes).

When topic or goals are provided, they seed the plan; otherwise the model derives them from the content.

Returns

Promise<Artifact<StudySessionContent>>

{
  id: string;
  title: string;
  description?: string;
  metadata: {
    createdAt: string;
    model: string;
    difficulty: "easy" | "medium" | "hard";
  };
  content: {
    topic: string;
    goals: string[];
    totalDurationMinutes: number;
    tips: string[];
    blocks: StudySessionBlock[];
    materials: LearningSetContent;
  };
}

Blocks

Each block:

{
  id: string;
  type:
    | "read"
    | "notes"
    | "studyGuide"
    | "flashcards"
    | "quiz"
    | "practiceProblems"
    | "break"
    | "review";
  title: string;
  durationMinutes: number;
  instructions: string;
  materialKey?:
    | "quiz"
    | "flashcards"
    | "practiceProblems"
    | "notes"
    | "studyGuide";
}

Block durations are normalized to match durationMinutes. Gaps within ±5 minutes are adjusted on the last non-break block; larger mismatches throw InvalidInputError.

materialKey must only reference a material type that was allocated. The SDK validates that before generating materials.

Materials

materials is a LearningSetContent object (nested full artifacts). The model decides which types to include and in what quantity based on duration, difficulty, and content. If nothing is allocated, materials is {}.

Example

import { createStudySession } from "edu-sdk";

const session = await createStudySession({
  model: "google/gemini-3.6-flash",
  content: chapterText,
  durationMinutes: 60,
  topic: "Ohm's law",
  goals: ["Explain voltage, current, and resistance"],
  difficulty: "easy",
});

const { blocks, materials, tips } = session.content;
const quiz = materials.quiz; // Artifact<QuizQuestion[]> | undefined
// <Quiz questions={quiz!.content} />

Invalid input throws InvalidInputError (for example durationMinutes outside 5–240, empty content, or plan/allocation mismatches).

Next: Study session flow for wiring blocks to React components.

On this page