Upload folder using huggingface_hub
Browse files- pyproject.toml +1 -1
- server/app.py +29 -11
pyproject.toml
CHANGED
|
@@ -8,7 +8,7 @@ version = "0.1.0"
|
|
| 8 |
description = "Slipstream Governance Environment for OpenEnv - train agents to use Slipstream safely (no covert channels)"
|
| 9 |
requires-python = ">=3.10"
|
| 10 |
dependencies = [
|
| 11 |
-
"openenv-core
|
| 12 |
"fastapi>=0.115.0",
|
| 13 |
"pydantic>=2.0.0",
|
| 14 |
"uvicorn>=0.24.0",
|
|
|
|
| 8 |
description = "Slipstream Governance Environment for OpenEnv - train agents to use Slipstream safely (no covert channels)"
|
| 9 |
requires-python = ">=3.10"
|
| 10 |
dependencies = [
|
| 11 |
+
"openenv-core @ git+https://github.com/meta-pytorch/OpenEnv.git@main",
|
| 12 |
"fastapi>=0.115.0",
|
| 13 |
"pydantic>=2.0.0",
|
| 14 |
"uvicorn>=0.24.0",
|
server/app.py
CHANGED
|
@@ -4,33 +4,51 @@
|
|
| 4 |
# This source code is licensed under the BSD-style license found in the
|
| 5 |
# LICENSE file in the root directory of this source tree.
|
| 6 |
|
| 7 |
-
"""
|
|
|
|
| 8 |
|
| 9 |
-
|
|
|
|
| 10 |
|
| 11 |
-
|
| 12 |
-
#
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
#
|
| 16 |
-
|
|
|
|
| 17 |
|
|
|
|
| 18 |
try:
|
|
|
|
|
|
|
| 19 |
from ..models import SlipstreamAction, SlipstreamObservation
|
| 20 |
from .slipstream_environment import SlipstreamGovEnvironment
|
| 21 |
-
except ImportError:
|
|
|
|
|
|
|
| 22 |
from models import SlipstreamAction, SlipstreamObservation
|
| 23 |
from server.slipstream_environment import SlipstreamGovEnvironment
|
| 24 |
|
|
|
|
|
|
|
| 25 |
app = create_app(
|
| 26 |
SlipstreamGovEnvironment,
|
| 27 |
SlipstreamAction,
|
| 28 |
SlipstreamObservation,
|
| 29 |
-
env_name="slipstream_gov_env"
|
| 30 |
)
|
| 31 |
|
| 32 |
|
| 33 |
-
def main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
import uvicorn
|
| 35 |
|
| 36 |
uvicorn.run(app, host="0.0.0.0", port=8000)
|
|
|
|
| 4 |
# This source code is licensed under the BSD-style license found in the
|
| 5 |
# LICENSE file in the root directory of this source tree.
|
| 6 |
|
| 7 |
+
"""
|
| 8 |
+
FastAPI application for the Slipstream Governance Environment.
|
| 9 |
|
| 10 |
+
This module creates an HTTP server that exposes the SlipstreamGovEnvironment
|
| 11 |
+
over HTTP and WebSocket endpoints, compatible with EnvClient.
|
| 12 |
|
| 13 |
+
Usage:
|
| 14 |
+
# Development (with auto-reload):
|
| 15 |
+
uvicorn server.app:app --reload --host 0.0.0.0 --port 8000
|
| 16 |
+
|
| 17 |
+
# Production:
|
| 18 |
+
uvicorn server.app:app --host 0.0.0.0 --port 8000 --workers 4
|
| 19 |
+
"""
|
| 20 |
|
| 21 |
+
# Support both in-repo and standalone imports
|
| 22 |
try:
|
| 23 |
+
# In-repo imports (when running from OpenEnv repository)
|
| 24 |
+
from openenv.core.env_server.http_server import create_app
|
| 25 |
from ..models import SlipstreamAction, SlipstreamObservation
|
| 26 |
from .slipstream_environment import SlipstreamGovEnvironment
|
| 27 |
+
except ImportError:
|
| 28 |
+
# Standalone imports (when environment is standalone with openenv from pip)
|
| 29 |
+
from openenv.core.env_server.http_server import create_app
|
| 30 |
from models import SlipstreamAction, SlipstreamObservation
|
| 31 |
from server.slipstream_environment import SlipstreamGovEnvironment
|
| 32 |
|
| 33 |
+
# Create the app with web interface and README integration
|
| 34 |
+
# Pass the class (factory) instead of an instance for WebSocket session support
|
| 35 |
app = create_app(
|
| 36 |
SlipstreamGovEnvironment,
|
| 37 |
SlipstreamAction,
|
| 38 |
SlipstreamObservation,
|
| 39 |
+
env_name="slipstream_gov_env"
|
| 40 |
)
|
| 41 |
|
| 42 |
|
| 43 |
+
def main():
|
| 44 |
+
"""
|
| 45 |
+
Entry point for direct execution via uv run or python -m.
|
| 46 |
+
|
| 47 |
+
This function enables running the server without Docker:
|
| 48 |
+
uv run --project . server
|
| 49 |
+
python -m server.app
|
| 50 |
+
openenv serve slipstream_gov_env
|
| 51 |
+
"""
|
| 52 |
import uvicorn
|
| 53 |
|
| 54 |
uvicorn.run(app, host="0.0.0.0", port=8000)
|