| |
| |
| |
| |
| |
|
|
| """ |
| FastAPI application for the Slipstream Governance Environment. |
| |
| This module creates an HTTP server that exposes the SlipstreamGovEnvironment |
| over HTTP and WebSocket endpoints, compatible with EnvClient. |
| |
| Usage: |
| # Development (with auto-reload): |
| uvicorn server.app:app --reload --host 0.0.0.0 --port 8000 |
| |
| # Production: |
| uvicorn server.app:app --host 0.0.0.0 --port 8000 --workers 4 |
| """ |
|
|
| |
| try: |
| |
| from openenv.core.env_server.http_server import create_app |
| from ..models import SlipstreamAction, SlipstreamObservation |
| from .slipstream_environment import SlipstreamGovEnvironment |
| except ImportError: |
| |
| from openenv.core.env_server.http_server import create_app |
| from models import SlipstreamAction, SlipstreamObservation |
| from server.slipstream_environment import SlipstreamGovEnvironment |
|
|
| |
| |
| app = create_app( |
| SlipstreamGovEnvironment, |
| SlipstreamAction, |
| SlipstreamObservation, |
| env_name="slipstream_gov_env" |
| ) |
|
|
|
|
| def main(): |
| """ |
| Entry point for direct execution via uv run or python -m. |
| |
| This function enables running the server without Docker: |
| uv run --project . server |
| python -m server.app |
| openenv serve slipstream_gov_env |
| """ |
| import uvicorn |
|
|
| uvicorn.run(app, host="0.0.0.0", port=8000) |
|
|
|
|
| if __name__ == "__main__": |
| main() |
|
|