# extract_leading_pasted_file_path

> **Function** in `deepagents_cli`

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

Extract and resolve a leading pasted path token from input text.

This is used for submit-time recovery when a user message starts with a
path token followed by additional prompt text.

## Signature

```python
extract_leading_pasted_file_path(
    text: str,
) -> tuple[Path, int] | None
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `text` | `str` | Yes | Input text to inspect. |

## Returns

`tuple[Path, int] | None`

Tuple of `(resolved_path, token_end_index)` or `None` when no valid

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/1ae053f347679e58562d2b81eb6d6e6e9bbf0b07/libs/cli/deepagents_cli/input.py#L439)