# expand_paste_refs

> **Function** in `deepagents_code`

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

Replace all paste placeholders in `text` with their full content.

Placeholders whose IDs are not in `pasted_contents` are left unchanged.

## Signature

```python
expand_paste_refs(
    text: str,
    pasted_contents: dict[int, PastedContent],
) -> str
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `text` | `str` | Yes | The text containing placeholders. |
| `pasted_contents` | `dict[int, PastedContent]` | Yes | Mapping of paste IDs to stored content. |

## Returns

`str`

The text with all known placeholders expanded.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/e14e0adcbe78565ed3650e7f24b2a775d5437d25/libs/code/deepagents_code/paste_collapse.py#L85)