An OpenEnv-compatible multi-agent RL environment for training and evaluating
fraud detection policies.
Two agents interact every episode:
Defender (LLM / PPO) — learns to detect and block fraudulent activity.
Fraudster (LLM / PPO) — acts as an adaptive adversary trying to launder money.
The world is partially observable — agents see different, noisy views derived
from the same hidden ground truth.
Quick start
bash
1# Install dependencies2pip install -e ".[dev]"3# or with uv:4uv sync56# Start the environment server7uv run server
8# or: python -m scam_detection.server.app910# In a second terminal, run the LLM agent (inference)11exportHF_TOKEN=<your_token>12exportMODEL_NAME=Qwen/Qwen2.5-72B-Instruct
13exportAPI_BASE_URL=https://router.huggingface.co/v1
14python inference.py
1516# Or run offline PPO training (no server needed)17python train.py --episodes 200 --task mule_cashout
1819# Evaluate trained vs baseline20python evaluate.py --episodes 20
With Docker:
bash
1docker build -t fraud-detection-env:latest .2docker run -p 8000:8000 fraud-detection-env:latest
3python inference.py # connects via ENV_URL
Fraud families (task variants)
Task name
Description
refund_abuse
Mule users repeatedly buy and refund to extract value
mule_cashout
Stolen funds layered through a chain of mule accounts
Grading is saved to episode_grades.csv. Full rollout history (per-step
observations, actions, rewards) is saved to rollout_history.csv for
fine-tuning.