Roshan10000/MFDE
๐ง MFDE: Misleading Feedback Decision Environment
  
MFDE is a professional-grade Email Triage Simulation designed to evaluate and train AI agents in handling high-stakes decisions under misleading feedback. Now updated to v2.0 with real Gmail integration and calibrated deterministic scoring.
๐ Real-World Utility (30% Weighting)
In modern Security Operations (SecOps), feedback loops are often corrupted by noisy signals, look-alike domains, and biased human review. MFDE models this "Reality Gap" by forcing agents to choose between:
- Trusting the Evidence: Analyzing the raw email content for deceptive patterns.
- Trusting the Reward: Following potentially corrupted feedback signals that may penalize correct security escalations.
This environment is immediately valuable for the RL community to test agentic resilience and calibration in enterprise-critical workflows.
๐๏ธ v2.0 Extended Features
- Real Gmail connectivity โ Connect any inbox via MCP and triage live telemetry.
- Claude-Powered Inference โ Multi-modal baseline agents for high-fidelity triage.
- Calibrated Scoring โ Strictly deterministic rewards in the (0.02, 0.98) safe range.
- Glassmorphic Dashboard โ Professional real-time analytics for human-in-the-loop monitoring.
๐๏ธ Technical Specifications
Observation Space
The environment provides structured email metadata: | Field | Type | Description | |---|---|---| | email_text | string | The full raw body of the email | | sender | string | The sender address (critical for phishing detection) | | subject | string | The subject line | | step_count | int | Progress within the current task |
Action Space (JSON)
The agent must submit a precise triage decision:
{
"decision": "reply | ignore | escalate",
"priority": "low | medium | high"
}๐ฏ Task Tiers & Difficulty
๐งฎ Reward & Grader Design
Calibrated Tiers
MFDE provides dense signal with strict adherence to OpenEnv range compliance:
- Full Success (Decision & Priority correct):
0.98 - Partial Success (Decision correct only):
0.55 - Failure (Incorrect decision):
0.02
Medium and Hard tasks inject reward noise based on the task difficulty, simulating real-world signal corruption while staying within the (0.01, 0.99) safe interval.
Deterministic Grader
Compliance with the hackathon rubric is guaranteed via grader.py:
- Function:
grade(history) -> float [0.0 - 1.0] - Calculated by averaging total weighted rewards across the trajectory and clamping to 2 decimal places for precision.
๐ Getting Started
Prerequisites
- Python 3.11+
- Docker (for containerized execution)
Local Launch
pip install -r requirements.txt
export ANTHROPIC_API_KEY="your-key-here"
python -m uvicorn app:app --host 0.0.0.0 --port 7860Baseline Inference (Reproduction)
Our inference.py uses the standard OpenAI client and supports heuristic fallbacks:
# Set credentials for Claude AI inference
export HF_TOKEN="your-hf-token"
export API_BASE_URL="https://router.huggingface.co/v1"
python inference.py๐ API Endpoints
๐๏ธ Spec Compliance Checklist
- [x] Typed Models: Full Pydantic V2 implementation in
models.py. - [x] Standard API:
/reset,/step, and/stateendpoints functional. - [x] Containerized:
Dockerfiletested for HF Spaces UID 1000. - [x] Calibrated: Rewards strictly within
(0.01, 0.99). - [x] Structured Logs: Baseline script outputs exact
[START]/[STEP]/[END]format. - [x] Deterministic: All graders are 100% reproducible.
๐ Baseline Scores (Reproduce with random.seed(42))
Reproduced using deterministic heuristic fallback.
๐๏ธ File Structure
mfde-main/
โโโ app.py # FastAPI server (standard + Gmail endpoints)
โโโ env.py # MFDEEnv with Gmail support
โโโ models.py # Pydantic models (incl. Gmail models)
โโโ tasks.py # Simulation task definitions
โโโ grader.py # Grading logic (simulation + Gmail)
โโโ inference.py # AI inference script (simulation + Gmail)
โโโ dashboard.html # Professional Glassmorphic UI
โโโ openenv.yaml # OpenEnv spec
โโโ Dockerfile # HF Spaces compatible (UID 1000)
โโโ requirements.txt # Dependencies