# clear_default_agent

> **Function** in `deepagents_code`

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

Remove the default agent from the config file.

Deletes the `[agents].default` key so that future launches fall back
to `[agents].recent` and then `DEFAULT_AGENT_NAME`.

## Signature

```python
clear_default_agent(
    config_path: Path | None = None,
) -> bool
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `config_path` | `Path \| None` | No | Path to config file.  Defaults to `~/.deepagents/config.toml`. (default: `None`) |

## Returns

`bool`

True if the key was removed (or was already absent), False on I/O error.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/0412009c5441bef8d75a427e1da8909e33ab5b56/libs/code/deepagents_code/model_config.py#L3374)