An AI-powered, multi-agent language learning application that utilizes collaborative LLM agents to dynamically generate contextual, adaptive flashcards powered by spaced repetition scheduling.
This project is a submission to the Kaggle AI Agents: Intensive Vibe Coding Capstone Project (Target Track: Concierge Agents).
- Multi-Agent Generation Pipeline:
- Synonyms Agent: Suggests up to 5 lexicographically matching German synonyms.
- Context Agent: Analyzes selected words, infers target translation, estimates CEFR difficulty levels, and writes contextual German-English example sentences appropriate for the user's estimated level.
- Model Context Protocol (MCP) Integration: Binds a local FastMCP server to fetch verified definitions and grammatical genders from the Wiktionary API, eliminating translation hallucinations.
- Synonym Verification Checklist: Allows you to check/uncheck generated synonyms before batch-generating flashcards.
- Spaced Repetition Scheduler: Employs the SuperMemo-2 (SM-2) scheduling algorithm (calculating Easiness Factor, repetitions, and intervals) to queue cards due for review.
- Interactive Session-based Review: Flip cards to see answers, rate your recall from 0 to 5, and dynamically save metrics.
- Zero-Cost Secure Deployment: Deploys to Google Cloud Run with GCS volume persistence and programmatic Google SSO (OAuth2) with email whitelisting to guarantee private access with $0.00 idle running costs.
EchoLoop occupies a unique space, combining the robust scheduling of Anki with generative AI and interactive user verification.
| Dimension | Duolingo | Anki | Lingvist | EchoLoop π |
|---|---|---|---|---|
| Card Generation | Static database | Manual creation | Static database | Dynamic (Multi-Agent Pipeline) |
| Vocabulary Source | Fixed curriculum | User-supplied | Fixed curriculum | User-supplied (any custom word) |
| Recall Context | Repetitive phrases | Plain text | Cloze sentences | Custom Level-Targeted Sentences |
| Expansion Flow | None | Manual search | None | Interactive Synonym Checklist |
| External Verifier | None | None | None | Wiktionary API via MCP Tool |
| Infrastructure Cost | Ad-supported/Paid | Free | Subscription | Zero ($0.00 scale-to-zero GCP) |
The EchoLoop Advantage: Standard flashcard apps force you into pre-made paths or demand tedious manual editing. EchoLoop lets you input any word you encounter, utilizes the Synonyms Agent to suggest vocabulary cluster expansions, lets you filter them, and delegates to the Context Agent to immediately write level-tailored study material.
graph TD
Client[Streamlit UI] -->|1. Enter word| SynonymsAgent[Synonyms Agent]
SynonymsAgent -->|2. Return synonym list| Client
Client -->|3. User checks words, clicks Generate| Pipeline[AgentPipeline.generate_card_batch]
Pipeline -->|4. Infer user level once| RepetitionEngine[Repetition Engine]
RepetitionEngine -->|Reads card history| CardStore[Card Store Β· SQLite]
subgraph AgentPipeline [ADK Agent Generation Pipeline β per selected word]
Pipeline -->|5. For each word| ContextAgent[Context & Difficulty Agent]
ContextAgent -->|5a. Fetch definition & gender| MCPServer[MCP Dictionary Server]
MCPServer -->|5b. Query API| Wiktionary[(Wiktionary API)]
end
ContextAgent -->|6a. Stream card to UI| Client
ContextAgent -->|6b. Save card + example| CardStore
Client -->|Starts study session| RepetitionEngine
RepetitionEngine -->|Queries & updates SM-2 state| CardStore
.
βββ .agents/ # Antigravity agent skills (tdd, grilling, codebase-design, β¦)
βββ .github/workflows/ # CI: lint, test, version bump
βββ echoloop/ # Main application package
β βββ agents/ # ADK Agent definitions & MCP Server
β β βββ context_agent.py # Context generation agent (calls MCP tool)
β β βββ synonyms_agent.py # Synonym generation agent
β β βββ mcp_server.py # Local Stdio FastMCP Dictionary Server
β βββ storage/ # SQLite connection, models, & APIs
β β βββ adapter.py # Database CardStore CRUD operations
β β βββ dictionary.py # Wiktionary HTTP API client
β β βββ models.py # Pydantic / dataclass DB models
β βββ ui/ # Streamlit Multi-page UI package
β β βββ pages/ # Pages (Add Card, Review)
β β βββ auth.py # Google SSO OAuth2 + email whitelist
β β βββ main.py # Streamlit root entry point
β β βββ styles.css # Custom UI CSS styles
β β βββ styles.py # CSS injection helper
β βββ cli.py # CLI runner entry point
β βββ config.py # Application configuration
β βββ constants.py # Shared constants (CEFR levels, SM-2 params)
β βββ pipeline.py # Multi-agent orchestrator (AgentPipeline)
β βββ repetition_engine.py # SM-2 Scheduler & CEFR level estimator
β βββ runner.py # ADK runner helpers (invoke agents, parse output)
β βββ types.py # Shared type aliases
βββ terraform/ # Infrastructure as Code (GCP)
βββ tests/ # Test suite
β βββ eval/ # ADK evaluation datasets & config
β βββ integration/ # Live-API integration tests
β βββ unit/ # Offline unit tests (96 tests)
βββ .env-example # Template for deployment env vars
βββ Dockerfile # Production container definition
βββ deploy.sh # Automated build & deployment script
βββ PROJECT_PLAN.md # Architecture & implementation plan
βββ pyproject.toml # Project metadata & dependencies
- Python 3.14+
- uv (recommended Python package manager)
-
Clone the repository:
git clone https://github.com/khrapovs/echoloop-multiagent-flashcards.git cd echoloop-multiagent-flashcards -
Install dependencies:
uv sync --all-extras
-
Set API credentials: Set your Google Gemini API Key:
export GOOGLE_API_KEY="your-key-here"
-
Launch the interface:
uv run echoloop
This will spin up Streamlit and open the UI at http://localhost:8501.
Before submitting code, ensure that all linting checks pass. The project uses prek for checking commits:
prek installRun linting and formatting manually
uv run prek run -v --show-diff-on-failureMake sure the entire test suite passes successfully.
- Run Unit Tests (offline/mocked):
uv run pytest tests/unit -v
- Run Integration Tests (requires
GOOGLE_API_KEY):uv run pytest tests/integration -v
We use the Google Agent Development Kit (ADK) evaluation suite to run automated benchmark runs and grade output quality.
- Generate traces (runs the agent against the test cases in
tests/eval/datasets/basic-dataset.json):agents-cli eval generate - Grade results (calculates pass/fail rates on language quality and structured schema compliance):
agents-cli eval grade - Analyze failures (clusters outputs to find common error domains):
agents-cli eval analyze
EchoLoop uses Terraform to deploy a containerized environment to Google Cloud Run using a cost-efficient scale-to-zero serverless profile.
- Google Cloud SDK (
gcloud) installed and authenticated. - Terraform CLI installed locally.
- Authenticate Application Default Credentials (ADC) for Terraform:
gcloud auth application-default login gcloud auth application-default set-quota-project <YOUR-PROJECT-ID>
To bootstrap infrastructure and deploy the application:
-
Configure deployment variables: Copy the example environment configuration file and fill in your variables (GCP project, state bucket, and Google OAuth Client ID/Secret):
cp .env-example .env # Open .env in your editor and configure the variables -
Run the deployment orchestrator script:
./deploy.sh
This script reads configurations from your
.envfile, validates credentials, bootstraps the GCS state bucket, builds the container via Cloud Build, and deploys to Cloud Run. -
Access your service: The script outputs your Cloud Run Service URL:
Your EchoLoop UI is accessible at: https://echoloop-ui-xxxxxx.a.run.appOnly users logging in with whitelisted email addresses will be granted access to the application.