# ServerProcess

> **Class** in `deepagents_cli`

📖 [View in docs](https://reference.langchain.com/python/deepagents-cli/server/ServerProcess)

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.

## Signature

```python
ServerProcess(
    self,
    *,
    host: str = _DEFAULT_HOST,
    port: int = _DEFAULT_PORT,
    config_dir: str | Path | None = None,
    owns_config_dir: bool = False,
)
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `host` | `str` | No | Host to bind the server to. (default: `_DEFAULT_HOST`) |
| `port` | `int` | No | Initial port to bind the server to.  May be reassigned automatically by `start()` if the port is already in use. (default: `_DEFAULT_PORT`) |
| `config_dir` | `str \| Path \| None` | No | Directory containing `langgraph.json`. (default: `None`) |
| `owns_config_dir` | `bool` | No | When `True`, the server will delete `config_dir` on `stop()`. (default: `False`) |

## Constructors

```python
__init__(
    self,
    *,
    host: str = _DEFAULT_HOST,
    port: int = _DEFAULT_PORT,
    config_dir: str | Path | None = None,
    owns_config_dir: bool = False,
) -> None
```

| Name | Type |
|------|------|
| `host` | `str` |
| `port` | `int` |
| `config_dir` | `str \| Path \| None` |
| `owns_config_dir` | `bool` |


## Properties

- `host`
- `port`
- `config_dir`
- `url`
- `running`

## Methods

- [`start()`](https://reference.langchain.com/python/deepagents-cli/server/ServerProcess/start)
- [`stop()`](https://reference.langchain.com/python/deepagents-cli/server/ServerProcess/stop)
- [`update_env()`](https://reference.langchain.com/python/deepagents-cli/server/ServerProcess/update_env)
- [`restart()`](https://reference.langchain.com/python/deepagents-cli/server/ServerProcess/restart)

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/a9e6e4f7ad7fe161dd9affc3d74bb19784aca70b/libs/cli/deepagents_cli/server.py#L286)