Description:
Currently, the opensandbox Python SDK provides an absolute timeout parameter in Sandbox.create() to define the maximum lifetime of a sandbox. However, there is no built-in support for an idle timeout (e.g., automatically destroying the sandbox if there is no activity/command execution for a specific duration).
Use Case:
When allocating sandboxes for LLM agents or user interactive sessions, the exact duration of a task is often unpredictable. If an agent process crashes or a user abandons a session without explicitly calling await sandbox.kill(), the sandbox will remain running until the absolute maximum timeout is reached. This can lead to a significant waste of computing resources.
Having an idle_timeout parameter (e.g., idle_timeout=timedelta(minutes=5)) would allow the sandbox server to proactively reclaim resources if no new commands or connections are established within the specified timeframe.
Proposed Solution:
- Introduce an
idle_timeout (or sandbox_idle_timeout_seconds) parameter to the Sandbox.create() method in the Python SDK.
- Propagate this configuration to the Sandbox Backend/Server so it can monitor activity and automatically terminate the sandbox when the idle threshold is breached.
Alternative options considered:
Manually maintaining a heartbeat or activity tracker inside our own application layer to call sandbox.kill(), but this adds complexity and may fail if our main application unexpectedly crashes. Having this handled at the SDK/Server level would be much more robust.
Description:
Currently, the
opensandboxPython SDK provides an absolutetimeoutparameter inSandbox.create()to define the maximum lifetime of a sandbox. However, there is no built-in support for an idle timeout (e.g., automatically destroying the sandbox if there is no activity/command execution for a specific duration).Use Case:
When allocating sandboxes for LLM agents or user interactive sessions, the exact duration of a task is often unpredictable. If an agent process crashes or a user abandons a session without explicitly calling
await sandbox.kill(), the sandbox will remain running until the absolute maximumtimeoutis reached. This can lead to a significant waste of computing resources.Having an
idle_timeoutparameter (e.g.,idle_timeout=timedelta(minutes=5)) would allow the sandbox server to proactively reclaim resources if no new commands or connections are established within the specified timeframe.Proposed Solution:
idle_timeout(orsandbox_idle_timeout_seconds) parameter to theSandbox.create()method in the Python SDK.Alternative options considered:
Manually maintaining a heartbeat or activity tracker inside our own application layer to call
sandbox.kill(), but this adds complexity and may fail if our main application unexpectedly crashes. Having this handled at the SDK/Server level would be much more robust.