Skip to content
Studeia Docs

AI Tutor: multi-agent pipeline

Studeia multi-agent AI tutor pipeline: orchestrator, retrieval, pedagogical, evaluation, content, supervisor agents. Claude/GPT/Grok/Gemini fallback. Per-tenant RAG. Misconception detection.

By Studeia Team 2026-06-23 10 min
Resposta curta

Studeia's AI tutor gives each student personalized support: it answers questions grounded in the course material (RAG), picks the teaching strategy by level, detects misconceptions and is moderated by a safety agent β€” with no AI cost on the deterministic components. For the institution, that means students better served 24/7 and teachers freed from repetitive work, with AI grounded in your content and under cost control.

Pipeline detailed

Pre-LLM (synchronous, zero LLM cost)

  1. StudentModelService.getSnapshot(userId, courseId) loads ConceptMastery (Beta distribution per concept), active/resolving misconceptions, EpisodicMemory, quizContext (avgScore, passRate, weakAreas), ChatSession history.
  2. RetrievalAgent.retrieve(query, studentModel) reformulates query, searches pgvector with tenant+course filters, boost by quizWeakAreas.
  3. PedagogicalAgent.select(studentModel, query) evaluates mastery + applies adjustments (chat-quiz divergence, age, learning style) β†’ returns strategy.
  4. buildEnrichedPrompt assembles system prompt with strategy + RAG context + active misconceptions + recent quiz attempts.

Main LLM (streaming, SSE)

router.stream(taskType: "chat_tutor", messages, options) resolves provider via TenantTaskModelConfig. Fallback: Claude β†’ OpenAI β†’ xAI Grok β†’ Google Gemini. Circuit breaker per provider (Redis state). Metering middleware: rate limit + credit check.

Post-LLM (background via after(), fire-and-forget)

  1. EvaluationAgent (Haiku, ~$0.001) classifies understanding, detects StudentMisconception, updates ConceptMastery (Bayesian).
  2. ContentAgent (Haiku, ~$0.001) pre-generates follow-up exercise (Redis 30min TTL).
  3. SessionSummarizer (every 10 turns, Haiku) summarizes long history.
  4. SupervisorAgent (Haiku, ~$0.001) classifies severity + category, applies strikes/quarantine.

Admin configuration

  • TenantTaskModelConfig chooses provider+model per task type
  • PedagogicalConfig configures thresholds per tenant (default 0.3, 0.5, 0.7, 0.9), domainOverrides, ageOverrides, learningStyleOverrides

Limitations

  • First-token latency: 800-1500ms (including pre-LLM pipeline)
  • Total turn latency: 2-8s for medium response (~300 words)
  • Context window: limited by provider (Claude Sonnet 4.6 = 200K, GPT-4o = 128K)
  • Talking avatar + voice (output): available as an opt-in per course β€” a real-time talking avatar with TTS voice via HeyGen LiveAvatar or D-ID (BYO provider key). See Avatar & TTS.
  • Voice input (STT): speaking to the tutor (student speech β†’ speech-to-text β†’ chat) is implemented on B2B (dictation: the speech becomes text in the message field, no auto-send). What remains on the roadmap is two-way voice conversation (a real-time loop with the avatar) and automatic pronunciation scoring.

See also

FAQ

How is the AI tutor pipeline composed?

The tutor uses a multi-component pipeline: deterministic TypeScript components handle orchestration, student context, RAG retrieval and pedagogical strategy; the main LLM generates the answer via the router; background LLM-backed tasks handle evaluation, content follow-ups, safety/supervision and session summarization when needed. Only LLM-backed components consume TenantTaskModelConfig and metering.

How much does a complete tutor turn cost?

Typically $0.005-$0.05 per complete turn. Breakdown: main LLM (Sonnet) $0.005-$0.04 + EvaluationAgent (Haiku) $0.001 + ContentAgent (Haiku) $0.001 + SupervisorAgent (Haiku) $0.001.

Can I disable the AI tutor for a specific course?

Yes. Course.aiTutorEnabled (boolean, default true). Institutional admin toggles in /institution/courses/[id]/settings.

Veja tambem

AI Tutor: multi-agent pipeline