Every child microVM that forkd forks runs a lightweight TCP agent (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/deeplethe/forkd/llms.txt
Use this file to discover all available pages before exploring further.
forkd-agent.py) on port 8888 inside the guest. The three commands on this page communicate with that agent to execute code, evaluate expressions, and verify the sandbox is alive — without requiring SSH or any additional guest configuration.
By default, all three commands connect directly to 10.42.0.2:8888 (the standard guest IP assigned by NetworkConfig::default_tap()). When using per-child network namespaces (--per-child-netns), each child has a forkd-child-<i> netns and the same guest IP is reachable inside it. Pass --child <netns> to enter the correct namespace before dialing.
--child uses setns(2) to enter a network namespace, which requires root or CAP_SYS_ADMIN. When running without root, omit --child and connect directly to a child-specific IP/port if your networking setup exposes them.forkd exec
Run a command inside a live sandbox via the guest agent’s exec endpoint. The command runs as a subprocess inside the guest, and stdout and stderr are streamed back to the caller. The process exit code is propagated as the CLI exit code.
Address of the guest agent TCP listener. The default matches
NetworkConfig::default_tap() — the IP assigned to the guest when the host tap is forkd-tap0 with a 10.42.0.1/24 host address.Network namespace name to enter before connecting (e.g.
forkd-child-3). Passes setns(2) into /var/run/netns/<name>. Requires root or CAP_SYS_ADMIN. When omitted, connects directly to --target in the current network namespace.Command timeout in seconds. If the guest does not return a response within this window, the connection is closed and an error is returned.
Command and arguments to execute inside the guest, passed after
--. Required.forkd eval
Evaluate a Python expression against the warmed PID-1 interpreter inside the sandbox. Unlike forkd exec (which spawns a new subprocess that must re-import all packages), eval reuses the already-running Python process that was warm at snapshot time. This makes the difference between 1 ms and 96 ms for a numpy expression.
| Call | Typical time | What it does |
|---|---|---|
forkd eval -- "numpy.zeros(5).sum()" | ~1 ms | Reuses warmed PID-1 Python; no subprocess, no import |
forkd exec -- python3 -c "import numpy; numpy.zeros(5).sum()" | ~96 ms | Cold subprocess; re-imports numpy from disk |
eval endpoint, which calls Python’s eval() in the guest’s __main__ namespace (where all warmup imports are already present). The result is returned as a string (repr() for Python agents) or as JSON (result_json for node-bridge agents). Errors include the traceback.
Address of the guest agent TCP listener.
Network namespace name to enter before connecting (e.g.
forkd-child-3). Requires root or CAP_SYS_ADMIN.Python expression to evaluate, passed after
--. Multiple tokens are joined with a space.forkd eval only works when the snapshot was baked with a Python-agent init script (/forkd-init.sh + /forkd-agent.py). Snapshots built with forkd from-image and forkd parent build automatically include these files. The expression runs in __main__ namespace — any names imported at PID-1 startup are available directly.forkd ping
Ping the in-guest TCP agent to verify it is up and responsive. Returns the agent’s JSON pong response, which includes the Python version, a sample library version (if the agent was baked with one), and the PID of the responding process.
Address of the guest agent TCP listener.
Network namespace name to enter before connecting (e.g.
forkd-child-3). Requires root or CAP_SYS_ADMIN.pid: 1 field confirms that the response came from the warm PID-1 interpreter rather than a spawned subprocess — this is the same process that forkd eval sends expressions to.
Examples:
forkd snapshot-diff uses an internal equivalent of forkd ping (via POST /v1/sandboxes/:id/ping on the daemon) to wait for the guest agent to come up before running the installer command. The CLI forkd ping is the direct equivalent for interactively verifying a running child.