Axle AI is a premium, high-density fleet logistics and cargo matching engine. It ingests conversational freight requests from shippers (via WhatsApp), parses cargo properties using Large Language Models, matches them geospatially with carrier vehicles, captures escrow payments, and tracks transit dynamically using an interactive dark-mode map.
- Conversational Order Ingestion: Integrates with the official Meta WhatsApp Cloud API to receive unstructured text messages from shippers.
- LLM Parsing Engine: Leverages Google's
Gemini 2.5 Flash(via the Google GenAI SDK) to extract structured cargo metadata (items, weights, budgets) into validated Pydantic schemas. - Geospatial Matcher: Employs Haversine vector calculations to automatically match cargo requests to the closest compatible available vehicle within a 100km radius.
- Asynchronous Task Queue: Uses Celery + Redis for out-of-band processing, responding to Meta webhooks under 50ms (HTTP 202 Accepted) to comply with carrier timeouts.
- Thread-Safe Eager Fallback: Automatically falls back to a background
ThreadPoolExecutorif the Redis server is unreachable, ensuring Uvicorn is never blocked. - Real-time Driver Telemetry Simulator: Tracks active bookings in
ESCROW_AUTHORIZEDstate, generates linear route interpolation steps, calculates real-time compass bearings, and updates positions in-memory and in SQLite. - Obsidian Control Room Dashboard: A premiumSingle Page Application (SPA) dashboard featuring:
- Unified operations KPI stats.
- Neon status-glow active bookings ledger.
- Inverted dark-mode LeafletJS map tracking moving vehicles in real-time.
- Suggested action triggers to bypass WhatsApp sandbox clients for testing.
Shipper Message (WhatsApp)
β
βΌ
Meta Graph API Webhook βββΊ ngrok Public Tunnel
β
βΌ
FastAPI Server (/webhook) βββΊ Enqueue task (.delay())
β β
(HTTP 202 Accepted, <50ms) βΌ
Celery Worker (Eager Fallback)
β
βββββββββββ΄ββββββββββ
βΌ βΌ
Gemini 2.5 Geospatial Matcher
(LLM Parser) (Haversine Proximity)
β β
βββββββββββ¬ββββββββββ
βΌ
SQLite DB (WAL)
β
βΌ
Operations Dashboard Map
(LeafletJS Inverted Tiles)
Ensure you have Python 3.11+ installed.
- Clone this repository:
git clone https://github.com/Indrasish7/Axle_AI_Cargo_Engine.git cd Axle_AI_Cargo_Engine - Initialize virtual environment and install dependencies:
python -m venv .venv .venv\Scripts\activate # On Windows source .venv/bin/activate # On macOS/Linux pip install -r requirements.txt
Create a .env file in the root directory:
GEMINI_API_KEY=your_gemini_api_key
META_ACCESS_TOKEN=your_meta_whatsapp_access_token
META_PHONE_NUMBER_ID=your_whatsapp_phone_number_id
META_VERIFY_TOKEN=axle_secret_2026For local development, run the services concurrently:
- FastAPI Web API & Dashboard:
python main.py
- Celery Worker:
celery -A src.workers worker --loglevel=info -P solo
- Real-Time Telemetry Simulator:
python src/telemetry_simulator.py
- ngrok Gateway exposure:
python src/gateway_launcher.py
Open your browser and navigate to http://localhost:8000/dashboard to access the Control Room.
- Database Lock Guard: SQLite transactions are forced using
BEGIN IMMEDIATEwrite-locks to prevent database locks or race conditions during concurrent matching sessions. - LLM Isolation: External LLM network requests are processed outside transaction scopes to prevent database lock starvation.
- Secrets Shield: Credentials are kept strictly in
.envand excluded from version control using.gitignore.