A lightweight CrewAI-aligned prototype for the fictional Ujima SACCO capstone, now with Flow-first orchestration, Streamlit-based human review, SQLite reviewer history, and member-friendly explanation cards.
Live app: https://ujima-agent-pride-prototype-kyhlhcxanntvgroknhvmuf.streamlit.app/
This repo also includes a Streamlit front end in app.py.
Run locally:
pip install -r requirements.txt
streamlit run app.pyThe app runs in deterministic template mode by default so it stays stable for deployment.
The deployed demo now uses a Flow-first orchestration layer in ujima_flow.py and exposes an execution trace in the UI.
It also stores reviewer decisions in SQLite via review_store.py and renders plain-language explanation cards from explanations.py.
You can also run the sample evaluator locally:
python evaluate_flow.pyThe deployed demo includes a Streamlit-based human review checkpoint for escalated cases.
What it does:
- cases that require escalation surface a review packet
- a human reviewer can choose:
approve_for_human_queuereturn_for_more_informationreject_recommendation
- the workflow trace and audit notes are updated in the UI
- reviewer decisions are saved locally in
data/review_history.db - the results area includes member-friendly explanation cards for the risk flags that were detected
Why this matters: This demonstrates the PRIDE-style pause point from the capstone, even when the app is running in a public web demo environment.
The top status row now uses custom stat cards so long values do not get cut off in narrow columns.
To enable live CrewAI/OpenAI outputs on Streamlit Community Cloud, add these secrets in the app settings:
OPENAI_API_KEY = "your_real_key_here"
MODEL_NAME = "gpt-4o-mini"
USE_CREWAI = true- 3-agent ecosystem:
- Scout Agent (financial literacy coach)
- Guardian Agent (Tier-1 loan triage)
- Hunter Agent (human-in-the-loop coordinator)
- Bounded autonomy
- Human escalation for complex or welfare-sensitive cases
- Dignity-preserving communication
- Simple safety rails and audit-friendly outputs
This capstone is Kenya-first and SACCO-specific. The prototype keeps:
- raw case handling local
- explicit escalation for sensitive cases
- occupation labels from being treated as destiny
- seasonal-income awareness in the decision path
Use a Python environment of your choice, then run:
conda activate [your env name]
python prototype.pyIf you prefer venv, activate that environment instead and run the same command.
Outputs will appear in the output/ folder.
For the deployed demo, use:
streamlit run app.pyIf you have a working API key and want LLM-generated outputs:
- Copy .env.example to .env
- Add your API key
- Set:
USE_CREWAI=trueIf USE_CREWAI=false, the prototype still runs in deterministic template mode.
- case_1_tier1_market_vendor.json
- case_2_school_fees_escalation.json
- case_3_loan_shark_signal.json
This repository is licensed under the MIT License. See LICENSE for the full text.