Back to Projects

SmartDuka

An agentic AI learning game where Kenyan children practice maths and literacy by running a virtual corner shop — powered by Qwen3-32B on Fireworks AI.

July 2026
View Code
AINext.jsFastAPISQLiteQwen3Tailwind CSSZustand

The Overview

Smart Duka is an agentic AI learning game designed to tackle the early childhood learning crisis in Sub-Saharan Africa. By running a virtual duka (a traditional Swahili corner shop), children practice real-world math, literacy, and financial planning through gameplay.

The game was built during OpenAI Build Week 2026 and awarded in the Education Track. It features a concurrent multi-agent system powered by Qwen3-32B hosted on Fireworks AI, allowing dynamic generation of culturally relevant interactions, learning quests, and personalized tutor guidance in real-time.


The Problem

Over 90% of children in Sub-Saharan Africa cannot read or understand a simple text by age 10, and fewer than 1 in 3 can perform basic arithmetic by the end of Grade 3.

The core challenge isn't a lack of raw content—it is a lack of cultural relevance, access, and personalization. Standard EdTech apps developed for Western markets do not resonate with the daily lives of East African children, leading to low retention and engagement.


The Solution: A Virtual Duka

Smart Duka translates math and literacy into core game mechanics. Instead of completing detached worksheets, players manage a virtual shop:

  • Interact with Customers: Serve AI-generated characters with Kenyan names and local dialogue.
  • Transact in Shillings: Process orders, read shopping lists in Swahili/English, and calculate correct change in Kenyan Shillings (KES).
  • Manage Inventory: Order restocks of familiar local goods like unga (flour), sukari (sugar), and mandazi (donuts).
  • Balance Ledgers: Keep track of daily revenue, expenses, and overall profit.

Agent Orchestration System

The game runs three backend agents concurrently using Fireworks AI / Qwen3-32B to personalize the difficulty, quest arc, and feedback loop dynamically:

  1. Customer Agent Generates NPC customers with distinctive Kenyan personalities. It calibrates their shopping lists and budget size based on the child's active difficulty tier.

  2. Tutor Agent (Milo) Monitors calculations in the background. If a child makes a math error, the mascot character Milo (a friendly dragon/toast-style assistant) provides custom, context-aware hints without interrupting the game flow.

  3. Mission Agent Creates narrative daily quests (e.g., saving enough profit to restock the shop for a local festival) that give each session a compelling goal and story structure.

Architecture Workflow

All agent actions are orchestrated through a robust REST interface between Next.js and FastAPI:

[Child's Device (Web App)]
      │ (REST API Requests & Responses)
      ▼
[FastAPI Backend / Gameplay Engine] ──(SQLite DB)
      │
      ▼
[Agent Orchestrator (asyncio.gather)]
      │ (Chat Completions API)
      ▼
[Fireworks AI / Qwen3-32B]

To prevent network or generation latency from blocking gameplay, the orchestrator implements a fail-safe schema validator: if an LLM response is unparseable, it logs the raw output, falls back to a cached scenario, and keeps the player's session running seamlessly.


Technical Stack & Codex Collaboration

SmartDuka was developed in collaboration with OpenAI Codex (GPT-5.6 Terra), utilizing its scaling reasoning capability to go from initial scaffolding to concurrent agent synchronization:

  • Frontend: Next.js (App Router), TypeScript, Zustand (State Management), Tailwind CSS, Framer Motion (Animations).
  • Offline Capabilities: IndexedDB via idb and a robust service worker shell to cache assets, laying the foundation for future offline play.
  • Backend: FastAPI (Python 3.12), SQLAlchemy (async), aiosqlite, and Pydantic v2 validation.
  • Code Generation & Codex Mobile: Codex successfully generated the FastAPI contract layers, adaptive difficulty tier model (7 difficulty levels), and test suites. We utilized Codex Mobile on-the-go to trigger remote edits, run tests, and push updates directly from mobile devices.

The Impact

In East Africa, financial literacy is a survival skill. More than 70% of adults are excluded from formal financial systems. By teaching children to run a budget, calculate change, negotiate out-of-stock substitutions, and manage inventory before age 10, Smart Duka creates a foundational educational intervention with long-term compounding benefits.