> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://docs.nvidia.com/dynamo/llms.txt. For full content including API reference and SDK examples, see https://docs.nvidia.com/dynamo/llms-full.txt.

# dynamo.router

`dynamo.router` publishes 3 classes and 4 functions. Source: [`components/src/dynamo/router/__init__.py`](https://github.com/ai-dynamo/dynamo/blob/v1.5.0/components/src/dynamo/router/__init__.py)

#### DynamoRouterArgGroup (class)

CLI argument group for standalone router options.

```python
from dynamo.router.args import DynamoRouterArgGroup
```

[`components/src/dynamo/router/args.py#L88`](https://github.com/ai-dynamo/dynamo/blob/v1.5.0/components/src/dynamo/router/args.py#L88)

**Public methods**

#### add\_arguments

```python
add_arguments(parser) -> None
```

Add router-owned arguments to parser.

[source](https://github.com/ai-dynamo/dynamo/blob/v1.5.0/components/src/dynamo/router/args.py#L93)

#### DynamoRouterConfig (class)

Typed configuration for the standalone KV router (router-owned options only).

```python
from dynamo.router.args import DynamoRouterConfig
```

[`components/src/dynamo/router/args.py#L24`](https://github.com/ai-dynamo/dynamo/blob/v1.5.0/components/src/dynamo/router/args.py#L24)

**Public methods**

#### validate

```python
validate() -> None
```

Validate config invariants (aligned with Rust KvRouterConfig where applicable).

[source](https://github.com/ai-dynamo/dynamo/blob/v1.5.0/components/src/dynamo/router/args.py#L32)

#### DynamoRouterSweepConfigProvider (class)

Router search-space preparation and replay-spec materialization.

```python
from dynamo.router.simulation import DynamoRouterSweepConfigProvider
```

[`components/src/dynamo/router/simulation/provider.py#L132`](https://github.com/ai-dynamo/dynamo/blob/v1.5.0/components/src/dynamo/router/simulation/provider.py#L132)

**Public methods**

#### compile\_prediction

```python
compile_prediction(config: Mapping[str, JSONValue], context: PredictionAdapterContext) -> AdapterReplaySpec
```

No summary available.

[source](https://github.com/ai-dynamo/dynamo/blob/v1.5.0/components/src/dynamo/router/simulation/provider.py#L141)

#### compile\_recommendation

```python
compile_recommendation(config: Mapping[str, JSONValue], context: RecommendationAdapterContext) -> AdapterSearchPlan
```

No summary available.

[source](https://github.com/ai-dynamo/dynamo/blob/v1.5.0/components/src/dynamo/router/simulation/provider.py#L181)

#### materialize\_candidate

```python
materialize_candidate(plan: AdapterSearchPlan, selection: Mapping[str, JSONValue], context: CandidateContext) -> AdapterReplaySpec
```

No summary available.

[source](https://github.com/ai-dynamo/dynamo/blob/v1.5.0/components/src/dynamo/router/simulation/provider.py#L300)

#### generate\_search\_space

```python
generate_search_space(search_spec: Mapping[str, JSONValue], context: SweepContext) -> AdapterSearchPlan
```

No summary available.

[source](https://github.com/ai-dynamo/dynamo/blob/v1.5.0/components/src/dynamo/router/simulation/provider.py#L308)

#### materialize\_replay

```python
materialize_replay(plan: AdapterSearchPlan, selection: Mapping[str, JSONValue], context: CandidateContext) -> AdapterReplaySpec
```

No summary available.

[source](https://github.com/ai-dynamo/dynamo/blob/v1.5.0/components/src/dynamo/router/simulation/provider.py#L339)

#### build\_aic\_perf\_config (function)

No summary available.

```python
from dynamo.router.args import build_aic_perf_config
```

```python
build_aic_perf_config(router_config: DynamoRouterConfig) -> AicPerfConfig | None
```

[`components/src/dynamo/router/args.py#L135`](https://github.com/ai-dynamo/dynamo/blob/v1.5.0/components/src/dynamo/router/args.py#L135)

#### build\_kv\_router\_config (function)

Build KvRouterConfig from DynamoRouterConfig.

```python
from dynamo.router.args import build_kv_router_config
```

```python
build_kv_router_config(router_config: DynamoRouterConfig) -> KvRouterConfig
```

[`components/src/dynamo/router/args.py#L130`](https://github.com/ai-dynamo/dynamo/blob/v1.5.0/components/src/dynamo/router/args.py#L130)

#### create\_provider (function)

Create the entry-point registered Router sweep configuration provider.

```python
from dynamo.router.simulation import create_provider
```

```python
create_provider() -> DynamoRouterSweepConfigProvider
```

[`components/src/dynamo/router/simulation/provider.py#L417`](https://github.com/ai-dynamo/dynamo/blob/v1.5.0/components/src/dynamo/router/simulation/provider.py#L417)

#### parse\_args (function)

Parse command-line arguments for the standalone router.

```python
from dynamo.router.args import parse_args
```

```python
parse_args(argv: Optional[list[str]] = None) -> DynamoRouterConfig
```

**Returns**

* `DynamoRouterConfig` — Parsed and validated configuration.

[`components/src/dynamo/router/args.py#L143`](https://github.com/ai-dynamo/dynamo/blob/v1.5.0/components/src/dynamo/router/args.py#L143)