Skip to main content
Update sandbox configurations, manage timeouts, and monitor resource usage for optimal performance.

Update Timeout

Extend or reduce the sandbox timeout:
from gravixlayer import GravixLayer

client = GravixLayer(api_key="YOUR_API_KEY")

result = client.sandbox.sandboxes.update_timeout("your-sandbox-id", timeout=1800)
print(f"New timeout: {result.timeout}s")
print(f"Timeout at: {result.timeout_at}")

Resource Monitoring

Monitor real-time resource usage:
metrics = client.sandbox.sandboxes.get_metrics("your-sandbox-id")
print(f"CPU: {metrics.cpu_usage}%")
print(f"Memory: {metrics.memory_usage}/{metrics.memory_total}MB")

Host URL Access

Get the public URL for accessing specific ports:
host = client.sandbox.sandboxes.get_host_url("your-sandbox-id", port=8000)
print(f"URL: {host.url}")

Common Ports

PortServiceUse Case
3000Node.js/ReactWeb development
5000FlaskPython web applications
8000HTTP ServerSimple web servers
8888JupyterNotebook servers

Next Steps

Update Timeout

Extend or reduce sandbox timeout

Get Metrics

Monitor resource usage metrics

Get Host URL

Access web services in sandbox

Execute Code

Run code with optimized configurations