Skip to content

Networking and ports

Listening ports, public URLs, tunnels, local port forwards, metrics and MCP approvals.

Every method shows the same operation in each SDK; pick a language once and every tab on the site follows it.

Python TypeScript Go Ruby Java

The ports listening in the sandbox, and TCP forwards to them.

def list(self) -> list[ListeningPort]

Returns list[ListeningPort]

Source: sdk/python/svm/dataplane.py:168
def close(self) -> None
from _Envd

Close the channel; a later call on this client opens a new one.

Source: sdk/python/svm/dataplane.py:42

Not in the Python SDK’s PortClient.

def forward(self, port: int) -> PortTunnel

Open a TCP connection to port inside the sandbox; returns once it is open.

Parameter Type Default
port int

Returns PortTunnel

Source: sdk/python/svm/dataplane.py:172

Not in the Python SDK’s PortClient.

Python TypeScript Go Ruby Java

ListeningPort is a port something in the sandbox listens on.

Property Type Description
address str
pid int | None
port int
Python TypeScript Go Ruby Java

A TCP connection to a port inside the sandbox over the envd port forward: send and receive move bytes.

def close(self) -> None
Source: sdk/python/svm/dataplane.py:148

Not in the Python SDK’s PortTunnel.

Not in the Python SDK’s PortTunnel.

def receive(self) -> bytes | None

The next bytes from the port, or None once the forward closed.

Returns bytes \| None

Source: sdk/python/svm/dataplane.py:133
def send(self, data: bytes) -> None
Parameter Type Default
data bytes
Source: sdk/python/svm/dataplane.py:129

Not in the Python SDK’s PortTunnel.

Python TypeScript Go Ruby Java

A byte stream to one port in a sandbox. send and receive move bytes; receive returns None when the port closed.

def close(self) -> None
Source: sdk/python/svm/tunnel.py:41
close_code: int | None

Property (read-only).

The WebSocket close code the sandbox ended the tunnel with, or None while it is open.

close_reason: str

Property (read-only).

Why the tunnel ended, when the sandbox said (a refused port, a lost host).

Not in the Python SDK’s Tunnel.

Not in the Python SDK’s Tunnel.

Not in the Python SDK’s Tunnel.

Not in the Python SDK’s Tunnel.

def receive(self) -> bytes | None

The next bytes from the port, or None once the tunnel closed (close_code and close_reason say why).

Returns bytes \| None

Source: sdk/python/svm/tunnel.py:27
def send(self, data: bytes) -> None
Parameter Type Default
data bytes
Source: sdk/python/svm/tunnel.py:24

Not in the Python SDK’s Tunnel.

Python TypeScript Go Ruby Java

A running local listener. port is the local port (useful when 0 asked for any free one); close stops it.

addr: str

Property (read-only).

host:port of the local listener.

def close(self) -> None
Source: sdk/python/svm/forward.py:96
url: str

Property (read-only).

Python TypeScript Go Ruby Java

The sandbox’s own CPU, memory, disk and process figures.

def get(self) -> Metrics

Returns Metrics

Source: sdk/python/svm/dataplane.py:102
def close(self) -> None
from _Envd

Close the channel; a later call on this client opens a new one.

Source: sdk/python/svm/dataplane.py:42

Not in the Python SDK’s MetricsClient.

Not in the Python SDK’s MetricsClient.

def stream(self, interval_seconds: int=1) -> Iterator[Metrics]

A sample every interval_seconds (1..3600) until the iterator is closed.

Parameter Type Default
interval_seconds int 1

Returns Iterator[Metrics]

Source: sdk/python/svm/dataplane.py:105
Python TypeScript Go Ruby Java

Metrics is the sandbox’s own CPU, memory, disk and process figures.

Property Type Description
cpu_count int
cpu_used_percent float
disk_total_bytes int
disk_used_bytes int
mem_total_bytes int
mem_used_bytes int
process_count int
timestamp str | None
def from_proto(cls, m: metrics_pb2.Metrics) -> 'Metrics'
static
Parameter Type Default
m metrics_pb2.Metrics

Returns 'Metrics'

Source: sdk/python/svm/dataplane.py:90
Python TypeScript Go Ruby Java

Decides tool calls the MCP gateway holds for approval and reads its audit log (INT-010). The decisions are written as root into a root-owned directory, so the agent inside the sandbox cannot approve itself.

def audit(self, limit: int=100) -> list[dict[str, Any]]

The newest audit records, oldest first: ts, server, tool, decision, reason, argument names and a hash of the arguments.

Parameter Type Default
limit int 100

Returns list[dict[str, Any]]

Source: sdk/python/svm/mcp_approvals.py:39

Not in the Python SDK’s McpApprovals.

def decide(self, approval_id: str, allow: bool) -> None

Allow (allow=True) or deny the held tool call approval_id.

Parameter Type Default
approval_id str
allow bool
Source: sdk/python/svm/mcp_approvals.py:33

Not in the Python SDK’s McpApprovals.

def pending(self) -> list[dict[str, Any]]

Tool calls waiting for a decision: id, server, tool and the argument names (never the values).

Returns list[dict[str, Any]]

Source: sdk/python/svm/mcp_approvals.py:28