For Developers
Twiga is an open source WhatsApp assistant for Tanzanian teachers. It is MIT licensed and you can run the whole thing yourself.
Here to use Twiga in a classroom rather than run it? The teachers track is the one you want.
A single Python service sits between the WhatsApp Cloud API and a language model. When a teacher sends a message, it works out who they are, retrieves relevant passages from Tanzanian Institute of Education textbooks, lets the model call tools such as lesson planning or exam generation, and sends the answer back as a WhatsApp message.
Everything lives in one Postgres database, including the vector index. There is no separate search service to run.
| Layer | Technology |
|---|---|
| API | FastAPI on Python 3.12, dependencies managed with uv |
| Data | Postgres with pgvector, SQLModel, Alembic migrations |
| Models | Together AI, OpenAI, Google, Modal or local Ollama, through LangChain |
| Messaging | WhatsApp Business Cloud API |
| Rate limiting | Redis, in production and staging only |
| Observability | Prometheus metrics with Grafana dashboards |
| Packaging | Docker, with Compose for local development |
uv if you want to run anything outside a container.You do not need a WhatsApp Business account. The mock interface covers everyday development.
Where this guide comes from
These pages were written by reading the Twiga codebase alongside the documentation in itsdocs/ folder. Where the two disagree, the code wins and the disagreement is called out on the page. Expect the occasional note explaining that a command in the repository README no longer matches what the code does.The Twiga Discord is where the community works, and tech-support is the channel for setup problems. For longer discussions use GitHub Discussions. The source is at Tanzania-AI-Community/twiga.