# list_threads_command

> **Function** in `deepagents_cli`

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

CLI handler for `deepagents threads list`.

Fetches and displays a table of recent conversation threads, optionally
filtered by agent name or git branch.

## Signature

```python
list_threads_command(
    agent_name: str | None = None,
    limit: int | None = None,
    sort_by: str | None = None,
    branch: str | None = None,
    verbose: bool = False,
    relative: bool | None = None,
    *,
    output_format: OutputFormat = 'text',
) -> None
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `agent_name` | `str \| None` | No | Only show threads belonging to this agent.  When `None`, threads for all agents are shown. (default: `None`) |
| `limit` | `int \| None` | No | Maximum number of threads to display.  When `None`, reads from `DA_CLI_RECENT_THREADS` or falls back to the default. (default: `None`) |
| `sort_by` | `str \| None` | No | Sort field — `"updated"` or `"created"`.  When `None`, reads from config (`~/.deepagents/config.toml`). (default: `None`) |
| `branch` | `str \| None` | No | Only show threads from this git branch. (default: `None`) |
| `verbose` | `bool` | No | When `True`, show all columns (branch, created, prompt). (default: `False`) |
| `relative` | `bool \| None` | No | Show timestamps as relative time (e.g., '5m ago').  When `None`, reads from config (`~/.deepagents/config.toml`). (default: `None`) |
| `output_format` | `OutputFormat` | No | Output format — `'text'` (Rich) or `'json'`. (default: `'text'`) |

---

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