Prerequisites
Before you write any code, make sure the following are in place:Chrome Debug Port
Chrome must be running with
--remote-debugging-port=9222. See the Chrome Setup guide for launch instructions.Gmail Open
Open
mail.google.com in a Chrome tab. The daemon matches the tab by URL within about 5 seconds.NSP Daemon Running
Run
axon-daemon.exe run (or start the Windows Service). The daemon listens on http://localhost:7842 by default.SDK Installed
Install the Python SDK:
pip install nelieo-nspStep 1 — Verify Gmail Is Detected
Before building your agent, confirm the daemon has picked up Gmail. Run a quick list check:confidence >= 0.95. If it doesn’t show up yet, wait 30–60 seconds for the cold probe to complete.
Step 2 — Connect to Gmail
Usewait_for_app instead of a bare attach call. It retries until Gmail is ready, which is safer on startup:
Step 3 — Read Inbox State
Callsession.refresh() before reading to get the latest snapshot, then pull fields from the state tree using typed accessors:
Available inbox state keys
Step 4 — Send a Reply
Step 5 — Archive and Mark as Read
These arereversible_write actions so they don’t require a verify_expression, though adding one is still good practice:
Step 6 — Stream New Emails in Real Time
Usesession.watch() with auto_refresh_on_event=True so the session state is always current inside the loop. Filter on inbox.unread_count to detect arrivals:
The
/watch WebSocket endpoint is not subject to the daemon’s rate limiter. You can keep a stream open indefinitely without consuming your request quota.