# format_path

> **Function** in `deepagents_cli`

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

Format a filesystem path for display.

Paths under the user's home directory are shown relative to `~`.
All other paths are returned as-is.

## Signature

```python
format_path(
    path: str | None,
) -> str
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `path` | `str \| None` | Yes | Absolute filesystem path, or `None`. |

## Returns

`str`

Formatted path string, or empty string if path is falsy.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/4869645403fe9ce57df6067417fdefc6bf509fe0/libs/cli/deepagents_cli/sessions.py#L194)