anuragnimkande/logisticshub-360-openenv
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
LogisticsHub-360: Intelligent E-Commerce Operations Environment
    
Overview
LogisticsHub-360 is a production-grade, OpenEnv-compliant AI evaluation environment designed to benchmark intelligent agents on real-world e-commerce backend operations. Built for the Meta + Hugging Face OpenEnv Hackathon, it provides a fully stateful, multi-step simulation of logistics workflows—where the AI agent must reason, plan, and execute sequences of API calls to resolve business-critical scenarios.
Unlike toy environments with binary rewards, LogisticsHub-360 implements dense, per-step reward signals, partial observability, loop detection, and deterministic multi-dimensional graders that score agents on correctness, efficiency, and decision quality.
Why This Environment Matters
E-commerce logistics is one of the most high-stakes, time-sensitive domains in modern business. A delayed shipment costs customer trust. A stockout mishandled costs both a sale and a relationship. Logan the logistics agent must navigate these situations with the same care and precision as a senior operations team. This environment tests whether an AI can meet that bar.
Environment Design
Architecture
┌──────────────────────────────────────────────────────────────────┐
│ LogisticsHub-360 Environment │
│ │
│ ┌──────────┐ Action ┌───────────────┐ ToolResult │
│ │ Agent │ ─────────► │ Tool Layer │ ──────────┐ │
│ │ (LLM) │ │ (6 APIs) │ │ │
│ └──────────┘ └───────────────┘ ▼ │
│ ▲ ┌─────────────────┐ │
│ │ Observation │ State Manager │ │
│ └────────────────────────────────── │ (InternalState)│ │
│ └─────────────────┘ │
│ │ │
│ ┌────────▼────────┐ │
│ │ Reward Engine │ │
│ │ + Graders │ │
│ └─────────────────┘ │
└──────────────────────────────────────────────────────────────────┘Core Properties
Observation Space
Each step returns a structured Observation object:
class Observation(BaseModel):
task_id: str # Task being evaluated
task_description: str # Full natural language description
difficulty: TaskDifficulty # easy | medium | hard
system_logs: List[str] # Recent system log entries (last 10)
order_status: Optional[OrderInfo] # Current order details
inventory_state: Optional[InventoryInfo] # Product inventory and warehouses
customer_sentiment: float # 0.0 (hostile) → 1.0 (satisfied)
available_tools: List[str] # List of callable tool names
action_history: List[ActionHistoryEntry] # History of past actions + rewards
hints: List[str] # Task-specific guidance hints
constraints: List[str] # Rules the agent must not violate
step_count: int # Current step number
max_steps: int # Episode step budget
is_done: bool # Whether the episode has terminated
last_reward: Optional[float] # Reward from the previous actionAction Space
Agents submit actions as structured Action objects:
class Action(BaseModel):
tool: ToolName # One of 6 available tools (enum)
parameters: Dict[str, Any] # Tool-specific parameters
metadata: Optional[Dict] # Optional agent metadataAvailable Tools
Task Descriptions
🟢 Task 1: Order Tracking (Easy)
Scenario: A customer inquires about order ORD-88421 (Wireless Headphones). The order was shipped 3 days ago but tracking hasn't updated. Customer sentiment: 0.65.
Objective: Call get_tracking to retrieve the current status, then notify the customer via update_crm.
Expected Sequence:
get_tracking → update_crmMax Steps: 8 | Success Criteria: Both tracking checked + CRM updated.
🟡 Task 2: Shipment Rerouting (Medium)
Scenario: Order ORD-44790 (Security Camera) is DELAYED due to severe weather at hub WH-WEST-05. Customer sentiment is critically low at 0.35.
Objective: Detect the delay, identify alternate stock, locate the optimal rerouting warehouse, execute the reroute, and notify the customer.
Expected Sequence:
get_tracking → check_inventory → find_warehouse → reroute_order → update_crmMax Steps: 15 | Success Criteria: Full 5-step sequence completed correctly.
🔴 Task 3: Stockout Crisis Resolution (Hard)
Scenario: Order ORD-99123 (Gaming Laptop) is DELAYED and the product is COMPLETELY OUT OF STOCK across all warehouses. Customer sentiment: 0.20 (critical).
Objective: Verify the stockout through inventory check, attempt warehouse lookup (which fails), then issue a refund (not a reroute), and update the CRM.
Critical Branching Decision: If the agent attempts to reroute instead of issuing a refund despite confirmed stockout, it receives a -1.0 destructive action penalty.
Expected Sequence:
get_tracking → check_inventory → find_warehouse → issue_refund → update_crmMax Steps: 20 | Success Criteria: Refund issued (not reroute) + CRM updated.
Reward Function
Per-Step Rewards
Terminal Rewards
Final Grading Weights
Setup Instructions
Prerequisites
- Python 3.11+
- A Hugging Face account with API token (free tier works)
Local Installation
# Clone the repository
git clone https://github.com/your-org/logisticshub-360-openenv.git
cd logisticshub-360-openenv
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtEnvironment Validation
# Validate environment can be imported and run
python -c "
from env.environment import LogisticsHub360Env
env = LogisticsHub360Env('order_tracking')
obs = env.reset()
print('✅ Environment validated successfully')
print(f' Task: {obs.task_id}')
print(f' Max Steps: {obs.max_steps}')
print(f' Tools: {obs.available_tools}')Running the Interactive Web App (Gradio)
LogisticsHub-360 includes a rich interactive web UI where you can play as the agent in Human Mode, or watch the AI solve tasks in AI Agent Mode.
# Set your HF token (Required for AI Agent Mode)
export HF_TOKEN="your_token_here" # On Windows PowerShell: $env:HF_TOKEN="your_token_here"
# Start the web app
python app.py
# To specify a different port (default is 7860)
PORT=7865 python app.py # On Windows PowerShell: $env:PORT="7865"; python app.pyOpen http://127.0.0.1:7860 (or your chosen port) in your browser to view the interface.
Running the Baseline Agent
# Set your HF token
export HF_TOKEN=your_token_here
# Run all tasks
python scripts/run_inference.py
# Run a specific task
python scripts/run_inference.py --task order_tracking
# Save results to JSON
python scripts/run_inference.py --output results.json
# Quiet mode (no step-by-step output)
python scripts/run_inference.py --quietDocker Usage
Build
docker build -t logistics-env .Run (requires HF token)
# Run the full evaluation
docker run -e HF_TOKEN=your_token_here logistics-env
# Run a specific task
docker run -e HF_TOKEN=your_token_here logistics-env --task shipment_rerouting
# With custom model
docker run \
-e HF_TOKEN=your_token_here \
-e LH360_MODEL=meta-llama/Llama-3.1-8B-Instruct \
logistics-envEnvironment Variables
Hugging Face Spaces Deployment
- Fork this repository to your HF account
- Create a new Docker Space
- Link to your repository
- Add
HF_TOKENas a Space secret - Push — the Space will auto-build from the
Dockerfile
API Usage (Python)
from env.environment import LogisticsHub360Env
from env.models import Action, ToolName
# Initialize environment
env = LogisticsHub360Env(task_id="shipment_rerouting")
obs = env.reset()
# Step through manually
action = Action(
tool=ToolName.GET_TRACKING,
parameters={"order_id": "ORD-44790"}
)
obs, reward, done, info = env.step(action)
print(f"Reward: {reward:.3f}")
print(f"Info: {info['explanation']}")
# Get debug state (full internal state — not visible to agent)
debug_state = env.state()
# Final grade
grade = env.grade_episode()
print(f"Episode Grade: {grade:.4f}")Example Output
======================================================================
TASK: ORDER_TRACKING | Difficulty: easy
======================================================================
Description: A customer (ID: C-1001) is inquiring about the status of their order...
[Step 1/8] Tool: get_tracking | Params: {'order_id': 'ORD-88421'}
→ Reward: +0.500 | Cumulative: +0.500
→ Valid tool 'get_tracking' executed (+0.30). Correct sequence step #1 (+0.20).
[Step 2/8] Tool: update_crm | Params: {'order_id': 'ORD-88421', 'message': 'Your order ORD-88421 is currently...'}
→ Reward: +1.850 | Cumulative: +2.350
→ Valid tool 'update_crm' executed (+0.30). Correct sequence step #2 (+0.20). Completion bonus (+1.00). Efficiency bonus (+0.30).
✅ Task 'order_tracking' complete.
Cumulative Reward : 2.3500
Final Grade : 0.9500 / 1.0
Steps Used : 2 / 8
Customer Sentiment: 0.70Baseline Performance
Baseline numbers are indicative. Actual results vary with model version and API latency.
Project Structure
logisticshub-360-openenv/
├── env/
│ ├── __init__.py # Public API exports
│ ├── environment.py # OpenEnv interface: reset(), step(), state()
│ ├── models.py # Pydantic data models (Action, Observation, etc.)
│ ├── tasks.py # Task definitions and initial state builders
│ ├── graders.py # Dense reward engine + deterministic graders
│ ├── tools.py # Tool implementations (6 logistics APIs)
│ └── utils.py # Logging, loop detection, metrics, serialization
├── scripts/
│ └── run_inference.py # Baseline LLM agent runner
├── configs/
│ └── config.yaml # Tunable parameters (rewards, steps, model)
├── openenv.yaml # OpenEnv specification manifest
├── requirements.txt # Python dependencies
├── Dockerfile # Production container
└── README.md # This fileConfiguration
Edit configs/config.yaml to adjust:
- Task difficulty and step budgets
- Reward magnitudes (penalties and bonuses)
- Loop detection sensitivity
- Model and inference settings
License
MIT — see LICENSE for details.
Citation
If you use LogisticsHub-360 in your research or evaluation work, please cite:
@misc{logisticshub360,
title = {LogisticsHub-360: Intelligent E-Commerce Operations Environment},
year = {2026},
note = {Submitted to Meta + Hugging Face OpenEnv Hackathon},
url = {https://github.com/your-org/logisticshub-360-openenv}
}