diff --git a/src/agentscope_runtime/engine/app/agent_app.py b/src/agentscope_runtime/engine/app/agent_app.py index 59caf0077..c9ae336ac 100644 --- a/src/agentscope_runtime/engine/app/agent_app.py +++ b/src/agentscope_runtime/engine/app/agent_app.py @@ -878,7 +878,14 @@ def _apply_runtime_configs(self, kwargs: dict): custom_endpoints = kwargs.pop("custom_endpoints") self.restore_custom_endpoints(custom_endpoints) - def run(self, host=HOST, port=PORT, web_ui=False, **kwargs): + def run( + self, + host=HOST, + port=PORT, + web_ui=False, + timeout_keep_alive=120, + **kwargs, + ): """Launch the application server and optional Web UI.""" self._apply_runtime_configs(kwargs) @@ -913,6 +920,7 @@ def run(self, host=HOST, port=PORT, web_ui=False, **kwargs): port=port, log_level="info", access_log=True, + timeout_keep_alive=timeout_keep_alive, ) else: uvicorn.run( @@ -921,6 +929,7 @@ def run(self, host=HOST, port=PORT, web_ui=False, **kwargs): port=port, log_level="info", access_log=True, + timeout_keep_alive=timeout_keep_alive, ) except KeyboardInterrupt: diff --git a/src/agentscope_runtime/sandbox/manager/server/app.py b/src/agentscope_runtime/sandbox/manager/server/app.py index 06f232066..db57c6c8c 100644 --- a/src/agentscope_runtime/sandbox/manager/server/app.py +++ b/src/agentscope_runtime/sandbox/manager/server/app.py @@ -440,6 +440,7 @@ def main(): port=settings.PORT, workers=settings.WORKERS, reload=settings.DEBUG, + timeout_keep_alive=settings.TIMEOUT_KEEP_ALIVE, ) diff --git a/src/agentscope_runtime/sandbox/manager/server/config.py b/src/agentscope_runtime/sandbox/manager/server/config.py index 003f498cb..218ae163f 100644 --- a/src/agentscope_runtime/sandbox/manager/server/config.py +++ b/src/agentscope_runtime/sandbox/manager/server/config.py @@ -16,6 +16,7 @@ class Settings(BaseSettings): PORT: int = 8000 WORKERS: int = 1 DEBUG: bool = False + TIMEOUT_KEEP_ALIVE: int = 120 BEARER_TOKEN: Optional[str] = None # Runtime Manager settings