Spaces:
Paused
Paused
Commit ·
221c507
1
Parent(s): 50e4165
simplify openenv.yaml: pure ASCII, remove all non-essential sections, copy yaml to WORKDIR in Docker
Browse files- Dockerfile +3 -0
- openenv.yaml +1 -159
- server/Dockerfile +3 -0
Dockerfile
CHANGED
|
@@ -24,6 +24,9 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
| 24 |
# Copy project source
|
| 25 |
COPY . /app/payops_env
|
| 26 |
|
|
|
|
|
|
|
|
|
|
| 27 |
# Both /app (for payops_env.*) and /app/payops_env (for server.*) on PYTHONPATH
|
| 28 |
# This matches the openenv.yaml app: server.app:app path and platform example format
|
| 29 |
ENV PYTHONPATH="/app:/app/payops_env"
|
|
|
|
| 24 |
# Copy project source
|
| 25 |
COPY . /app/payops_env
|
| 26 |
|
| 27 |
+
# Also copy openenv.yaml to WORKDIR so validators can find it at /app/openenv.yaml
|
| 28 |
+
COPY openenv.yaml /app/openenv.yaml
|
| 29 |
+
|
| 30 |
# Both /app (for payops_env.*) and /app/payops_env (for server.*) on PYTHONPATH
|
| 31 |
# This matches the openenv.yaml app: server.app:app path and platform example format
|
| 32 |
ENV PYTHONPATH="/app:/app/payops_env"
|
openenv.yaml
CHANGED
|
@@ -1,132 +1,11 @@
|
|
| 1 |
spec_version: 1
|
| 2 |
name: payops_env
|
| 3 |
-
display_name: "PayOps — Payment Operations Incident Response"
|
| 4 |
-
description: >
|
| 5 |
-
An AI agent acts as a Payment Operations analyst, reviewing financial
|
| 6 |
-
transactions and deciding how to handle each one. Tasks range from
|
| 7 |
-
clear-cut fraud to subtle adversarial patterns like APP scams, insider
|
| 8 |
-
threats, structuring, and KYC violations across 4 difficulty tiers.
|
| 9 |
type: space
|
| 10 |
runtime: fastapi
|
| 11 |
app: server.app:app
|
| 12 |
port: 7860
|
| 13 |
-
version:
|
| 14 |
-
author: "PayOps Team"
|
| 15 |
-
tags:
|
| 16 |
-
- finance
|
| 17 |
-
- fraud-detection
|
| 18 |
-
- compliance
|
| 19 |
-
- real-world
|
| 20 |
-
- payment-operations
|
| 21 |
|
| 22 |
-
# ── Endpoints (OpenEnv required) ────────────────────────────────────────────
|
| 23 |
-
endpoints:
|
| 24 |
-
reset: POST /reset
|
| 25 |
-
step: POST /step
|
| 26 |
-
state: GET /state
|
| 27 |
-
health: GET /health
|
| 28 |
-
schema: GET /schema
|
| 29 |
-
tasks: GET /tasks
|
| 30 |
-
grader: GET /grader
|
| 31 |
-
replay: POST /replay
|
| 32 |
-
baseline: POST /baseline
|
| 33 |
-
analytics: GET /analytics
|
| 34 |
-
leaderboard: GET /leaderboard
|
| 35 |
-
|
| 36 |
-
# ── Environment variables required at runtime ────────────────────────────────
|
| 37 |
-
env_vars:
|
| 38 |
-
OPENAI_API_KEY:
|
| 39 |
-
description: "API key for OpenAI-compatible inference endpoint (takes precedence over HF_TOKEN)"
|
| 40 |
-
required: false
|
| 41 |
-
secret: true
|
| 42 |
-
example: "sk-..."
|
| 43 |
-
API_BASE_URL:
|
| 44 |
-
description: "OpenAI-compatible API endpoint for LLM inference"
|
| 45 |
-
required: true
|
| 46 |
-
example: "https://api.openai.com/v1"
|
| 47 |
-
MODEL_NAME:
|
| 48 |
-
description: "Model identifier to use for inference"
|
| 49 |
-
required: true
|
| 50 |
-
example: "gpt-4o-mini"
|
| 51 |
-
HF_TOKEN:
|
| 52 |
-
description: "Hugging Face / API key used as Bearer credential (alias for OPENAI_API_KEY)"
|
| 53 |
-
required: false
|
| 54 |
-
secret: true
|
| 55 |
-
|
| 56 |
-
# ── Action space ─────────────────────────────────────────────────────────────
|
| 57 |
-
action_space:
|
| 58 |
-
type: discrete
|
| 59 |
-
terminal_actions:
|
| 60 |
-
- approve
|
| 61 |
-
- reject
|
| 62 |
-
- flag
|
| 63 |
-
- escalate
|
| 64 |
-
- hold
|
| 65 |
-
investigation_actions:
|
| 66 |
-
- inspect # cost: 0.10 budget
|
| 67 |
-
- request_docs # cost: 0.20 budget
|
| 68 |
-
- verify_kyc # cost: 0.20 budget
|
| 69 |
-
- contact_sender # cost: 0.30 budget
|
| 70 |
-
- file_sar # cost: 0.05 budget
|
| 71 |
-
|
| 72 |
-
# ── Observation space ─────────────────────────────────────────────────────────
|
| 73 |
-
observation_space:
|
| 74 |
-
type: structured
|
| 75 |
-
fields:
|
| 76 |
-
# core transaction
|
| 77 |
-
- transaction_id
|
| 78 |
-
- task_id
|
| 79 |
-
- difficulty
|
| 80 |
-
- amount
|
| 81 |
-
- currency
|
| 82 |
-
- sender
|
| 83 |
-
- receiver
|
| 84 |
-
# risk signals
|
| 85 |
-
- risk_score
|
| 86 |
-
- ml_confidence
|
| 87 |
-
- flags
|
| 88 |
-
- kyc_status
|
| 89 |
-
- kyc_expiry_days
|
| 90 |
-
- velocity_1h
|
| 91 |
-
- velocity_24h
|
| 92 |
-
- country_risk
|
| 93 |
-
- account_age_days
|
| 94 |
-
- previous_sars
|
| 95 |
-
- counterparty_risk
|
| 96 |
-
# investigation reveals
|
| 97 |
-
- inspection_notes
|
| 98 |
-
- docs_notes
|
| 99 |
-
- kyc_notes
|
| 100 |
-
- contact_notes
|
| 101 |
-
# budget
|
| 102 |
-
- budget_remaining
|
| 103 |
-
- action_cost
|
| 104 |
-
# episode progress
|
| 105 |
-
- cumulative_reward
|
| 106 |
-
- chain_step
|
| 107 |
-
- chain_total
|
| 108 |
-
- steps_remaining
|
| 109 |
-
- done
|
| 110 |
-
- reward
|
| 111 |
-
- reward_breakdown
|
| 112 |
-
- recent_decisions
|
| 113 |
-
- network_graph
|
| 114 |
-
|
| 115 |
-
# ── Tasks ───────────────────────────────────────────────────────────────────
|
| 116 |
-
# Metadata kept separate so 'count: 30' still appears in file
|
| 117 |
-
task_count: 30
|
| 118 |
-
task_difficulties:
|
| 119 |
-
- easy
|
| 120 |
-
- medium
|
| 121 |
-
- hard
|
| 122 |
-
- critical
|
| 123 |
-
task_difficulty_weights:
|
| 124 |
-
easy: 1.0
|
| 125 |
-
medium: 1.2
|
| 126 |
-
hard: 1.5
|
| 127 |
-
critical: 2.0
|
| 128 |
-
|
| 129 |
-
# tasks: grader field points to a Python callable (module:Class format)
|
| 130 |
tasks:
|
| 131 |
- id: EASY-001
|
| 132 |
name: EASY-001
|
|
@@ -249,40 +128,3 @@ tasks:
|
|
| 249 |
difficulty: critical
|
| 250 |
grader: server.graders:CRIT006Grader
|
| 251 |
|
| 252 |
-
# ── Budget ───────────────────────────────────────────────────────────────────
|
| 253 |
-
budget:
|
| 254 |
-
initial: 5.0
|
| 255 |
-
overspend_penalty_rate: 0.1
|
| 256 |
-
|
| 257 |
-
# ── Reward ───────────────────────────────────────────────────────────────────
|
| 258 |
-
# Trajectory-based reward (v2): rewards correct intermediate reasoning AND
|
| 259 |
-
# the final terminal decision to provide a dense signal.
|
| 260 |
-
reward:
|
| 261 |
-
# Terminal-action credit
|
| 262 |
-
terminal_correct: 0.60
|
| 263 |
-
# Investigation eligibility bonus (per eligible sub-action used, first use only)
|
| 264 |
-
investigation_eligible: 0.20
|
| 265 |
-
# Flag-identification bonus (agent used inspect AND task has decisive key_flags)
|
| 266 |
-
flag_identification: 0.20
|
| 267 |
-
# Confidence bonus when agent confidence >= 0.8 and final action is correct
|
| 268 |
-
confidence_correct: 0.10
|
| 269 |
-
confidence_wrong: -0.10
|
| 270 |
-
# Regulatory bonus for SAR filing on regulatory tasks before terminal action
|
| 271 |
-
regulatory_sar: 0.20
|
| 272 |
-
# Duplicate investigation penalty (same sub-action on same task, second+ use)
|
| 273 |
-
duplicate_investigation_penalty: -0.05
|
| 274 |
-
partial_credit: true
|
| 275 |
-
passing_threshold: 0.5
|
| 276 |
-
# Bounds: normalised episode score is strictly clamped to [0.0, 1.0]
|
| 277 |
-
min_score: 0.0
|
| 278 |
-
max_score: 1.0
|
| 279 |
-
|
| 280 |
-
# ── Inference script ─────────────────────────────────────────────────────────
|
| 281 |
-
inference:
|
| 282 |
-
script: inference.py
|
| 283 |
-
max_runtime_seconds: 1200
|
| 284 |
-
requires:
|
| 285 |
-
- API_BASE_URL
|
| 286 |
-
- MODEL_NAME
|
| 287 |
-
- HF_TOKEN
|
| 288 |
-
|
|
|
|
| 1 |
spec_version: 1
|
| 2 |
name: payops_env
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
type: space
|
| 4 |
runtime: fastapi
|
| 5 |
app: server.app:app
|
| 6 |
port: 7860
|
| 7 |
+
version: 2.0.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
tasks:
|
| 10 |
- id: EASY-001
|
| 11 |
name: EASY-001
|
|
|
|
| 128 |
difficulty: critical
|
| 129 |
grader: server.graders:CRIT006Grader
|
| 130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
server/Dockerfile
CHANGED
|
@@ -24,6 +24,9 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
| 24 |
# Copy project source
|
| 25 |
COPY . /app/payops_env
|
| 26 |
|
|
|
|
|
|
|
|
|
|
| 27 |
# Both /app (for payops_env.*) and /app/payops_env (for server.*) on PYTHONPATH
|
| 28 |
# This matches the openenv.yaml app: server.app:app path and platform example format
|
| 29 |
ENV PYTHONPATH="/app:/app/payops_env"
|
|
|
|
| 24 |
# Copy project source
|
| 25 |
COPY . /app/payops_env
|
| 26 |
|
| 27 |
+
# Also copy openenv.yaml to WORKDIR so validators can find it at /app/openenv.yaml
|
| 28 |
+
COPY openenv.yaml /app/openenv.yaml
|
| 29 |
+
|
| 30 |
# Both /app (for payops_env.*) and /app/payops_env (for server.*) on PYTHONPATH
|
| 31 |
# This matches the openenv.yaml app: server.app:app path and platform example format
|
| 32 |
ENV PYTHONPATH="/app:/app/payops_env"
|