Skip to content
All case studies

Case study · Computer Engineering capstone

Lery AI

A screenless voice tutor for spoken English running on a Raspberry Pi. Computer Engineering capstone at UNISAL, graded 10/10.

Role
Device, services, apps and evaluation lab
Year
2026
Stack
Python · TypeScript · Fastify · Gemini · PostgreSQL · React Native · React
Lery cover: “Speak English. No screen.”, with the violet mascot, a sentence in Portuguese, the reply in English and a 91.7% figure for turns passing every rule with simulated students.

01

The problem

Many people study English for years and still freeze when they have to speak. The literature calls it foreign language speaking anxiety: fear of judgment blocks even those who know the grammar. The phone, where apps teach, also competes for attention. So: what if practice left the screen?

02

Demo

94 seconds on the real device, with English subtitles. The video only downloads when you press play.

03

The device

No screen, no keyboard: a Raspberry Pi 3 with a USB microphone, two speakers and a 16-LED ring. The ring shows the state of the conversation: yellow listening, green thinking, blue speaking. The wake word is detected on the device itself.

Prototype slide: 3D-rendered exploded view with perforated cover, 16-LED ring, USB microphone, Raspberry Pi 3, USB sound card and two speakers; 108 mm wide and 184 mm tall.Open image at full size
A 3D render of the prototype, not a photograph.

04

Inside a turn

The device detects “Hey Lery” locally and records. A TypeScript service transcribes, assembles the context, asks the tutor for a draft and checks the level in code before anything is spoken. Grading happens afterwards so the learner does not wait. No provider keys live on the device.

05

Context engineering and patterns

The hard part was not calling a model, it was controlling context: deciding what it sees, when it sees it and how the reply is checked. The tutor prompt is built in layers, from what rarely changes to what changes every lesson. Learner details are fetched through tools when needed, and a card written at the end of a session is the memory for the next.

Lery is not an autonomous agent: it is a fixed workflow that generates, checks in code and only then speaks. I chose predictability.

Layered context

↓ Most stable

  1. PersonaWho the tutor is, and that the reply will be spoken.changes on deploy
  2. Tutor styleThe chosen tone.per learner
  3. Learner snapshotRecurring mistakes and open topics.per session
  4. Session stateCEFR level rules and reply limit.per session
  5. Lesson scriptGuided lessons only; overrides general behavior.per lesson

↓ Most volatile

Slide of one A1 turn inside the service: context built from stable to volatile (persona, learner snapshot, state, lesson script), a draft rejected and rewritten by the level gate in code, speech, and a session summary that becomes the next session’s memory.Open image at full size
Illustrative example; the rules and limits are the ones in code.

Context techniques

TechniqueIn LeryCaveat
Layered contextIn LeryThe stack aboveCaveatPrompt cache gains were not measured
Just-in-time retrievalIn LeryTools for recent errors, mastered structures and open topicsCaveatA short snapshot is also in the prompt
Structured notes across sessionsIn LeryThe summarizer writes a card the next session readsCaveatMemory, not window compaction
Single-purpose callsIn LeryTutor, evaluator, summarizer and reflector, each with its own prompt, model, reasoning effort and structured outputCaveatNot autonomous sub-agents

Workflow and design patterns

PatternIn LeryOrigin and caveat
Workflow, not agentIn LeryCode decides the next stepOrigin and caveatAnthropic, Building effective agents
Routing by rulesIn LerySupport level, mode and CEFR level, with no model callOrigin and caveatAnthropic, Building effective agents
Generate, check, rewriteIn LeryA gate in code; one rewrite with the reasonOrigin and caveatAdapted from evaluator-optimizer
Deferred evaluationIn LeryThe grade is computed after speakingOrigin and caveatOff the path the learner waits on
Human-in-the-loop reflectionIn LeryA disputed grade may become a versioned, capped calibration noteOrigin and caveatInspired by Reflexion; effect not measured
Strategy + AdapterIn LeryOne interface, several provider implementationsOrigin and caveatGamma et al.; only Gemini was measured
State machineIn LeryThe device never records while it talksOrigin and caveatClassic pattern
Local decision firstIn LeryWake word, noise gate and repetition score with no modelOrigin and caveatNo call cost

What I studied and what made it in

TopicIn Lery
Tokens and costIn LeryMinimal reasoning on tutor and evaluator; a cost script (pnpm cost)
External and episodic memoryIn LeryLearner snapshot and session card
Tool callingIn LeryFour pedagogical tools
Specialized roles and LLM as judgeIn LeryOne call per role; the judge only in the lab, as a secondary signal
Vector RAGIn LeryNot used: one learner’s facts fit in a structured card
LangChain and LangGraphIn LeryNot used: the flow is short and lives in my own TypeScript
MCPIn LeryNot used
Context window compressionIn LeryNot used as a technique of its own

06

Bridge mode

Beginners start in their own language: answer a question, hear how to say it in English, repeat it. The state machine and the repetition score are deterministic and local; the model only writes the next question and the target sentence, as structured JSON. If the model picked the language, progress could not be measured.

Bridge mode slide: the student says “Ontem eu trabalhei o dia todo”, Lery teaches “I worked all day”, the repetition is compared word by word and scores 86 in similarity; four support levels from bridge to immersion.Open image at full size
The Portuguese lines are intentional: that is what the learner says.

07

Decisions and what went wrong

  • Decision

    Code instead of a second model

    An LLM reviewer checked reply length and cost about 5 s before the tutor could speak. With less reasoning it got cheaper and stopped counting words, letting over-length replies through. Sentence and word limits became a few lines of code, testable without a model.

  • Mistake

    My prompt broke my own rule

    The tutor kept using three sentences against a limit of two. The model was not ignoring the instruction: the correction example inside my own prompt had three sentences. Fixing the example clearly reduced length failures at B1.

  • Mistake

    The room is not the lab

    On the device, some transcriptions had nothing to do with what was said, including Whisper hallucinations on weak audio. I added a noise gate and a hallucination filter. I have not re-measured on the device yet, so I do not claim it is solved.

08

Results

With simulated students, turns passing every project rule went from 76.7% to 91.7%. Median tutor latency is 2.8 s. On the device the wait for a reply is still about 6 s, which is slow for a conversation.

Context: simulated A1, B1 and C1 students, 60 turns per run; 91.7% is the mean of four runs (88.3% to 96.7%) and the 76.7% baseline is a single run, so part of the gap is noise. The 2.8 s is the tutor alone; the whole server turn had a median of 2.7 s over 36 turns. The 6.0 s is on the Pi with a commercial voice over 12 turns. This measures rule adherence, not learning.

09

Limits and next steps

  • No study with real learners: nothing here shows that anyone learns faster or feels less anxious.
  • p95 tutor latency misses its target, and the wait on the device still has to come down.
  • Wake word v3 scored 15 of 15, but over 15 recordings of a single person: my own voice.