Status
Retrieve detailed information about a sandbox's current state.
sandbox.status() -> Dict[str, Any]Requires a Sandbox instance; use Sandbox.get() if you only have an ID.
Returns
idstrUnique identifier for the sandbox (UUID).
user_idstrUser ID who owns the sandbox.
ipstrIP address assigned to the sandbox.
statestrCurrent sandbox state (always "running" for active sandboxes).
started_atstrTimestamp when the sandbox was created.
exec_countintNumber of commands executed in this sandbox.
internet_accessboolWhether internet access is enabled for this sandbox.
Examples
Basic Example
from concave import Sandbox
sbx = Sandbox.create()
# Get sandbox status
status = sbx.status()
print(f"Sandbox ID: {status['id']}")
print(f"State: {status['state']}")
print(f"IP Address: {status['ip']}")
sbx.delete()Using the info Property
from concave import Sandbox
sbx = Sandbox.create()
# Get comprehensive info (includes id, started_at + status)
info = sbx.info
print(f"ID: {info['id']}")
print(f"Started at: {info['started_at']}")
print(f"State: {info['state']}")
print(f"IP: {info['ip']}")
print(f"Executions: {info['exec_count']}")
sbx.delete()Check Internet Access
from concave import Sandbox
sbx = Sandbox.create(internet_access=False)
status = sbx.status()
print(f"Internet: {status['internet_access']}")
print(f"State: {status['state']}")
sbx.delete()Exceptions
SandboxNotFoundErrorExceptionRaised when the sandbox no longer exists or has been deleted.
SandboxTimeoutErrorExceptionRaised when the status request times out.
SandboxConnectionErrorExceptionRaised when unable to connect to the sandbox service.
Error Handling
from concave import Sandbox, SandboxNotFoundError
sbx = Sandbox.create()
try:
status = sbx.status()
print(f"Sandbox state: {status['state']}")
except SandboxNotFoundError:
print("Sandbox no longer exists")
except Exception as e:
print(f"Error getting status: {e}")
finally:
sbx.delete()