nen-desktop
Python SDK for the Nen Desktop API. Create cloud desktops, execute computer-use tools, and manage RDP sessions programmatically.
Installation
pip install nen-sdk-python
Quick Start
from nen_sdk import NenDesktop
client = NenDesktop(api_key="sk_nen_...")
# Create a desktop
desktop = client.create_desktop()
print(f"Created: {desktop.desktop_id} (status: {desktop.status})")
# Check its status
desktop = client.get_desktop(desktop.desktop_id)
print(f"Status: {desktop.status}, IP: {desktop.public_ip}")
# Clean up
client.delete_desktop(desktop.desktop_id)
Configuration
client = NenDesktop(
api_key="sk_nen_...",
base_url="https://desktop.api.getnen.ai", # default
timeout=30.0, # default (seconds)
)
The execute() method uses a 120-second timeout regardless of the client timeout, since tool execution can be slow.
API Reference
Desktop CRUD
| Method | Description |
|---|---|
create_desktop(desktop_type="sandbox") |
Create a new desktop. Returns Desktop. |
list_desktops() |
List all active desktops. Returns list[Desktop]. |
get_desktop(desktop_id) |
Get a single desktop. Returns Desktop. |
update_desktop(desktop_id, *, name) |
Update desktop name. Returns Desktop. |
delete_desktop(desktop_id) |
Delete a desktop. Returns DeleteResponse. |
Computer-use actions
Typed helpers that build the correct wire format automatically:
| Method | Description |
|---|---|
screenshot(desktop_id) |
Capture a screenshot. Returns ExecuteResult with base64_image. |
left_click(desktop_id, x, y) |
Left-click at (x, y). |
right_click(desktop_id, x, y) |
Right-click at (x, y). |
double_click(desktop_id, x, y) |
Double-click at (x, y). |
middle_click(desktop_id, x, y) |
Middle-click at (x, y). |
mouse_move(desktop_id, x, y) |
Move the cursor to (x, y) without clicking. |
type_text(desktop_id, text) |
Type a string at the current cursor position. |
key_press(desktop_id, key) |
Send a key or chord (e.g. "Return", "ctrl+c"). |
scroll(desktop_id, x, y, *, direction, amount=3) |
Scroll at (x, y). direction is "up" or "down". |
cursor_position(desktop_id) |
Return the current cursor coordinates. |
# Take a screenshot
result = client.screenshot(desktop.desktop_id)
# result.base64_image contains a PNG encoded as base64
# Click, type, scroll
client.left_click(desktop.desktop_id, 512, 384)
client.type_text(desktop.desktop_id, "hello world")
client.scroll(desktop.desktop_id, 512, 384, direction="down", amount=5)
# Key combos
client.key_press(desktop.desktop_id, "ctrl+c")
client.key_press(desktop.desktop_id, "Return")
Low-level execute
| Method | Description |
|---|---|
execute(desktop_id, *, tool, action, params=None) |
Execute any tool action with a raw params dict. Returns ExecuteResult. |
list_tools(desktop_id) |
List available tools and their schemas. Returns list[ToolSchema]. |
get_tool_logs(desktop_id) |
Get tool execution logs. Returns list[dict]. |
Sessions
| Method | Description |
|---|---|
create_session(desktop_id) |
Create or reconnect an RDP session. Returns SessionInfo. |
get_session(desktop_id) |
Get session status. Returns SessionInfo. |
delete_session(desktop_id) |
Disconnect the session. Returns None. |
Error Handling
All API errors raise a subclass of NenDesktopError, which carries status_code and response_body:
from nen_sdk import NenDesktop, NotFoundError, AuthenticationError
client = NenDesktop(api_key="sk_nen_...")
try:
client.get_desktop("dsk_nonexistent")
except NotFoundError as e:
print(f"Not found: {e.status_code}")
except AuthenticationError as e:
print(f"Auth failed: {e.status_code}")
| Exception | Status Code |
|---|---|
AuthenticationError |
401 |
NotFoundError |
404 |
ConflictError |
409 |
ServerError |
5xx |
NenDesktopError |
anything else >= 400 |
Context Manager
The client supports context manager usage to automatically close the underlying HTTP connection:
with NenDesktop(api_key="sk_nen_...") as client:
desktop = client.create_desktop()
# ...
Examples
See the full agent example in the Nen documentation.
Metadata
Release files for nen-sdk-python 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nen_sdk_python-0.4.0.tar.gz | 20.4 kB | With provenance | Details for nen_sdk_python-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nen_sdk_python-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for nen_sdk_python-0.4.0-py3-none-any.whl |
Total release size: 27.2 kB
Release files / nen_sdk_python-0.4.0.tar.gz
| Download URL | nen_sdk_python-0.4.0.tar.gz |
|---|---|
| Size | 20.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
206417cef8ba409d04697b0b48424af63a0a0981c323a17fdbd1dc0e86503aec
|
|
BLAKE2b-256 checksum How to use checksums |
804845203091e7acb0cb9f7a8e7910957f92b2da3557c24d23fbea628ae4cc8a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 21, 2026.
Transparency logRelease files / nen_sdk_python-0.4.0-py3-none-any.whl
| Download URL | nen_sdk_python-0.4.0-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d1675c8b7a7b1100f40a2b8a0173981240511692c9d584ae94d61cb1877c0132
|
|
BLAKE2b-256 checksum How to use checksums |
fa586c0a905ccb13de9cc71097d74b8e0d9c7cdbf283983a645f872cbf298a72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 21, 2026.
Transparency logSecurity for nen-sdk-python 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for nen_sdk_python-0.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 21, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.