Manages a langgraph dev server subprocess.
Focuses on subprocess lifecycle (start, stop, restart) and health checking.
Env-var management for restarts (e.g. configuration changes requiring a full
restart) is handled by _scoped_env_overrides, keeping this class focused
on process management.
ServerProcess(
self,
*,
host: str = _DEFAULT_HOST,
port: int = _DEFAULT_PORT,
config_dir: str | Path | None = None,
owns_config_dir: bool = False
)| Name | Type | Description |
|---|---|---|
host | str | Default: _DEFAULT_HOSTHost to bind the server to. |
port | int | Default: _DEFAULT_PORTInitial port to bind the server to. May be reassigned automatically by |
config_dir | str | Path | None | Default: NoneDirectory containing |
owns_config_dir | bool | Default: FalseWhen |
Start the langgraph dev server and wait for it to be healthy.
Stop the server process and clean up all resources.
Stage env var overrides to apply on the next restart().
These are applied to os.environ immediately before the subprocess
starts, keeping mutation scoped to the restart call.
Restart the server process, reusing the existing config directory.
Stops the subprocess, then starts a new one. Any env overrides staged
via update_env() are applied within a _scoped_env_overrides context
manager so that failures automatically roll back the environment to the
last known-good state.