> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ns.rocks/llms.txt
> Use this file to discover all available pages before exploring further.

# Desktop And PTY

> Python SDK object reference for desktop automation, managed viewer streams, recordings, and terminal sessions.

Use desktop automation when a workload needs GUI state. Use PTY when a tool
expects an interactive terminal.

## Desktop Automation

| Method group                                                     | Use                                 |
| ---------------------------------------------------------------- | ----------------------------------- |
| `screenshot`, `screenshot_region`, `screenshot_compressed`       | Capture display pixels.             |
| `click`, `double_click`, `move`, `drag`, `scroll`                | Send mouse input.                   |
| `type`, `write`, `key`, `press`, `hotkey`                        | Send keyboard input.                |
| `display_info`, `capabilities`, `screen_size`, `cursor_position` | Inspect desktop state.              |
| `list_windows`, `get_current_window_id`, `get_window_title`      | Inspect windows.                    |
| `get_clipboard_text`, `set_clipboard_text`                       | Manage clipboard text.              |
| `launch_executable`, `launch_desktop_entry`, `open`              | Start GUI programs or open targets. |

## Viewer And Recordings

| Surface                                                | Use                                   |
| ------------------------------------------------------ | ------------------------------------- |
| `machine.desktop_stream().start()`                     | Start a managed browser viewer.       |
| `get_viewer_url()`                                     | Return a viewer URL with an auth key. |
| `start_recording`, `stop_recording`, `list_recordings` | Capture screen recordings.            |
| `download_recording`, `delete_recording`               | Retrieve or remove recordings.        |

## PTY

| Method                                 | Use                                |
| -------------------------------------- | ---------------------------------- |
| `machine.pty.create_session(...)`      | Start an interactive terminal.     |
| `machine.pty.connect(session_id=...)`  | Reconnect to an existing terminal. |
| `session.send_input(data)`             | Write terminal input.              |
| `session.resize(cols, rows)`           | Resize terminal dimensions.        |
| `session.wait(on_data=...)`            | Stream terminal output until exit. |
| `machine.pty.list_sessions()`          | List terminal sessions.            |
| `machine.pty.kill_session(session_id)` | Stop a terminal session.           |

## Related

* [Desktop automation](../../desktop/automation)
* [Desktop viewer](../../desktop/viewer)
* [PTY](../../access/pty)
