Spawn a runtime child process listening on a TCP socket. Args: port: TCP port to listen on. ``0`` (the default) auto-allocates a free port. If the chosen port is already in use, startup fails. connection_token: Optional shared secret t
(
*,
port: int = 0,
connection_token: str | None = None,
path: str | None = None,
args: Sequence[str] = (),
)
| 308 | |
| 309 | @staticmethod |
| 310 | def for_tcp( |
| 311 | *, |
| 312 | port: int = 0, |
| 313 | connection_token: str | None = None, |
| 314 | path: str | None = None, |
| 315 | args: Sequence[str] = (), |
| 316 | ) -> TcpRuntimeConnection: |
| 317 | """Spawn a runtime child process listening on a TCP socket. |
| 318 | |
| 319 | Args: |
| 320 | port: TCP port to listen on. ``0`` (the default) auto-allocates |
| 321 | a free port. If the chosen port is already in use, startup |
| 322 | fails. |
| 323 | connection_token: Optional shared secret the SDK sends to the |
| 324 | spawned runtime to authenticate the TCP connection. When |
| 325 | ``None``, a UUID is generated automatically so the loopback |
| 326 | listener is safe by default. |
| 327 | path: Path to the runtime executable. When ``None``, uses the |
| 328 | bundled binary. |
| 329 | args: Extra command-line arguments passed to the runtime process. |
| 330 | """ |
| 331 | return TcpRuntimeConnection( |
| 332 | path=path, |
| 333 | args=tuple(args), |
| 334 | port=port, |
| 335 | connection_token=connection_token, |
| 336 | ) |
| 337 | |
| 338 | @staticmethod |
| 339 | def for_uri(url: str, *, connection_token: str | None = None) -> UriRuntimeConnection: |