Skip to main content
POST /action dispatches a typed action to a tracked application through its runtime probe. You can execute any action that appears in the actions map of a SubstrateState snapshot — from sending an email reply to archiving a message to clicking a UI element via CDP. Before dispatching, the endpoint enforces safety gates that block irreversible actions without a verify_expression, and after dispatching it optionally polls the updated state to confirm the action had its intended effect.
The /action endpoint has a 120-second timeout, separate from the standard 30-second timeout applied to all other endpoints. This extended window accommodates cold probe attachment, CDP command execution, post-action state settlement, and verification polling.

Endpoint

Request Body

Supply either pid or app_id — the daemon resolves the other automatically. Providing both is also valid and the daemon will confirm they refer to the same process.
integer
Target process ID. Either pid or app_id must be present.
string
Target application ID. Either pid or app_id must be present. Prefer app_id for robustness across process restarts.
string
required
Name of the action to execute. Must match a key in the actions map returned by GET /state/{pid} or GET /schema/{pid}.
object
required
Key-value map of parameters that match the action’s declared schema. Required parameters must be present; optional parameters may be omitted.
string
A JavaScript-style expression evaluated against the post-action state to confirm success. Required for any action with reversibility: "irreversible_write". Must not exceed 2048 bytes.
integer
How long to poll for the verify_expression to evaluate to true, in milliseconds. Accepts values from 100 to 30000. Defaults to 5000.
boolean
default:"false"
When true, the daemon captures a fresh state snapshot before dispatching the action. Useful when your agent’s view of the application may be stale.

Response

boolean
true when the action ran and any verify_expression passed. false on pre-flight failure or verification failure.
string (UUIDv7)
Unique time-ordered identifier for this execution. Use it for audit logs and idempotency checks.
string
The name of the action that was executed.
boolean
true when the action itself was dispatched to the runtime. May be false when a pre-flight safety gate rejected the request before dispatch.
string
The runtime path used for execution, for example "v8" or "clr".
integer
Total wall time from request receipt to response, in milliseconds.
string
Human-readable status message.
VerificationOutcome | null
Post-action verification result. null when no verify_expression was provided.
SubstrateState | null
Full state snapshot captured after the action completed. null when post-action state capture was skipped.
object | null
Compact before/after diff of the fields that changed as a result of the action.
any | null
Raw return value from the underlying function invocation. Populated for JVM and CLR method calls; null for CDP and V8 actions.
object | null
Snapshot of the JVM invocation context captured at dispatch time. Populated only for JVM method-level actions; null for all other runtimes and action types.

CDP Builtin Actions

For V8 applications, NSP exposes CDP built-in actions that map directly to Chrome DevTools Protocol commands. These are always available regardless of what the probe discovered.

Action Safety Gates

The daemon enforces three safety gates before dispatching any action. A gate failure returns a 400 immediately — the action is not executed.

1. Irreversible Write Gate

When an action’s schema carries reversibility: "irreversible_write", a verify_expression is required. This ensures that irreversible side-effects are always paired with a confirmation check.

2. Dangerous Name Heuristic

If the target PID cannot be resolved and the action name contains any of the following strings, the request is rejected with 400: delete · destroy · purge · wipe · reset · clear_all · terminate · shutdown · kill

3. Expression Size Limit

verify_expression must not exceed 2048 bytes. This limit is configurable in the daemon configuration.

Examples

Error Responses