NSPError. Every exception the SDK raises is a subclass of it, so you can always catch nsp.NSPError as a broad fallback, or catch specific subclasses to handle individual failure modes precisely. All exceptions carry a human-readable message, a machine-readable code, and the HTTP status_code that the daemon returned (or 0 for connection-level failures).
Exception hierarchy
Base error fields
EveryNSPError subclass exposes:
Exception reference
NSPAuthError (401)
The API key is missing, invalid, or has been revoked. Check e.code for one of missing_key, invalid_key, or disabled_key.
NSPNotFoundError (404)
The requested PID or app name is not currently tracked by the daemon. This is not a fatal error — the app may simply not be running yet.
NSPRateLimitError (429)
You have exceeded the daemon’s rate limit for this API key (default: 100 state reads/sec, 10 actions/sec). Respect the backoff period and retry.
NSPProbeNotReadyError (503)
The cold probe is still in progress. The daemon has detected the application but has not yet completed its first JVMTI or CLR bridge attachment. Retry with exponential backoff.
NSPVerificationFailedError (422)
The action executed successfully at the runtime level, but the post-action verify_expression evaluated to false before the verify_timeout_ms elapsed. The side effect has already occurred.
NSPIrreversibleNotConfirmedError
You called execute() on an irreversible_write action without setting verify=True. This is a client-side check — no network request was made.
NSPTimeoutError (504)
A fresh probe timed out before returning a state snapshot. Fall back to the cached state and retry the fresh read later.
NSPConfidenceTooLowError (503)
The probe’s confidence score is below the minimum required to execute the requested action. This typically happens immediately after a cold probe, or after the app navigates to a new view and the probe must re-label the state.
Robust agent loop example
The example below shows how to handle every meaningful exception in a single agent loop. Copy it as a starting template for production agents.robust_agent.py
