Current Case View
Everything below is what the model or analyst can currently see. Hidden evidence appears only after the matching investigation step.
Visible Hints
Revealed Evidence
{}
Current State Snapshot
No active episode yet.
"""FastAPI server exposing the FraudShield OpenEnv API.""" from __future__ import annotations import json import logging import os from contextlib import asynccontextmanager from pathlib import Path from typing import Any, Dict from fastapi import FastAPI, HTTPException from fastapi.responses import HTMLResponse, JSONResponse from fraudshield_env import FraudShieldEnvironment, TASK_CONFIG from llm_agent import SnapshotCalibratedFraudDetectionAgent from models import ( ActionTypeEnum, CaseScreenEnum, EpisodeState, FraudCheckAction, FraudCheckObservation, ResetResult, Reward, StepResult, TaskDifficulty, ) logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) ROOT_DIR = Path(__file__).resolve().parents[1] DATA_PATH = ROOT_DIR / "data" APP_VERSION = "0.6.0" env = FraudShieldEnvironment(data_path=str(DATA_PATH), seed=42) @asynccontextmanager async def lifespan(_: FastAPI): """Load the frozen snapshot on startup.""" if not env.load_data(): logger.error("FraudShield failed to load bundled data from %s", DATA_PATH) yield app = FastAPI( title="FraudShield", description=( "Simulated fraud-investigation environment for OpenEnv. Agents operate under partial " "observability, reveal evidence with investigation tools, and route cases under limited budgets." ), version=APP_VERSION, docs_url="/docs", openapi_url="/openapi.json", lifespan=lifespan, ) def _explorer_html() -> str: return """
FraudShield is a simulated fraud review workflow. You start with a small amount of triage information, choose what evidence to inspect, and then make a final case decision.
Easy, medium, and hard tasks reveal different amounts of ambiguity and linked-case complexity.
Use the workflow actions to reveal customer, merchant, network, payment, or policy evidence.
Add a note when required, then approve, hold, request documents, block, or escalate.
Everything below is what the model or analyst can currently see. Hidden evidence appears only after the matching investigation step.
{}
No active episode yet.