nelieo-nsp package is the official Python SDK for NSP. It gives your agent a fully async, typed interface for every operation the daemon exposes: discovering tracked apps, reading live application state, executing actions with verification, and subscribing to real-time state change events over WebSocket. Instead of constructing raw HTTP calls or managing WebSocket connections yourself, you open an NSPClient, attach to an app by name, and work with plain Python objects.
What the SDK provides
The SDK is built around four main abstractions that you’ll use in every agent you write:NSPClient— the top-level async context manager. It manages the HTTP connection pool, injects your API key on every request, and exposesattach(),list_apps(),get_state(), andwatch().Session(NSPSession) — a handle to one attached application. It caches state locally and provides typed accessors (get_str,get_int,get_bool), action execution with reversibility enforcement, and awatch()stream.- WebSocket streaming —
session.watch()returns an async generator that yields aStateChangeNotificationon every probe cycle that detects a change, so your agent reacts in real time without polling. - CLR and JVM helpers —
session.clrandsession.jvmexpose runtime-specific methods for reading .NET fields, invoking managed methods, and reading JVM fields directly from live processes.
Quick start: a complete agent loop
The example below mirrors thegmail_agent function from the NSP quickstart. It attaches to Gmail, reads unread count and subject line, then sends a reply with post-action verification.
gmail_agent.py
Features
- Fully async — every network operation uses
async/awaitviahttpxandwebsockets. The SDK never blocks the event loop. - Typed models —
SubstrateState,AppSummary,ActionResponse, andStateChangeNotificationare Pydantic v2 models. Your editor autocompletes every field. - Attach by name —
session = await client.attach("Gmail")finds the right process automatically. You never need to look up PIDs manually. - Reversibility enforcement — the SDK raises
NSPIrreversibleNotConfirmedErrorbefore sending the request if you omitverify=Trueon a destructive action. - Real-time streaming —
session.watch()yields events the moment the daemon detects a state change, without consuming your action rate limit. - CLR and JVM helpers —
session.clrandsession.jvmlet you read .NET and Java fields and invoke methods directly from Python.
Explore the SDK
Installation
Install nelieo-nsp, configure your API key, and verify connectivity to the daemon.
NSPClient
Constructor parameters, all client methods, and authentication options.
Session
State accessors, action execution, refresh patterns, and wait helpers.
Streaming
Real-time WebSocket state events, sequence gaps, and reconnection handling.
CLR Helper
Read .NET fields, invoke managed methods, and handle raw return values.
JVM Helper
Read Java fields via JVMTI, invoke methods, and enumerate loaded classes.
Error Handling
Every exception the SDK raises, retry strategies, and a robust agent loop template.
