# save_default_model

> **Function** in `deepagents_cli`

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

Update the default model in config file.

Reads existing config (if any), updates `[models].default`, and writes
back using proper TOML serialization.

## Signature

```python
save_default_model(
    model_spec: str,
    config_path: Path | None = None,
) -> bool
```

## Description

**Note:**

This function does not preserve comments in the config file.

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `model_spec` | `str` | Yes | The model to set as default in `provider:model` format. |
| `config_path` | `Path \| None` | No | Path to config file.  Defaults to `~/.deepagents/config.toml`. (default: `None`) |

## Returns

`bool`

True if save succeeded, False if it failed due to I/O errors.

---

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