# apply_cached_thread_initial_prompts

> **Function** in `deepagents_code`

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

Apply cached initial prompts onto thread rows when freshness matches.

## Signature

```python
apply_cached_thread_initial_prompts(
    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/d1c6946218b4f0f86ab7b02b6bb6af1e4b75cede/libs/code/deepagents_code/sessions.py#L560)