# DebugConsoleScreen

> **Class** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/tui/widgets/debug_console/DebugConsoleScreen)

Modal showing a session snapshot and a live tail of recent log records.

## Signature

```python
DebugConsoleScreen(
    self,
    snapshot: Sequence[SnapshotField],
    *,
    snapshot_provider: Callable[[], Sequence[SnapshotField]] | None = None,
    cost_breakdown_provider: Callable[[], str] | None = None,
    mcp_servers_provider: Callable[[], Sequence[MCPServerInfo]] | None = None,
    cleared_upto: int = 0,
    on_clear: Callable[[int], None] | None = None,
    click_to_copy: bool = _CLICK_TO_COPY_DEFAULT,
    on_click_to_copy_change: Callable[[bool], None] | None = None,
)
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `snapshot` | `Sequence[SnapshotField]` | Yes | Ordered `SnapshotField` rows rendered on first paint. |
| `snapshot_provider` | `Callable[[], Sequence[SnapshotField]] \| None` | No | Optional callable that rebuilds the snapshot from live host state. When set, the header is refreshed on the same tick as the log tail whenever the provider returns a different row list. Omit for a freeze-frame header (e.g. unit tests). (default: `None`) |
| `cost_breakdown_provider` | `Callable[[], str] \| None` | No | Optional callable that builds the detailed token and cost breakdown shown in a dedicated modal. An empty string hides the breakdown button. (default: `None`) |
| `mcp_servers_provider` | `Callable[[], Sequence[MCPServerInfo]] \| None` | No | Live metadata for the read-only MCP server modal. (default: `None`) |
| `cleared_upto` | `int` | No | Absolute emission index a prior clear advanced to. The console starts rendering from here so a clear persists across close/reopen; records emitted after it still appear. (default: `0`) |
| `on_clear` | `Callable[[int], None] \| None` | No | Invoked with the new clear cursor whenever a shortcut clears the view, letting the owner persist it for the next open. (default: `None`) |
| `click_to_copy` | `bool` | No | Initial state of the "Click to copy" checkbox, restored from the persisted preference. (default: `_CLICK_TO_COPY_DEFAULT`) |
| `on_click_to_copy_change` | `Callable[[bool], None] \| None` | No | Called with the new value whenever the checkbox is toggled, so the host can persist the preference. (default: `None`) |

## Extends

- `ModalScreen[None]`

## Constructors

```python
__init__(
    self,
    snapshot: Sequence[SnapshotField],
    *,
    snapshot_provider: Callable[[], Sequence[SnapshotField]] | None = None,
    cost_breakdown_provider: Callable[[], str] | None = None,
    mcp_servers_provider: Callable[[], Sequence[MCPServerInfo]] | None = None,
    cleared_upto: int = 0,
    on_clear: Callable[[int], None] | None = None,
    click_to_copy: bool = _CLICK_TO_COPY_DEFAULT,
    on_click_to_copy_change: Callable[[bool], None] | None = None,
) -> None
```

| Name | Type |
|------|------|
| `snapshot` | `Sequence[SnapshotField]` |
| `snapshot_provider` | `Callable[[], Sequence[SnapshotField]] \| None` |
| `cost_breakdown_provider` | `Callable[[], str] \| None` |
| `mcp_servers_provider` | `Callable[[], Sequence[MCPServerInfo]] \| None` |
| `cleared_upto` | `int` |
| `on_clear` | `Callable[[int], None] \| None` |
| `click_to_copy` | `bool` |
| `on_click_to_copy_change` | `Callable[[bool], None] \| None` |


## Properties

- `BINDINGS`
- `CSS`

## Methods

- [`compose()`](https://reference.langchain.com/python/deepagents-code/tui/widgets/debug_console/DebugConsoleScreen/compose)
- [`on_mount()`](https://reference.langchain.com/python/deepagents-code/tui/widgets/debug_console/DebugConsoleScreen/on_mount)
- [`key_tab()`](https://reference.langchain.com/python/deepagents-code/tui/widgets/debug_console/DebugConsoleScreen/key_tab)
- [`key_shift_tab()`](https://reference.langchain.com/python/deepagents-code/tui/widgets/debug_console/DebugConsoleScreen/key_shift_tab)
- [`on_mouse_down()`](https://reference.langchain.com/python/deepagents-code/tui/widgets/debug_console/DebugConsoleScreen/on_mouse_down)
- [`on_button_pressed()`](https://reference.langchain.com/python/deepagents-code/tui/widgets/debug_console/DebugConsoleScreen/on_button_pressed)
- [`on_select_changed()`](https://reference.langchain.com/python/deepagents-code/tui/widgets/debug_console/DebugConsoleScreen/on_select_changed)
- [`on_checkbox_changed()`](https://reference.langchain.com/python/deepagents-code/tui/widgets/debug_console/DebugConsoleScreen/on_checkbox_changed)
- [`action_clear_view()`](https://reference.langchain.com/python/deepagents-code/tui/widgets/debug_console/DebugConsoleScreen/action_clear_view)
- [`action_copy()`](https://reference.langchain.com/python/deepagents-code/tui/widgets/debug_console/DebugConsoleScreen/action_copy)
- [`action_close()`](https://reference.langchain.com/python/deepagents-code/tui/widgets/debug_console/DebugConsoleScreen/action_close)

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/caaa7e7c12d214afa5cf0a1afed8eb6232aa6f7b/libs/code/deepagents_code/tui/widgets/debug_console.py#L722)