# apply_cached_thread_message_counts

> **Function** in `deepagents_cli`

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

Apply cached message counts onto thread rows when freshness matches.

## Signature

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

## Parameters

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

## Returns

`int`

Number of rows that were populated from cache.

---

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