File size: 917 Bytes
ada4b65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
try:
    from openenv.core.env_server.http_server import create_app
except Exception as e:
    raise ImportError("openenv is required. Install: pip install openenv-core") from e

from models import GovAction, GovObservation
from server.gov_env_environment import GovEnvironment

app = create_app(
    GovEnvironment,
    GovAction,
    GovObservation,
    env_name="gov_env",
    max_concurrent_envs=1,
)

try:
    from tasks import task_manager
except ImportError:
    import sys
    import os
    sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
    from tasks import task_manager

@app.get("/tasks")
async def get_tasks():
    """Get available tasks."""
    return {"tasks": task_manager.get_seed_tasks()}

def main():
    import uvicorn
    import os
    port = int(os.environ.get("PORT", 7860))
    uvicorn.run(app, host="0.0.0.0", port=port)

if __name__ == "__main__":
    main()