0.5.4

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

idstr

Unique identifier for the sandbox (UUID).

user_idstr

User ID who owns the sandbox.

ipstr

IP address assigned to the sandbox.

statestr

Current sandbox state (always "running" for active sandboxes).

started_atstr

Timestamp when the sandbox was created.

exec_countint

Number of commands executed in this sandbox.

internet_accessbool

Whether 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

SandboxNotFoundErrorException

Raised when the sandbox no longer exists or has been deleted.

SandboxTimeoutErrorException

Raised when the status request times out.

SandboxConnectionErrorException

Raised 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()