Skip to content

Course tutor settings

The course tutor lets a learner ask a question inside a course and get a short answer built only from that course’s own content, with links back to the lesson. When the course does not cover the question it says so instead of guessing. While a learner has a quiz attempt open it does not give or confirm quiz answers. It is off for every tenant until you switch it on, and it needs AI to be configured (AI_DRIVER).

The module ships with the API. After an upgrade run php artisan migrate --force once per tenant, then set the tenant setting tutor.enabled to true (POST /api/admin/config, or TUTOR_ENABLED=true for the whole installation). The first question in a course builds its search index; php artisan tutor:index --course=1 rebuilds it by hand.

The tutor searches the lesson text of the course (and, for courses built with the Course Builder, the source passages that text cites) with PostgreSQL full-text search, adds the lesson the learner has open, and sends those pieces, the last six messages and the question to the model. Every answer must cite the pieces it used; an answer without valid citations is not shown. Quiz questions, answer options, explanations and final tests are never indexed, so the tutor cannot find them. Text of a learner or of a source is treated as data and cannot change the tutor’s rules.

During an open quiz attempt the tutor explains concepts in general terms or declines, and a check on the server drops any answer that contains a correct option. An attempt that was never submitted and has no time limit counts as open, which errs on the side of not helping.

Setting or variable Default Meaning
tutor.enabled / TUTOR_ENABLED false Tenant switch
TUTOR_DAILY_QUESTIONS 30 Questions per learner per day
TUTOR_PER_MINUTE 6 Requests per learner per minute
TUTOR_TENANT_MONTHLY_USD 30 Monthly AI spend of the tutor for the tenant
TUTOR_EVAL_MONTHLY_USD 5 Monthly cap of tutor:eval --live, see evals
TUTOR_RETENTION_DAYS 90 Conversations are deleted this many days after the last message
AI_TASK_TUTOR_PROFILE light Model profile of the tutor
tutor.stream.enabled / TUTOR_STREAM_ENABLED true Streamed answers (see below); off makes every question use the plain request
TUTOR_STREAM_TIMEOUT_SECONDS 60 A queued answer that runs longer ends with an error and frees the conversation
TUTOR_STREAM_SSE_SECONDS 25 A reader connection closes after this long and the widget reconnects where it left off
TUTOR_STREAM_EVENTS_RETENTION_DAYS 1 Run events are deleted this many days after the answer ended
TUTOR_STREAM_QUEUE_CONNECTION, TUTOR_STREAM_QUEUE default Queue of the answer job

With streaming on, the widget shows the answer as it is written. The question is stored and the answer is queued (POST /api/tutor/courses/{course}/messages with stream: true answers 202 with a run id); a queue worker writes the answer, and the widget reads its events from GET /api/tutor/runs/{run}/events (server-sent events, resumable with Last-Event-ID, so a reload mid-answer continues). A queue worker must be running and the queue must not be sync, or the answer arrives only when it is complete. The text on screen is a draft: the final event carries the checked answer with its citations and replaces it, and a draft whose check fails is replaced by the standard “I couldn’t answer that” message. While a learner has a quiz attempt open nothing is streamed: the answer is written whole, checked for correct options and shown only then.

A learner can have one answer running per conversation; asking again meanwhile gives 409. A run that outlives TUTOR_STREAM_TIMEOUT_SECONDS ends with an error. Events are transport only: the stored message is the record, and the events are deleted a day after the run ends (and with their conversation after the retention period) by tutor:prune. Behind a reverse proxy keep response buffering off for /bff/api/tutor/runs/*/events (the reference frontend sends X-Accel-Buffering: no). Set TUTOR_STREAM_ENABLED=false to fall back to the plain request, which stays available either way.

Conversations belong to the learner, who can list and delete them; an account deletion erases them. No screen shows transcripts to authors or admins. The analytics endpoint GET /api/admin/tutor/courses/{course}/analytics returns counts only (questions, the share the course did not cover, refusals during attempts), and only for groups of at least LEARNER_INSIGHTS_MIN_GROUP_SIZE learners. The model sees the question, recent messages and course content, never the learner’s name, e-mail, results or history, and the call is logged without a user.