Skip to main content
Before you route real traffic through an NSP-based agent, work through every item below. These steps protect your data, keep your agent running reliably, and make failures observable before they become incidents.

Daemon Configuration

Harden the daemon’s axon.toml before going live. The default config is tuned for local development; production needs tighter settings.
1

Enable API key authentication

Confirm authentication is on. Run a health check and look for "auth_enabled": true:
If auth_enabled is false, update your config and restart the daemon:
Generate a production key with axon-daemon.exe keygen and store it in your secrets manager — not in source code.
2

Bind to localhost only

The daemon must never listen on a network interface. Verify your config:
CDP gives remote code execution access to any browser the daemon probes. Exposing the daemon port externally would give that access to anyone on the network.
3

Set appropriate rate limits

Tune rate limits to match your agent’s actual usage pattern. The defaults are conservative:
If your agent uses streaming (session.watch()), the /watch WebSocket endpoint is not rate-limited — you can reduce state_per_second accordingly.
4

Enable persistent schema registry

Without a persistent registry, the daemon relearns every app schema from scratch on each restart, causing a 30–90 second confidence warm-up per app:
Schedule a daily backup of axon_registry.db (see the Backup section below).
5

Lock down CORS

If you expose a dashboard that calls the daemon directly from a browser, restrict CORS to exactly those origins:
Never set allow_all_origins = true in production.
6

Set structured logging at info level

debug logging generates gigabytes of output per day on a busy daemon. Use info and structured JSON for log aggregator compatibility:

Agent Code Safety

1

Use verify=True on all irreversible actions

Any action with reversibility: irreversible_writesend_reply, send_email, delete, take_off, and others — must include a verify_expression. Without it, the daemon rejects the request:
2

Gate on confidence before critical actions

Never execute actions against low-confidence state. A confidence below 0.95 means the probe hasn’t fully mapped the application yet:
3

Handle NSPConfidenceTooLowError gracefully

Even with a pre-check, confidence can drop between the check and the execute call. Catch the error and retry with backoff:
4

Use wait_for_app instead of attach on startup

client.attach() raises NSPNotFoundError if the app isn’t ready yet. wait_for_app retries until the app is detected and confidence is sufficient:
5

Use streaming instead of polling

Polling burns your rate limit and adds latency. Streaming is free (not rate-limited) and reacts within 50–100ms:
6

Store API keys in environment variables

Never hardcode sk_nsp_... keys in source code. Use environment variables or a secrets manager:
Verify that repr() outputs and log statements never surface key values.

Testing Before Going Live

Before enabling any irreversible_write action in production, verify your agent logic with reversible_write equivalents. For example, test with archive and mark_read before enabling send_reply or delete. Reversible actions can be undone; irreversible ones cannot.
Deliberately cause an action to fail (e.g., pass an invalid email_id) and confirm that result.success is False and your agent handles the error path correctly. A verify_expression that always evaluates to true provides no protection.
Measure your daemon’s actual throughput before deploying an agent that fires frequently:

Monitoring

Set up monitoring before your first production deployment, not after the first incident.
1

Poll the health endpoint

The daemon exposes a health endpoint at GET http://localhost:7842/health. Configure your monitoring system (Datadog, Prometheus, Uptime Kuma, etc.) to poll it every 30 seconds:
Alert on status != "ok" and on tracked_processes dropping to 0 unexpectedly.
2

Alert on daemon restarts

A drop in uptime_secs between two consecutive health checks means the daemon restarted. Restarts trigger cold probe warm-ups for any apps not in the persisted registry.
3

Monitor for 429 responses

Rate limit errors (HTTP 429) from your agent mean it’s polling too fast. Instrument your agent code to count NSPRateLimitError exceptions and send that metric to your observability platform. A non-zero rate is a signal to switch to streaming.
4

Set up log forwarding

Forward daemon logs to a centralized aggregator. With format = "json" in axon.toml, the logs are structured and immediately queryable:
For log rotation on Windows, the daemon writes to stdout by default. Wrap it with a log rotation tool (e.g. nxlog, Windows Event Log forwarding, or a sidecar container) before production.

Daemon Auto-Start

1

Install as a Windows Service

Run this once as Administrator to register the daemon as a managed Windows Service:
The service is named NSPDaemon and starts automatically at boot.
2

Configure automatic restart on failure

Open Services → NSPDaemon → Properties → Recovery and set:
  • First failure: Restart the Service
  • Second failure: Restart the Service
  • Subsequent failures: Restart the Service
  • Reset fail count after: 1 day
This ensures the daemon recovers from transient crashes without manual intervention.
3

Verify the service starts after reboot

Reboot a test machine and confirm the daemon is running before deploying to production:

Key Management and Backup

The keys file grants full access to all NSP operations. Restrict it to the service account only:
Generate a new key with axon-daemon.exe keygen, update your deployment secrets, restart the agent process, and then remove the old key from axon_keys.json. The daemon reloads the keys file without a restart.
The schema registry database stores the learned app schemas. Losing it means a 30–90 second cold-probe warm-up per app on the next daemon start. Schedule a daily copy:
Keep at least 7 days of backups. If the database becomes corrupt, restore the most recent backup and restart the daemon.

Quick Reference: Common Production Issues