Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion envs/tbench2_env/server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@
Environment Variables:
TB2_MODE: Execution mode - "local" (default), "docker", or "auto"
MAX_CONCURRENT_ENVS: Maximum concurrent WebSocket sessions (default: 8)
SESSION_IDLE_TIMEOUT_S: Idle seconds before a session is reaped and its
container reclaimed (default: 3600). Guards against leaked slots from
half-open WebSocket connections that never fire a clean disconnect.
"""

import os


try:
from openenv.core.env_server import ConcurrencyConfig
from openenv.core.env_server.http_server import create_app

# In-repo imports
Expand All @@ -46,6 +50,7 @@
from models import Tbench2Action, Tbench2Observation

# Standalone imports (when environment is standalone with openenv from pip)
from openenv.core.env_server import ConcurrencyConfig
from openenv.core.env_server.http_server import create_app
from server.tbench2_env_environment import (
Tbench2DockerEnvironment,
Expand All @@ -72,13 +77,17 @@

# Create the app with web interface and README integration
max_concurrent = int(os.getenv("MAX_CONCURRENT_ENVS", "8"))
session_idle_timeout = float(os.getenv("SESSION_IDLE_TIMEOUT_S", "3600"))

app = create_app(
_DEFAULT_ENVIRONMENT,
Tbench2Action,
Tbench2Observation,
env_name="tbench2_env" + _ENV_SUFFIX,
max_concurrent_envs=max_concurrent,
concurrency_config=ConcurrencyConfig(
max_concurrent_envs=max_concurrent,
session_timeout=session_idle_timeout,
),
)


Expand Down
Loading