# default_cache_dir

> **Function** in `deepagents_code`

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

Return the OS-appropriate cache directory for Deep Agents Code.

Uses `~/Library/Caches` on macOS, `LOCALAPPDATA` on Windows (falling back
to `~/AppData/Local`), and `XDG_CACHE_HOME` elsewhere when it is an
absolute path (falling back to `~/.cache`). The XDG spec treats relative
`XDG_CACHE_HOME` values as invalid, so they are ignored rather than
resolved against the launch directory. If the OS home directory cannot be
resolved to an absolute path, caches fall back to the selected profile's
`.state/cache` directory so an absolute `DEEPAGENTS_HOME` remains usable.

Platform-native locations are the convention for a long-lived app (this is
what `platformdirs` codifies and what `uv` itself does — its own cache is
`~/Library/Caches/uv` on macOS). The install script deliberately does not
follow this: as a portable one-shot POSIX bootstrap it uses XDG-style
`${XDG_CACHE_HOME:-~/.cache}` on every platform (like the rustup and uv
installers), so on macOS its `<cache>/deepagents-code/install.log` lands
under a different root than the update logs. That divergence is
intentional; do not "fix" one side to match the other without a concrete
need (e.g., a diagnostic command that collects both logs).

## Signature

```python
default_cache_dir() -> Path
```

## Returns

`Path`

Base cache directory, before the `deepagents-code` subdirectory.

---

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