CoolFace
Apppublic

Preet20/openenv-logistics

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
App README

🌍 Global Logistics Dispatcher (OpenEnv)

![OpenEnv Compliant]() ![Python 3.11]() ![License: MIT]()

A stochastic, multi-modal supply chain simulator designed to test frontier LLMs on real-world freight consolidation, cold-chain management, and carbon-cost tradeoffs.

πŸš€ The Problem: Real-World Utility

Most AI benchmarks test simple logic puzzles or static Q&A. In the real enterprise world, AI agents are being deployed to manage supply chainsβ€”a domain defined by Pareto tradeoffs.

Global Logistics Dispatcher models the actual daily challenges of a freight forwarder. To succeed, an LLM agent must navigate:

  1. 1.The Cold Chain: Perishable cargo decays daily. It must be routed through specific, expensive supports_reefer lanes.
  2. 2.Consolidation Economics: Grouping cargo at the same node yields a massive 40% cost discount, forcing the AI to weigh the cost of "waiting" against the discount of "consolidating."
  3. 3.The Carbon vs. Cost Dilemma: Air freight saves perishable food but destroys the sustainability index. Ocean freight is cheap and green but slow.
  4. 4.Stochastic Chaos: A daily 15% probability of global disruptions (Port Strikes, Fuel Surcharges) forces the AI to dynamically reroute cargo mid-transit.

🧠 Environment Design & Mechanics

Observation Space

At each step, the environment provides the agent with the current state of the world, including active shipments, dynamic local routing options (edges), and active global alerts.

json
{
  "current_day": 2,
  "active_shipments": [
    {
      "id": "PERISH-BOM-01",
      "weight_kg": 500.0,
      "commodity": "perishable",
      "status": "warehoused",
      "current_node": "INBOM",
      "days_until_deadline": 10,
      "shelf_life_days_remaining": 8,
      "is_consolidated": false
    }
  ],
  "local_edges": {
    "INBOM": [
      {
        "edge_id": "LANE-002",
        "mode": "air",
        "cost_per_kg": 5.0,
        "transit_days": 1,
        "supports_reefer": true
      }
    ]
  },
  "global_alerts": ["SEVERE: Global port congestion expected."]
}

Action Space

The agent responds with a strictly typed JSON object mapping to one of three core logistics actions:

json
{
  "thought_process": "Brief explanation of the strategy.",
  "action_type": "dispatch_leg",
  "shipment_ids": ["PERISH-BOM-01"],
  "target_edge_id": "LANE-002"
}

πŸ“ˆ Task Difficulty & Progression

The environment exposes 3 strict tasks via reset(task_name="...") to evaluate agent scaling:

LevelTaskDescription
🟒easyRoute standard cargo globally without perishability constraints. Tests basic pathfinding and cost optimization.
🟑mediumManage a mix of standard and perishable cargo. Tests the agent's ability to prioritize the cold-chain and utilize multi-modal transport.
πŸ”΄hardOptimize consolidation and cold-chain routing amidst multiple active shipments and a high probability of severe port strikes/chaos. Tests dynamic rerouting and failure recovery.

βš–οΈ Evaluation & Grader (0.0 to 1.0)

The environment features a deterministic mathematical grader that returns a strict 0.0 to 1.0 score based on the OpenEnv spec.

ComponentWeightDescription
Base ScoreUp to 0.7Awarded for successfully delivering shipments before their deadlines.
Spoilage Penalty-0.5Massive deduction if the AI fails to use reefer-lanes and cargo perishes.
Efficiency BonusUp to 0.3Evaluates the Pareto frontier of the run. Agents earn fractions of this bonus by beating algorithmic benchmarks for Target Budget and Target Carbon Footprint.

πŸ† Baseline Scores

Running our baseline zero-shot LLM agent against the environment yields the following deterministic scores, proving the environment correctly scales in difficulty:

  • β€”πŸŸ’ Easy: 1.0 / 1.0
  • β€”πŸŸ‘ Medium: 1.0 / 1.0
  • β€”πŸ”΄ Hard: 0.63 / 1.0 (The agent struggles with the severe port strike penalty)

πŸ› οΈ Setup & Reproducibility

1. Local Installation

Clone the repository and install the dependencies:

bash
git clone https://github.com/PreetHirani20/openenv-logistics.git
cd openenv-logistics
pip install -r requirements.txt

2. Run the OpenEnv Server

Launch the FastAPI environment physics engine:

bash
uvicorn src.server:app --host 0.0.0.0 --port 7860

3. Run the Baseline Agent

In a separate terminal, run the baseline inference script. This script uses the standard OpenAI client to run all 3 OpenEnv tasks sequentially.

bash
export OPENAI_API_KEY="sk-your-openai-key-here"
python inference.py

4. Docker & Hugging Face Spaces Deployment

The environment is fully containerized and ready for HF Spaces validation.

bash
docker build -t openenv-logistics .
docker run -p 7860:7860 openenv-logistics

πŸ‘€ Author & License

Author: Preet  |  License: MIT