1
Prerequisites
Before you start, confirm you have everything in place:Install the SDK:Set your API key as an environment variable so you never hardcode it:
- NSP daemon installed and running. Download the latest
Nelieo NSP Setup.exefrom platform.nelieo.com/download. The installer registers the daemon as a Windows Service that auto-starts on login and listens on port 7842. - Chrome launched with the remote debugging port enabled. NSP reads Gmail’s V8 state through the Chrome DevTools Protocol (CDP). You must start Chrome with the flag before opening Gmail.
- Gmail open in a tab. Navigate to
mail.google.comafter Chrome is running. - Python 3.11+ and the NSP SDK installed.
- An NSP API key from platform.nelieo.com.
2
Connect to Gmail
NSPClient manages the connection to your local daemon. Call attach() with the app name — NSP resolves the correct process automatically, so you never need to track PIDs yourself.If Gmail has not been probed yet (first run),
attach() may take up to 30 seconds while the daemon runs a cold V8 heap snapshot. On subsequent runs the schema is cached and attachment completes in under a second. Use client.wait_for_app("Gmail", timeout=30.0) if you want an explicit timeout with automatic retries.3
Read Inbox State
Once attached, read typed state values directly from the session using dot-notation keys. NSP normalises Gmail’s V8 runtime data into the Substrate Schema Format (SSF) so every key is stable and predictable across probe cycles.Expected output:
4
List Available Actions
Every session exposes the actions that NSP discovered for the current app. Iterate Example output:
session.actions to see what your agent can do, along with each action’s type signature and reversibility classification.5
Archive an Email (Reversible)
archive is a reversible_write action — it moves an email out of your inbox but you can undo it by unarchiving later. Reversible actions do not require a verify_expression, though you can add one for extra confidence.6
Send a Reply (Irreversible)
send_reply is an irreversible_write action — once sent, the email cannot be recalled. NSP requires verify=True and a verify_expression for all irreversible actions. The daemon executes the action, then polls post-action state until your expression evaluates to true (or the timeout elapses).7
Watch for New Emails (Real-Time Streaming)
Instead of polling for changes, open a WebSocket watch stream. The daemon fires an event on every probe cycle (roughly every 2 seconds) that contains a list of which state keys changed. Use Expected output (as new mail arrives):
auto_refresh_on_event=True so that session.get_*() calls inside the loop always return the latest values.