# populate_thread_message_counts

> **Function** in `deepagents_cli`

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

Populate `message_count` for an existing thread list.

This is used by the `/threads` modal to render rows quickly, then backfill
counts in the background without issuing a second thread-list query.

## Signature

```python
populate_thread_message_counts(
    threads: list[ThreadInfo],
) -> list[ThreadInfo]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `threads` | `list[ThreadInfo]` | Yes | Thread rows to enrich in place. |

## Returns

`list[ThreadInfo]`

The same list object with `message_count` values populated.

---

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