Skip to main content
Once you have a LessonSession from lessons.start(), the question loop is how your app drives the lesson forward. Call session.next() to get a question, render it, then call session.submit() with the student’s answer.

The basic loop

Fetch a question

session.next() returns the next LessonQuestion, or null when there are no more questions:
Each normalized question includes an id; content and content.rawXml are optional in the contract. Check for XML before rendering and handle unsupported or missing content in your UI. Your app supplies a QTI renderer.
See the reference for the full type.
Select a renderer that supports the item interaction and response format. The managed-session submit() accepts a string and the server sends it as responses.RESPONSE; it does not expose every multi-response QTI contract. Use the returned grading result for feedback.

Submit an answer

After the student answers, submit their response:
The result tells you whether the answer was correct, the updated score, and whether the lesson is now complete. After each submission, score updates and a complete result stops subsequent next() calls. The public finalized property updates only after complete().
See the reference for full parameter and return type documentation.

Adaptive vs linear delivery

The SDK handles two delivery modes transparently. Your code uses the same next() / submit() loop regardless of mode.
You do not need to detect which mode is active. The LessonSession handles it based on the lessonType set during lessons.start().

Adaptive (powerpath-100)

Each next() call hits the server, which asks PowerPath for the next question based on the student’s performance so far. Questions are served one at a time, and difficulty adapts.

Linear (quiz, test-out, etc.)

On the first next() call, the SDK fetches all questions at once and buffers them locally. Subsequent next() calls return from the local buffer without a network round trip. Already-answered questions are skipped automatically.

Track progress during the loop

The session properties update in real time as the student progresses. Use the returned result.complete and session.score to render progress. These are mutable object properties; copy returned values into your framework state when each request resolves. For linear lessons, submit returns correct: false and score: 0 before finalization; do not show that placeholder as a scored wrong answer.

Next steps

Completion

Finalize scoring and interpret results

Reference

Parameters, properties, methods, and return types