# BtwScreen

> **Class** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/tui/modals/btw/BtwScreen)

Chat independently of the main run with restorable side exchanges.

## Signature

```python
BtwScreen(
    self,
    answer: Callable[[str], Awaitable[str]],
    question: str = '',
    *,
    history: Sequence[tuple[str, str]] = (),
    stream_answer: Callable[[str, Callable[[str], Awaitable[None]]], Awaitable[str]] | None = None,
    on_clear: Callable[[], None] | None = None,
)
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `answer` | `Callable[[str], Awaitable[str]]` | Yes | Generate a complete side answer. |
| `question` | `str` | No | Initial question, or empty to start with the editor. (default: `''`) |
| `history` | `Sequence[tuple[str, str]]` | No | Completed exchanges to restore when reopening the conversation. (default: `()`) |
| `stream_answer` | `Callable[[str, Callable[[str], Awaitable[None]]], Awaitable[str]] \| None` | No | Optional generator that delivers fragments to its receiver. (default: `None`) |
| `on_clear` | `Callable[[], None] \| None` | No | Discard the caller's side-conversation history on reset. (default: `None`) |

## Extends

- `ModalScreen[None]`

## Constructors

```python
__init__(
    self,
    answer: Callable[[str], Awaitable[str]],
    question: str = '',
    *,
    history: Sequence[tuple[str, str]] = (),
    stream_answer: Callable[[str, Callable[[str], Awaitable[None]]], Awaitable[str]] | None = None,
    on_clear: Callable[[], None] | None = None,
) -> None
```

| Name | Type |
|------|------|
| `answer` | `Callable[[str], Awaitable[str]]` |
| `question` | `str` |
| `history` | `Sequence[tuple[str, str]]` |
| `stream_answer` | `Callable[[str, Callable[[str], Awaitable[None]]], Awaitable[str]] \| None` |
| `on_clear` | `Callable[[], None] \| None` |


## Properties

- `CSS_PATH`
- `BINDINGS`

## Methods

- [`compose()`](https://reference.langchain.com/python/deepagents-code/tui/modals/btw/BtwScreen/compose)
- [`on_mount()`](https://reference.langchain.com/python/deepagents-code/tui/modals/btw/BtwScreen/on_mount)
- [`on_btw_text_area_submitted()`](https://reference.langchain.com/python/deepagents-code/tui/modals/btw/BtwScreen/on_btw_text_area_submitted)
- [`action_clear()`](https://reference.langchain.com/python/deepagents-code/tui/modals/btw/BtwScreen/action_clear)
- [`on_unmount()`](https://reference.langchain.com/python/deepagents-code/tui/modals/btw/BtwScreen/on_unmount)
- [`action_cancel()`](https://reference.langchain.com/python/deepagents-code/tui/modals/btw/BtwScreen/action_cancel)

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/4bfa52000ef65ac623d8ada0cb67f67cbdd663ea/libs/code/deepagents_code/tui/modals/btw.py#L46)