# open_in_editor

> **Function** in `deepagents_code`

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

Open current_text in an external editor.

Creates a temp .md file, launches the editor, and reads back the result.

## Signature

```python
open_in_editor(
    current_text: str,
    *,
    allow_empty: bool = False,
    raise_on_error: bool = False,
) -> str | None
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `current_text` | `str` | Yes | The text to pre-populate in the editor. |
| `allow_empty` | `bool` | No | Return an empty or whitespace-only edited result instead of treating it as cancellation. (default: `False`) |
| `raise_on_error` | `bool` | No | Re-raise editor launch and file errors instead of treating them as cancellation. (default: `False`) |

## Returns

`str | None`

The edited text with normalized line endings, or `None` if the editor
exited with a non-zero status, returned blank text while `allow_empty`
is false, or failed while `raise_on_error` is false.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/3812967c84d90619848f3185f22470204fc88bd8/libs/code/deepagents_code/editor.py#L113)