> ## Documentation Index
> Fetch the complete documentation index at: https://usefused.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# harnest.server

> Public Python signatures, fields, and methods.

[All Python modules](https://usefused.com/docs/harnest/reference/api/overview.md) · [Import and compatibility guidance](https://usefused.com/docs/harnest/build/python-imports.md)

## Exports

| Name | Kind |
| - | - |
| [`HTTPServerConfig`](#httpserverconfig) | Class |
| [`PlaygroundConfig`](#playgroundconfig) | Class |
| [`ServerConfig`](#serverconfig) | Class |
| [`ServerConfigError`](#serverconfigerror) | Class |
| [`ServerLimits`](#serverlimits) | Class |
| [`load_server_config`](#load_server_config) | Function |

## HTTPServerConfig

Configure the compiled agent's HTTP listener and request concurrency.

```python theme={null}
HTTPServerConfig(
    host: str = '127.0.0.1',
    port: int = 1907,
    allow_remote: bool = False,
    request_timeout_seconds: float = 300,
    max_concurrent_requests: int = 8,
) -> None
```

Fields (`—` means no declared default):

| Field | Type | Default |
| - | - | - |
| `host` | `str` | `'127.0.0.1'` |
| `port` | `int` | `1907` |
| `allow_remote` | `bool` | `False` |
| `request_timeout_seconds` | `float` | `300` |
| `max_concurrent_requests` | `int` | `8` |

> [accordion] Parameters and example
>
> | Parameter | Type | Default |
> | - | - | - |
> | `host` | `str` | `'127.0.0.1'` |
> | `port` | `int` | `1907` |
> | `allow_remote` | `bool` | `False` |
> | `request_timeout_seconds` | `float` | `300` |
> | `max_concurrent_requests` | `int` | `8` |
>
> ```python theme={null}
> from harnest.server import HTTPServerConfig
>
> config = HTTPServerConfig()
> ```

## PlaygroundConfig

Control whether the local agent playground is exposed.

```python theme={null}
PlaygroundConfig(enabled: bool = True) -> None
```

Fields (`—` means no declared default):

| Field | Type | Default |
| - | - | - |
| `enabled` | `bool` | `True` |

> [accordion] Parameters and example
>
> | Parameter | Type | Default |
> | - | - | - |
> | `enabled` | `bool` | `True` |
>
> ```python theme={null}
> from harnest.server import PlaygroundConfig
>
> config = PlaygroundConfig()
> ```

## ServerConfig

Group validated listener, limit, UI, transport, and principal policy.

```python theme={null}
ServerConfig(
    http: HTTPServerConfig = HTTPServerConfig(host='127.0.0.1', port=1907, allow_remote=False, request_timeout_seconds=300, max_concurrent_requests=8),
    limits: ServerLimits = ServerLimits(max_request_bytes=1048576),
    playground: PlaygroundConfig = PlaygroundConfig(enabled=True),
    live: bool = False,
    agent_principal: Literal['optional', 'required'] = 'optional',
    openapi: bool = True,
    agui: bool = True,
) -> None
```

Fields (`—` means no declared default):

| Field | Type | Default |
| - | - | - |
| `http` | `HTTPServerConfig` | `HTTPServerConfig(host='127.0.0.1', port=1907, allow_remote=False, request_timeout_seconds=300, max_concurrent_requests=8)` |
| `limits` | `ServerLimits` | `ServerLimits(max_request_bytes=1048576)` |
| `playground` | `PlaygroundConfig` | `PlaygroundConfig(enabled=True)` |
| `live` | `bool` | `False` |
| `agent_principal` | `Literal['optional', 'required']` | `'optional'` |
| `openapi` | `bool` | `True` |
| `agui` | `bool` | `True` |

> [accordion] Parameters and example
>
> | Parameter | Type | Default |
> | - | - | - |
> | `http` | `HTTPServerConfig` | `HTTPServerConfig(host='127.0.0.1', port=1907, allow_remote=False, request_timeout_seconds=300, max_concurrent_requests=8)` |
> | `limits` | `ServerLimits` | `ServerLimits(max_request_bytes=1048576)` |
> | `playground` | `PlaygroundConfig` | `PlaygroundConfig(enabled=True)` |
> | `live` | `bool` | `False` |
> | `agent_principal` | `Literal['optional', 'required']` | `'optional'` |
> | `openapi` | `bool` | `True` |
> | `agui` | `bool` | `True` |
>
> ```python theme={null}
> from harnest.server import ServerConfig
>
> config = ServerConfig()
> ```

### ServerConfig.with\_overrides

```python theme={null}
ServerConfig.with_overrides(
    *,
    host: str | None = None,
    port: int | None = None,
    request_timeout_seconds: float | None = None,
    max_concurrent_requests: int | None = None,
    allow_remote: bool | None = None,
) -> 'ServerConfig'
```

Apply the compiled launcher's explicit operational overrides.

> [accordion] Parameters and example
>
> | Parameter | Type | Default |
> | - | - | - |
> | `host` | `str \| None` | `None` |
> | `port` | `int \| None` | `None` |
> | `request_timeout_seconds` | `float \| None` | `None` |
> | `max_concurrent_requests` | `int \| None` | `None` |
> | `allow_remote` | `bool \| None` | `None` |
>
> ```python theme={null}
> from harnest.server import ServerConfig
>
> config: ServerConfig
> config = config.with_overrides()
> ```

## ServerConfigError

Server settings are unsafe or do not match the public contract.

> [accordion] Example
>
> ```python theme={null}
> from harnest.server import ServerConfigError
>
> try:
>     ...
> except ServerConfigError as error:
>     ...
> ```

## ServerLimits

Set transport-independent limits enforced by the agent server.

```python theme={null}
ServerLimits(max_request_bytes: int = 1048576) -> None
```

Fields (`—` means no declared default):

| Field | Type | Default |
| - | - | - |
| `max_request_bytes` | `int` | `1048576` |

> [accordion] Parameters and example
>
> | Parameter | Type | Default |
> | - | - | - |
> | `max_request_bytes` | `int` | `1048576` |
>
> ```python theme={null}
> from harnest.server import ServerLimits
>
> limits = ServerLimits()
> ```

## load\_server\_config

Load server.yaml and resolve exact environment references.

```python theme={null}
load_server_config(path: str | Path, *, environment: Mapping[str, str] | None = None) -> ServerConfig
```

> [accordion] Parameters and example
>
> | Parameter | Type | Default |
> | - | - | - |
> | `path` | `str \| Path` | Required |
> | `environment` | `Mapping[str, str] \| None` | `None` |
>
> ```python theme={null}
> from harnest.server import load_server_config
>
> config = load_server_config(path=...)
> ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.