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
Jump to section
Case-study brief
Verified 15 Sep 2026 (opens in a new tab)- 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.
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.
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.
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.
Architecture
Router → conversation → parallel grammar, vocabulary and cultural agents → evaluator → router loop, with CEFR assessment and cross-language transfer computed at session end.
↺ back to router · CEFR + transfer at session end
- 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.
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.
Key technical decisions
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.
02
Abstain when unsure
False corrections are treated as worse than missed ones, so uncertain calls abstain rather than guess.
03
Learner model first
Investment goes into evidence, verification and evaluation rather than into more agents.
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.
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.
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.
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.
Links
- Repository (opens in a new tab)github.com/NiravRVaghasiya/Polyglot-Swarm
- Architecture (opens in a new tab)github.com/NiravRVaghasiya/Polyglot-Swarm/blob/main/docs/architecture.md
- Learner model (opens in a new tab)github.com/NiravRVaghasiya/Polyglot-Swarm/blob/main/docs/learner-model.md
- Decision records (opens in a new tab)github.com/NiravRVaghasiya/Polyglot-Swarm/tree/main/docs/adr