This publication presents a comprehensive multi-agent system designed to empower Kenyan businesses with intelligent procurement decisions. The system employs specialized AI agents for automated market analysis, price forecasting, and compliance verification, integrating robust database logging and human-in-the-loop feedback mechanisms. This innovative framework aims to transform traditional procurement into an efficient, data-driven process, ensuring high-quality, cost-effective, and compliant purchasing outcomes.
In today's rapidly evolving global and local markets, effective procurement is a cornerstone of business success. However, traditional procurement processes in Kenya are often characterized by manual effort, fragmented data sources, and a lack of real-time market intelligence. This leads to several persistent challenges:
Market Volatility: Fluctuating prices and supply chain disruptions make it difficult to secure optimal deals.
Information Overload: Sifting through vast amounts of product data, supplier information, and regulatory requirements is time-consuming.
Compliance Risks: Navigating complex tax laws (e.g., KRA VAT, import duties) and verifying supplier legitimacy can expose businesses to financial and legal risks.
Inefficient Decision-Making: Without comprehensive analysis, procurement decisions may be suboptimal, leading to increased costs or missed opportunities.
Recognizing these critical challenges, we have developed the Kenya Smart Procurement AI System, a sophisticated multi-agent system that fundamentally transforms how procurement decisions are made. Our approach centers on the implementation of specialized AI agents, each designed to excel at distinct aspects of the procurement process while working collaboratively toward a unified goal.
The system incorporates comprehensive database logging capabilities that create detailed audit trails, enabling businesses to track procurement progress, understand decision-making processes, and maintain complete visibility into their purchasing workflows. Rather than replacing human expertise, our solution integrates strategic human feedback loops that enhance quality and preserve control, allowing procurement managers to guide and refine automated processes according to their strategic objectives.
At the heart of our solution lies a sophisticated multi-agent architecture that orchestrates four specialized AI agents, each contributing unique capabilities to the procurement process.
Market Intelligence Agent: Serves as the data acquisition foundation, intelligently gathering and processing market data from platforms like Jumia, Amazon, and Google Shopping.
Price Strategist Agent: Performs advanced analytics for forecasting and cost optimization, including KRA tax calculations and ML-based price predictions.
Compliance Auditor Agent: Provides automated assessment and verification of seller legitimacy and risk.
Supervisor Agent: Acts as the master conductor, synthesizing all agent outputs into a final, actionable procurement recommendation.
The following diagram illustrates the high-level interaction and flow between the agents and external tools within the system:

Our system's robustness stems from its sophisticated database integration layer, which includes custom tools specifically designed for comprehensive workflow logging and optimization. The system leverages Pydantic models (defined in core/models.py) to structure data, ensuring consistency and facilitating seamless data exchange between agents

To ensure the platform is production-ready, we have implemented several enhancements focusing on configuration, API reliability, and resilience across the stack.
Configuration is centralized and managed through environment variables (.env), promoting clean startup in both development and production environments. All critical directories resolve to absolute, sandboxed paths under the project root to prevent path drift across hosts and containers.
Resilience is addressed through explicit retry strategies with exponential backoff for external LLM calls, graceful fallbacks in mock mode for data processing, and deterministic naming conventions to avoid collisions. The orchestration layer, built with LangGraph, incorporates a critique loop and approval gate so that only validated information progresses downstream.
Docker Engine: 20.10+
Docker Compose: 2.0+
Memory: 8GB RAM minimum (16GB recommended)
API Key: Google Gemini API key (or OpenAI API key depending on configuration)
git clone https://github.com/Yassin351/MUILT-AGENT-FOR-PRODUCTION.git
cd MUILT-AGENT-FOR-PRODUCTION
mkdir -p logs data outputs temp
Create environment file
cp .env.sample .env
Configure API credentials in .env
GOOGLE_API_KEY=your_gemini_api_key_here
ENVIRONMENT=production
LOG_LEVEL=INFO
docker-compose up --build -d
docker-compose ps
curl -X POST http://localhost:5000/api/procure
-H "Content-Type: application/json"
-d '{
"query": "Samsung Galaxy A54",
"category": "electronics"
}'
Safety and security are implemented in layers to protect the system and its users:
Input Validation: Prevents common attacks like XSS and SQL injection, enforces length limits, and uses pattern matching for user inputs.
Output Filtering: Ensures agent outputs are safe and policy-compliant, redacting sensitive information (e.g., emails, phone numbers, credit card details ).
Platform Side: SQLAlchemy parameterization guards against SQL injection, and CORS policies restrict cross-origin access.
Testing emphasizes breadth, determinism, and operational realism to ensure the system's reliability and correctness.
Unit & Integration Tests: Verify agent utilities, validation logic, and API surface.
End-to-End Tests: Execute the full multi-agent workflow in mock mode.
Coverage: The test suite runs under pytest with pytest-cov, reporting approximately 70%+ line coverage across backend modules.
The interface is designed to feel fast, informative, and polished, providing an intuitive experience for procurement professionals.
Installation challenges typically manifest in Docker build failures or port conflicts. Ensure ports 8501 and 7860 are available. Runtime complications emerge primarily from resource constraints or API rate limits; the system implements exponential backoff to maintain stability.
Comprehensive documentation is available in the docs/ directory. Community-driven support is provided via GitHub Issues and Discussions
This project is licensed under the MIT License.
Data privacy is a fundamental priority. All user inputs and generated recommendations remain the exclusive property of the user. Core processing occurs within your deployment environment to minimize external data exposure
This system represents a paradigm shift in automated procurement, demonstrating that complex decision-making can be effectively decomposed into specialized, collaborative AI agents while maintaining professional standards
Future directions include Adaptive Learning Integration, where the system learns from user feedback patterns, and Cross-Modal Content Generation for interactive procurement reports and augmented reality inventory management.
LangGraph Documentation - Orchestration framework for stateful, multi-agent applications.
[2] Google Gemini API - Large Language Model (LLM) powering the system's reasoning and natural language capabilities.
[3] Pydantic V2 - Data validation and settings management using Python type annotations.
[4] Streamlit - Framework for building interactive web applications for data science and machine learning.
[5] Gradio - Open-source Python library for creating customizable UI components for machine learning models.
[6] Prophet: Forecasting at Scale - Open-source library for forecasting time series data based on an additive model.
[7] Tesseract OCR - Optical Character Recognition (OCR) engine for extracting text from images and documents.
[8] Tenacity - Retrying library for Python to simplify the task of adding retry behavior to functions.
[9] Loguru - Library that aims to make logging in Python enjoyable and structured.
[10] SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper for secure database interactions.References