An intelligent research assistant for Kenyan educators to create localized, contextual educational content that bridges the context deficit in education.
Project description
Elimu Research Assistant
An AI research agent for Kenyan educators that generates locally-grounded educational content using a ReAct (Reasoning + Acting) loop over live web search.
What It Does
Given a teaching request such as "Create a Form 3 Business Studies lesson on M-Pesa's impact on small enterprises", the agent:
- Reasons about what to search and in what order
- Executes web searches via Serper.dev, biased toward
.keand East African domains - Scrapes and cleans source pages for relevant content
- Iterates (up to 12 reasoning steps by default) until it can synthesize a cited, structured educational artefact
- Returns classroom-ready output: lesson plan, case study, handout, or assessment, depending on the request
Architecture
CLI / Streamlit
│
▼
build_elimu_agent() ← elimu_react/__init__.py
│
├── LLMInterface ← Google Gemini 2.x (primary: gemini-2.0-flash)
│ └── model fallback chain (2.0-flash → 2.5-flash → 2.5-pro)
│
├── ToolManager
│ ├── SearchTool ← Serper.dev (Google Search API)
│ │ └── Kenya bias: appends "Kenya", prioritises .ke / .ac.ke
│ └── ScrapeTool ← requests + BeautifulSoup, 6 000 char limit
│
└── ReActAgent ← elimu_react/agent.py
└── run(task) → ReAct loop (max 15 iters)
Thought → Action → Observation → … → Final Answer
ReAct Loop (elimu_react/agent.py)
Each iteration:
- Build a prompt: system instructions + tool descriptions + task + prior steps
- Call LLM → parse
Thought,Action,Action Input, orFinal Answer - If action: dispatch to
SearchToolorScrapeTool, collect observation - Append step to trace; repeat
- On
Final Answeror exhausted iterations → return synthesis
The system prompt instructs the model to produce classroom-ready artefacts with Kenyan examples and cited sources, and to never fabricate URLs or statistics.
Configuration (config/config.py)
Credentials and settings are resolved in priority order: .env → environment variables → system keyring. Non-sensitive settings persist in ~/.elimu_research_assistant/config.json.
| Key | Default | Description |
|---|---|---|
gemini_api_key |
— | Required. Google Gemini API key |
serper_api_key |
— | Required. Serper.dev API key |
model_name |
gemini-2.0-flash |
Primary LLM model |
model_fallback |
gemini-2.5-flash |
Fallback on 404/quota |
model_temperature |
0.15 |
Low temperature for factual output |
max_iterations |
12 |
ReAct loop cap |
max_tool_output_length |
6000 |
Observation truncation (chars) |
educational_focus |
True |
Adds "classroom" to education queries |
prioritize_kenyan_sources |
True |
Biases search toward .ke domains |
Installation
git clone https://github.com/ashioyajotham/elimu_research_assistant.git
cd elimu_research_assistant
pip install -e .
API Keys
You need two keys:
- Google Gemini: aistudio.google.com — free tier available
- Serper.dev: serper.dev — 2 500 free searches/month
elimu config --api-key YOUR_GEMINI_KEY
elimu config --serper-key YOUR_SERPER_KEY
Keys are stored in the Windows system keyring by default, or in .env if keyring is unavailable.
CLI Usage
# Single research task
elimu research "Create a Form 3 lesson on M-Pesa's impact on small enterprises"
# Batch from file (one task per line or blank-line-separated blocks)
elimu batch-research tasks.txt --output results/
# Interactive shell with history and autocomplete
elimu shell
# Configuration
elimu config --show
elimu config --model gemini-2.5-pro
elimu config --format markdown # markdown | json | html
Output files are saved to results/result_<sanitized-query>.md by default.
Streamlit Webapp
pip install streamlit
streamlit run streamlit_app.py
The webapp exposes the same research agent with a browser UI: sidebar configuration, research input, expandable ReAct trace, and inline result rendering.
Project Structure
elimu_research_assistant/
├── elimu_react/ # ReAct agent engine
│ ├── agent.py # ReActAgent: reasoning loop
│ ├── llm.py # LLMInterface: Gemini wrapper with fallback
│ └── tools/
│ ├── search.py # SearchTool (Serper.dev)
│ └── scrape.py # ScrapeTool (requests + BS4)
├── config/
│ ├── config.py # ElimuConfigManager: env / keyring / file
│ └── config_manager.py # BaseConfigManager
├── utils/
│ ├── console_ui.py # Rich theme, panels, progress
│ ├── react_output.py # Markdown serialiser for ReAct traces
│ └── task_parser.py # Multi-line task file parser
├── cli.py # Click CLI entry point
├── streamlit_app.py # Streamlit webapp
└── pyproject.toml
Development
pip install -r requirements.txt
python -m pytest
Logs are written to logs/agent.log. Set --verbose on any CLI command for INFO-level output.
License
MIT — see LICENSE.
Author
Ashioya Jotham · victorashioya960@gmail.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file elimu_research_assistant-1.2.8.tar.gz.
File metadata
- Download URL: elimu_research_assistant-1.2.8.tar.gz
- Upload date:
- Size: 56.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92d473aa51b74846ccae98d47004f5aa2b23a995117b049dd3f3c7968d3b6f8d
|
|
| MD5 |
6adb67f55b5e7d2611309bbc7dcb0607
|
|
| BLAKE2b-256 |
0d4adee7b024e73c34eade746ab81bbeada709d2c4338f7b08a75cbce646ee6e
|
Provenance
The following attestation bundles were made for elimu_research_assistant-1.2.8.tar.gz:
Publisher:
publish.yml on ashioyajotham/Elimu-Research-Assistant
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
elimu_research_assistant-1.2.8.tar.gz -
Subject digest:
92d473aa51b74846ccae98d47004f5aa2b23a995117b049dd3f3c7968d3b6f8d - Sigstore transparency entry: 1280855311
- Sigstore integration time:
-
Permalink:
ashioyajotham/Elimu-Research-Assistant@3ecc19efb0d01928268f9bf7e748eb9ee2da6d45 -
Branch / Tag:
refs/tags/v1.2.8 - Owner: https://github.com/ashioyajotham
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3ecc19efb0d01928268f9bf7e748eb9ee2da6d45 -
Trigger Event:
release
-
Statement type:
File details
Details for the file elimu_research_assistant-1.2.8-py3-none-any.whl.
File metadata
- Download URL: elimu_research_assistant-1.2.8-py3-none-any.whl
- Upload date:
- Size: 51.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
daf8c312814dd784bec10c3c9fef112f53c6d642efbecca0ff2acaac9753af96
|
|
| MD5 |
ddcb2a9f722c895349a7b16005fe3e71
|
|
| BLAKE2b-256 |
f288cad0ae3ef1f68345f7203ce57c9c2e763e9d199a5653bfaa58d3858c5c19
|
Provenance
The following attestation bundles were made for elimu_research_assistant-1.2.8-py3-none-any.whl:
Publisher:
publish.yml on ashioyajotham/Elimu-Research-Assistant
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
elimu_research_assistant-1.2.8-py3-none-any.whl -
Subject digest:
daf8c312814dd784bec10c3c9fef112f53c6d642efbecca0ff2acaac9753af96 - Sigstore transparency entry: 1280855316
- Sigstore integration time:
-
Permalink:
ashioyajotham/Elimu-Research-Assistant@3ecc19efb0d01928268f9bf7e748eb9ee2da6d45 -
Branch / Tag:
refs/tags/v1.2.8 - Owner: https://github.com/ashioyajotham
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3ecc19efb0d01928268f9bf7e748eb9ee2da6d45 -
Trigger Event:
release
-
Statement type: