How mdkamranalam/global-syndicate-taskforce works
Purpose and Entry Points
Global Syndicate Taskforce is a partially observable OpenEnv simulator for training and evaluating financial-compliance agents with verifiable, step-based rewards. The primary service entry point is the FastAPI/OpenEnv server at server/app.py; its environment implementation is server/global_syndicate_taskforce_env_environment.py. Consumers use the client wrapper in client.py, while local training runs through train_grpo_unsloth.py or train_grpo_mac.py.
API and Environment Boundary
The server exposes the reset/step lifecycle expected by OpenEnv. Requests carry typed auditor actions; responses return an observation, reward, and terminal status. Shared action/observation schemas are defined in models.py, separating the public protocol from environment-state implementation in server/global_syndicate_taskforce_env_environment.py. The root app.py is likely a deployment-facing application entry point, while server/app.py is the explicit Uvicorn target.
Episode State Machine and Blackboard
server/global_syndicate_taskforce_env_environment.py owns episode initialization, hidden scenario selection, step count, transaction metadata, verified facts, alerts, reward accumulation, and completion state. Each reset creates a case whose hidden truth is not directly exposed. The observation acts as the centralized case-file/blackboard: agents can see accumulated verified facts but must acquire them through allowed transitions.
Gatekeeper Stages
The environment routes actions among three deterministic roles:
• Triage via the unreliable Tier 1 Analyst, which may emit probabilistic false reports.
• Verification via the Bank Liaison, which releases hidden ground truth only with the matching policy mandate.
• Termination via the Legal Officer, which evaluates the submitted evidence chain against the hidden truth.
These role-specific state transitions and reward effects belong in server/global_syndicate_taskforce_env_environment.py; task-level scenario/action orchestration may be split into server/tasks.py.
Reward and Safety Control Flow
Every nonterminal interaction incurs an efficiency penalty. A successful liaison mandate adds a verification bonus; a correct legal ruling yields terminal success; unsupported or hallucinated rulings trigger severe terminal failure. A step limit forces timeout termination. This reward engine makes verified facts—not analyst output—the important trust boundary, preventing agents from receiving success merely by guessing a plausible fraud label.
Client, Training, and Runtime Integration
client.py provides the remote environment interface used by inference and training code. train_grpo_unsloth.py integrates the environment with Unsloth and Hugging Face TRL GRPO for GPU-efficient RL training; train_grpo_mac.py is an alternate training path. The project targets Python, runs the API under Uvicorn/FastAPI, and packages deployment in Docker through server/Dockerfile. openenv.yaml defines OpenEnv-facing project metadata, and the deployed external target is a Hugging Face Space.
Deployment Topology
The agent/trainer and environment server are intentionally separable processes: training or inference sends standardized actions over HTTP, while the server retains authoritative hidden scenario data and applies mutations/rewards. This prevents the model-side runtime from directly accessing ground truth. Container dependencies are scoped under server/requirements.txt, with the server exposed on port 8000.
Main entry points: global_syndicate_taskforce_env_environment.py Environment state machine · app.py OpenEnv API · client.py Remote client · Dockerfile Server container
Components 16
Agent & Training
- Remote client · Sends standardized lifecycle actions to the server.
client.py - GPU GRPO training · Unsloth and TRL GRPO training path.
train_grpo_unsloth.py - Mac training · Alternate local training path.
train_grpo_mac.py - OpenEnv metadata
openenv.yaml
Environment Server
- OpenEnv API · Explicit server entry point exposing reset and step.
server/app.py - Action & observation schema · Typed boundary shared by clients and environment responses.
models.py - Deployment app · Likely deployment-facing application entry point.
app.py
Episode Authority
Server-owned state keeps hidden truth outside the agent runtime.
- Environment state machine · Authoritative episode lifecycle, mutations, and role transitions.
server/global_syndicate_taskforce_env_environment.py - Scenario orchestration · May hold scenario and action orchestration.
server/tasks.py - Hidden case state · Scenario truth, transaction metadata, alerts, steps, and completion state.
- Case-file observation · Accumulates only facts acquired through permitted transitions.
- Triage, liaison & legal · Triage may be unreliable; liaison verifies mandates; legal evaluates evidence.
server/global_syndicate_taskforce_env_environment.py - Reward & safety engine · Penalizes steps, rewards verified mandates, and terminates success, failure, or timeout.
server/global_syndicate_taskforce_env_environment.py
Deployment
- Server container · Packages the API service exposed on port 8000.
server/Dockerfile - Server dependencies
server/requirements.txt - Hugging Face Space · Deployed external server target.
Connections 19
- GPU GRPO training → Remote client: uses
- Mac training → Remote client: uses
- OpenEnv metadata → OpenEnv API: declares project interface
- Remote client → OpenEnv API: HTTP reset / step actions
- OpenEnv API → Action & observation schema: validates protocol
- OpenEnv API → Environment state machine: dispatches lifecycle
- Deployment app → OpenEnv API: deployment-facing route
- Environment state machine → Scenario orchestration: selects scenarios / actions
- Environment state machine → Hidden case state: initializes and mutates
- Environment state machine → Triage, liaison & legal: routes auditor actions
- Triage, liaison & legal → Hidden case state: reads hidden truth and mandates
- Triage, liaison & legal → Case-file observation: releases verified facts
- Environment state machine → Case-file observation: returns observation
- Environment state machine → Reward & safety engine: evaluates each transition
- Reward & safety engine → Hidden case state: updates reward and terminal state
- Environment state machine → Action & observation schema: produces observation, reward, done
- OpenEnv API → Server container: packaged by
- Server dependencies → Server container: installed in
- Server container → Hugging Face Space: deployed as API service