Delete Sandbox
Destroy a sandbox and free up resources.
sandbox.delete() -> boolReturns
Returns True if the sandbox was successfully deleted, False otherwise. Note that the method does not raise exceptions on failure to allow graceful cleanup.
Examples
Basic Example
from concave import Sandbox
sbx = Sandbox.create()
# Use the sandbox
result = sbx.run("print('Hello World')")
print(result.stdout)
# Delete when done
success = sbx.delete()
print(f"Deleted: {success}")Batch Delete
from concave import Sandbox
sandboxes = Sandbox.list()
for sbx in sandboxes:
sbx.delete()
print(f"Deleted {sbx.id}")Context ManagerRecommended
from concave import sandbox
with sandbox() as sbx:
result = sbx.run("print('Hello')")
print(result.stdout)
# Automatically deletedError Handling
from concave import (
Sandbox,
SandboxNotFoundError
)
try:
sbx = Sandbox.create()
success = sbx.delete()
print(f"Deleted: {success}")
except SandboxNotFoundError:
print("Sandbox no longer exists")
except Exception as e:
print(f"Error deleting sandbox: {e}")