Skip to content
Nirav Vaghasiya

Multi-agent adaptive tutor

Polyglot Swarm

A self-hostable multi-agent language tutor that turns conversation into per-skill mastery evidence, schedules review with FSRS and plans the next most valuable thing to practise.

  • Multi-agent systems
  • Learner modelling
  • Spaced repetition
  • Calibration
Status
Alpha
Started
2026
Stack
Python 3.12 · LangGraph · ChromaDB · SQLite · FastAPI · Gradio · Whisper
Orchestration
LangGraph StateGraph
Skills modelled
7
Providers
Claude · Gemini · OpenAI · Ollama
Decision records
30 ADRs
Contribution
Router → conversation → parallel grammar, vocabulary and cultural agents → evaluator → router loop, with CEFR assessment and cross-language transfer computed at session end.
Best evidence
5-arm ablation · 30 ADRs
Deterministic fake-LLM mode; no study with real learners and CEFR is not human-validated.
Main limitation
No study with real learners; CEFR estimates are not validated against expert human raters.
Verification basis
Architecture, learner-model, results and limitations docs plus repository structure inspected.
01

Overview

Polyglot Swarm is “a tutor that remembers, not a chatbot that forgets”. A LangGraph graph routes each turn through a conversation agent and a parallel fan-out of grammar, vocabulary and cultural agents, then an evaluator reconciles their findings before the loop continues. Underneath, an evidence pipeline turns every exchange into learning events that update a transparent per-skill learner model.

02

Problem

Language-practice chatbots forget everything between sessions and confidently correct things that were right. A useful tutor has to remember, model what the learner can actually do skill by skill, and abstain when it is not sure — a false correction is treated as worse than a missed one.

03

Motivation

The project's own implementation plan is explicit that the core is the learner model, not the number of agents: build the evidence, verification and evaluation layers rather than adding more personas.

04

Architecture

Router → conversation → parallel grammar, vocabulary and cultural agents → evaluator → router loop, with CEFR assessment and cross-language transfer computed at session end.

Architecture · multi-agent tutor
Graph
Router
Conversationin-character reply
Grammar
Vocabulary
Cultural
Evaluatoraccept · revise · abstain

↺ back to router · CEFR + transfer at session end

Evidence
Extract
Normalise
Dedupe
LearningEventsSQLite, per user · language · session
Beliefs
Learner model7 skills · mastery · uncertainty
Around it
FSRS reviewpy-fsrs
Providerstiered fallback · circuit breaker
VoiceWhisper · TTS · VAD
SurfacesFastAPI · Gradio · Next.js · CLI
Specialist agents fan out in parallel and converge on an evaluator that may accept, revise or abstain. Everything downstream is derived from persisted learning events, not from the agents' free text.
Evidence pipeline
Extractor → normaliser → deduplicator → store of LearningEvents, persisted per user, language and session, then fed to a belief layer.
Learner model
A MasteryEngine that is deliberately a transparent weighted-evidence rule — not a Bayesian network, IRT or a trained model — over seven skills (speaking, listening, reading, writing, grammar, vocabulary, pragmatics) with mastery, uncertainty and sample size.
Verifier
The evaluator accepts, revises or abstains on proposed corrections, reconciles grammar-versus-culture conflicts, and its calibration is measured with expected calibration error.
Review scheduling
FSRS via py-fsrs decides what to review and when.
Voice
Whisper for speech-to-text and edge-tts for speech, with a VAD module.
Reliability
A routing provider with tiered fallback, exponential backoff and a circuit breaker; if every provider fails the tutor still replies in character.
Storage and surfaces
SQLite as the source of truth with additive migrations, ChromaDB collections for vocabulary, grammar rules, conversations and cultural notes; FastAPI, Gradio, a Next.js dashboard and a Typer CLI.
05

Implementation

  • Python 3.12 with LangGraph, LangChain provider packages, ChromaDB, FastAPI, Gradio, pydantic-settings and a versioned Jinja prompt registry; ruff, strict mypy, pytest and Hypothesis.
  • Thirty architecture decision records document the trade-offs.
  • A deterministic fake-LLM mode makes the whole suite and the benchmarks runnable offline.
06

Key technical decisions

  1. 01

    Transparent over trained

    Mastery is computed by an inspectable weighted-evidence rule so every score can be explained back to the events that produced it.

  2. 02

    Abstain when unsure

    False corrections are treated as worse than missed ones, so uncertain calls abstain rather than guess.

  3. 03

    Learner model first

    Investment goes into evidence, verification and evaluation rather than into more agents.

07

Evaluation & results

Benchmarks
Grammar precision · verifier calibration (ECE) · structured output · provider latency
Ablation
5 arms
Conversation only through the full stack, run on scripted learners in deterministic mode.
Regression evals
Grammar, vocabulary, assessment and curriculum suites

All reported numbers come from deterministic fake-LLM mode; there has been no study with real learners.

08

Challenges

  • Keeping fourteen-plus phases of features additive without breaking the graph's state shape or test-pinned behaviour.
  • Calibrating a verifier that must prefer silence to a confident wrong correction.
09

Limitations

  • No study with real learners; CEFR estimates are not validated against expert human raters.
  • Text-to-speech uses a network service, so “fully local” applies to text and Whisper transcription.
  • Alpha software.
10

What I learned

  • Evidence first, beliefs second, learner model third — the ordering of persistence determines whether anything downstream is trustworthy.
  • An abstaining verifier is a product decision as much as a modelling one.