Spaces:
Running
SentinelOps Arena β Complete Setup Guide
1. Local Dev Environment
Python Version
- Required: Python 3.14 (system) or 3.12+ (venv)
- Current venv: Python 3.14.2 in
hackathon_env/.venv/(created by uv) - Root venv: Python 3.12.12 in
.venv/(created by uv) - OpenEnv 0.2.1 requires
>=3.10, works fine on 3.14 - Tool manager:
uv0.9.26 (installed at/Users/nihalnihalani/.local/bin/uv)
Existing Environment State
The hackathon_env/ directory already has a working OpenEnv echo environment with:
openenv-core==0.2.1installed inhackathon_env/.venv/- Working
Environmentsubclass pattern (seeserver/hackathon_env_environment.py) - Working
create_app()HTTP server (seeserver/app.py) - Working
EnvClientsubclass with_step_payload()and_parse_result()(seeclient.py) - Working Dockerfile for HF Spaces deployment
openenv.yamlspec file
CRITICAL: The venv has a broken interpreter path
The hackathon_env/.venv/bin/openenv script points to /Users/nihalnihalani/Desktop/Github/openev/hackathon_env/.venv/bin/python (note openev not NexusEnv). This means the venv was created in a different directory and moved. The Python binary itself works fine, but CLI entry points are broken.
Fix: Recreate the venv from hackathon_env/:
cd /Users/nihalnihalani/Desktop/Github/NexusEnv/hackathon_env
uv venv .venv --python 3.14
uv sync
Dependencies β pyproject.toml for SentinelOps
The project needs a root-level pyproject.toml for the SentinelOps Arena package. The hackathon_env/pyproject.toml only covers the echo env template.
[build-system]
requires = ["setuptools>=45", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "sentinelops-arena"
version = "0.1.0"
description = "Multi-agent self-play training environment for enterprise AI security"
requires-python = ">=3.10"
dependencies = [
# Core OpenEnv runtime
"openenv-core[core]>=0.2.1",
# MCP tool server
"mcp>=1.26.0",
"fastmcp>=2.14.5",
# HTTP server
"fastapi>=0.115.0",
"uvicorn>=0.24.0",
# MCP-X gateway dependencies
"PyJWT>=2.0",
"toml>=0.10.2",
"httpx>=0.27",
# Gradio for HF Spaces demo UI
"gradio>=5.0.0",
# Data handling
"pydantic>=2.0",
]
[project.optional-dependencies]
dev = [
"pytest>=8.0.0",
"pytest-cov>=4.0.0",
]
training = [
# These are for local training only, NOT for HF Spaces
"trl>=0.15.0",
"transformers>=4.40.0",
"torch>=2.0.0",
"accelerate>=0.30.0",
"datasets>=2.18.0",
"peft>=0.10.0",
]
[project.scripts]
server = "sentinelops_arena.server:main"
[tool.setuptools]
include-package-data = true
packages = ["sentinelops_arena", "sentinelops_arena.systems"]
Pinned Dependency Versions (from envbeats reference)
| Package | Min Version | Source |
|---|---|---|
| openenv-core | 0.2.1 | hackathon_env/pyproject.toml |
| mcp | 1.26.0 | eb_assessor/pyproject.toml |
| fastmcp | 2.14.5 | mcp-x/pyproject.toml |
| fastapi | 0.128.6+ | mcp-x/pyproject.toml |
| PyJWT | 2.0+ | mcp-x/pyproject.toml |
| toml | 0.10.2+ | mcp-x/pyproject.toml |
| httpx | 0.27+ | mcp-x/pyproject.toml |
| uvicorn | 0.24.0+ | hackathon_env/server/requirements.txt |
| pydantic | 2.0+ | transitive via openenv-core |
| gradio | 5.0+ | for HF Spaces demo UI |
2. Infrastructure Setup
Northflank H100
- Each team gets H100 GPU access via Northflank
- Used for training only (not deployment)
- Request at hackathon check-in or via organizer Slack
- Configure: SSH access, install Python 3.10+, CUDA drivers
- Not required for MVP β can use Colab free tier for training demo
HuggingFace
- Account: Already have (nihalnihalani)
- Join openenv-community: Required for $30 compute credits β join org at huggingface.co
- Create Space:
nihalnihalani/sentinelops-arena- SDK: Docker (custom Dockerfile) or Gradio
- Hardware: CPU Basic (free) or CPU Upgrade ($0.03/hr from credits)
- Push command:
openenv push --space nihalnihalani/sentinelops-arenaOR manual git push to HF repo
Google Colab
- Training notebook:
training/colab_training.ipynb - Runtime: T4 GPU (free tier) or A100 if credits available
- Key concern: Colab runs Python 3.10-3.11, but openenv-core requires >=3.10 (should work)
- Fallback: Bundle standalone env code in notebook without openenv import (for Python compat)
YouTube
- Account for demo video upload
- Video length: 1 minute (per spec, NOT 3-5 minutes as in the build plan)
- Screen record: Gradio demo + training signal
- Upload as unlisted, share link in submission
3. Repository Structure
Target File Tree
NexusEnv/
βββ .git/
βββ .gitignore
βββ .venv/ # Root venv (Python 3.12)
βββ CLAUDE.md # Claude Code rules
βββ README.md # Project README (update for submission)
βββ SENTINELOPS_ARENA.md # Full spec document
βββ SETUP.md # This file
βββ pyproject.toml # Root project config (NEW)
βββ app.py # HF Spaces entry point β Gradio app (NEW)
βββ sentinelops_arena/ # Core package (NEW)
β βββ __init__.py
β βββ models.py # Pydantic models: Action, Observation, State, data models
β βββ systems/
β β βββ __init__.py
β β βββ crm.py # CRM simulator
β β βββ billing.py # Billing simulator
β β βββ ticketing.py # Ticketing simulator
β βββ attacks.py # Attack mechanics (4 types)
β βββ rewards.py # Reward functions (3 agents)
β βββ task_generator.py # Customer task generation
β βββ environment.py # SentinelOpsArena(Environment)
β βββ mcp_tools.py # FastMCP tool definitions
β βββ server.py # create_app() HTTP server
β βββ demo.py # Demo script with heuristic agents
βββ mcp_x/ # MCP-X gateway (adapted from envbeats) (NEW)
β βββ mcp_x.py # Gateway server (copy+adapt)
β βββ config.toml # Per-agent tool ACLs
βββ training/ # Training deliverables (NEW)
β βββ colab_training.ipynb # REQUIRED Colab notebook
β βββ rollout.py # rollout_func for GRPOTrainer
βββ envbeats/ # Reference implementation (existing, read-only)
β βββ eb_assessor/
β βββ eb_assessee_gym/
β βββ mcp-x/
βββ hackathon_env/ # Original echo env template (existing, reference)
β βββ ...
β βββ server/
β βββ Dockerfile # Reference Dockerfile
β βββ app.py # Reference create_app() usage
βββ train.py # Existing training script (update or replace)
Key Files to Create (in build order)
pyproject.tomlβ root project configsentinelops_arena/__init__.pysentinelops_arena/models.pyβ all Pydantic modelssentinelops_arena/systems/__init__.pysentinelops_arena/systems/crm.pysentinelops_arena/systems/billing.pysentinelops_arena/systems/ticketing.pysentinelops_arena/attacks.pysentinelops_arena/rewards.pysentinelops_arena/task_generator.pysentinelops_arena/environment.pysentinelops_arena/mcp_tools.pysentinelops_arena/server.pysentinelops_arena/demo.pyapp.pyβ Gradio HF Spaces entry pointmcp_x/mcp_x.py+mcp_x/config.tomltraining/colab_training.ipynb
4. Deployment Config
HuggingFace Spaces β Two Options
Option A: Gradio SDK (Simpler, Recommended)
HF Spaces README.md header: ```yaml
title: SentinelOps Arena emoji: π‘οΈ colorFrom: red colorTo: blue sdk: gradio sdk_version: 5.12.0 app_file: app.py pinned: false license: mit
No Dockerfile needed. HF auto-installs from `requirements.txt`:
**requirements.txt** (for HF Spaces):
openenv-core[core]>=0.2.1 mcp>=1.26.0 fastmcp>=2.14.5 fastapi>=0.115.0 uvicorn>=0.24.0 PyJWT>=2.0 toml>=0.10.2 httpx>=0.27 gradio>=5.0.0 pydantic>=2.0
#### Option B: Docker (If Gradio SDK fails)
Use adapted Dockerfile from `hackathon_env/server/Dockerfile`.
HF Spaces README.md header:
```yaml
---
title: SentinelOps Arena
emoji: π‘οΈ
colorFrom: red
colorTo: blue
sdk: docker
pinned: false
license: mit
---
Dockerfile:
FROM python:3.14-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
# Gradio uses port 7860 on HF Spaces
EXPOSE 7860
CMD ["python", "app.py"]
Deployment Commands
# Option 1: Using openenv CLI
cd sentinelops_arena
openenv push --space nihalnihalani/sentinelops-arena
# Option 2: Manual HF push
# Create space on huggingface.co first, then:
git remote add hf https://huggingface.co/spaces/nihalnihalani/sentinelops-arena
git push hf main
# Option 3: Using huggingface_hub Python API
from huggingface_hub import HfApi
api = HfApi()
api.upload_folder(folder_path=".", repo_id="nihalnihalani/sentinelops-arena", repo_type="space")
5. Submission Checklist
Every field required in the submission form:
| Field | Value | Status |
|---|---|---|
| Team Name | TBD (e.g., "NexusEnv" or "SentinelOps") | Need to decide |
| Project Description | Multi-agent self-play RL environment where 3 AI agents (Attacker, Worker, Oversight) interact with simulated enterprise systems. Through adversarial dynamics, agents learn to attack, defend, and audit enterprise operations. | Draft ready |
| HuggingFace Spaces Link | https://huggingface.co/spaces/nihalnihalani/sentinelops-arena |
Need to create |
| Demo Video (YouTube) | 1-minute screencast of Gradio demo + training | Need to record |
| Minimal Training Script | Colab notebook link (training/colab_training.ipynb) |
Need to build |
| Partner Tracks | Fleet AI (Scalable Oversight), Patronus AI (Schema Drift) | Selected |
Submission Deadline
Sunday, March 8th, 2026 at 1:00 PM
6. Pre-flight Checks
Before Writing Any Code
- Python 3.14 available (system)
-
uvinstalled and working - OpenEnv 0.2.1 installed in
hackathon_env/.venv/ - OpenEnv Environment/Action/Observation/State APIs understood
- EnvBeats patterns analyzed (create_app, MCP-X, client patterns)
- Git repo initialized, on
mainbranch - Create
nihalbranch (per CLAUDE.md push rules) - Create root
pyproject.toml - Set up new venv with all dependencies:
uv venv .venv && uv sync - Verify imports:
python -c "from openenv.core.env_server.interfaces import Environment; print('OK')" - Create HF Space (can be empty placeholder)
- HuggingFace: Join openenv-community org for $30 credits
Critical API Patterns (from hackathon_env reference)
Environment class:
from openenv.core.env_server.interfaces import Environment
from openenv.core.env_server.types import Action, Observation, State
class MyEnv(Environment):
SUPPORTS_CONCURRENT_SESSIONS = True
def reset(self, seed=None, episode_id=None, **kwargs) -> MyObservation:
...
def step(self, action: MyAction, timeout_s=None, **kwargs) -> MyObservation:
...
@property
def state(self) -> State: # NOTE: property, not method
...
Action class:
class MyAction(Action):
# extra='forbid' inherited from Action base
field: str = Field(..., description="...")
Observation class:
class MyObservation(Observation):
# Inherits: done (bool), reward (float|None), metadata (dict)
my_field: str = Field(default="", description="...")
HTTP Server:
from openenv.core.env_server.http_server import create_app
app = create_app(MyEnv, MyAction, MyObservation, env_name="my_env")
# Run: uvicorn module:app --host 0.0.0.0 --port 8000
Client:
from openenv.core import EnvClient
class MyClient(EnvClient[MyAction, MyObservation]):
def _step_payload(self, action: MyAction) -> Dict:
return action.model_dump()
def _parse_result(self, payload: Dict) -> StepResult[MyObservation]:
...
Known Gotchas
Actionhasextra='forbid'β SentinelAction must not have extra fieldsstateis a@propertynot a method β useenv.statenotenv.state()create_app()returns an ASGI app β useuvicorn.run(app)notapp.run()- Observation
rewardfield type isbool | int | float | None(allows bool) - The hackathon_env venv has broken CLI entry points (moved from different path)
- CLAUDE.md says push to
nihalbranch, notmain - Demo video must be 1 minute, not 3-5 minutes (spec says 1 minute)
OpenEnv Version Note
The spec says "OpenEnv 0.4" but OpenEnv 0.4 does NOT exist. The stable version is 0.2.1. The SENTINELOPS_ARENA.md references "0.4" but the actual codebase and all dependencies use 0.2.1. Build against 0.2.1.
7. Quick Start Commands
# 1. Create nihal branch
cd /Users/nihalnihalani/Desktop/Github/NexusEnv
git checkout -b nihal
# 2. Create root pyproject.toml (see Section 1)
# 3. Set up venv
uv venv .venv --python 3.14
uv sync
# 4. Verify setup
.venv/bin/python -c "from openenv.core.env_server.interfaces import Environment; print('OpenEnv OK')"
.venv/bin/python -c "from mcp.server.fastmcp import FastMCP; print('FastMCP OK')"
.venv/bin/python -c "import gradio; print('Gradio OK')"
# 5. Start building sentinelops_arena/models.py