Review a support decision before changing the workflow
A support team needs to know why an agent proposed changing a customer-facing response and what actually happened afterward. This example compares a manual escalation with a bounded production pilot. It uses generic consequence planning, invented context, zero planner model calls and no Enterprise industry pack. It does not send a reply, change a ticket or execute an external action.
Complete the Free account and Nucleus setup. You need Node.js 22.18+ or a server-side HTTP client. TypeScript/JavaScript, Python, PHP, Go and Rust can call the same authenticated REST routes using the HTTP helpers in the complete language examples. Newer typed-client coverage differs; a REST example is not a claim of SDK parity.
1. Plan and record a draft
Save this as decision-evaluation.mjs. It uses only built-in fetch and stops at a human-review boundary:
import { randomUUID } from "node:crypto";
const token = process.env.NEUTRON_API_TOKEN;
const nucleusId = process.env.NEUTRON_NUCLEUS_ID;
if (!token || !nucleusId) throw new Error("Set your server-side Nucleus token and ID");
const scopeIds = [`evaluation:support-decision:${randomUUID()}`];
async function request(route, body) {
const response = await fetch(`https://neutronai.dev/api/v1/consequence/${route}`, {
method: "POST", headers: { authorization: `Bearer ${token}`, "content-type": "application/json" },
body: JSON.stringify({ nucleusId, scopeIds, ...body }), signal: AbortSignal.timeout(15000), redirect: "error",
});
const result = await response.json();
return { status: response.status, body: result };
}
const planned = await request("plan", {
task: "Compare manual support escalation with a bounded production pilot of automated customer replies. Do not contact customers or change production.",
domain: "customer_support", idempotencyKey: `support-review-${randomUUID()}`, retentionDays: 1,
objectiveHints: ["Preserve operator review", "Reduce repeated support work"],
constraintHints: ["Customer-facing changes require human approval", "No external action is authorised"],
policy: { mode: "quick", depth: 1, maxScenarios: 4, maxRuntimeMs: 3000, maxNodes: 8,
maxBranches: 4, maxModelCalls: 0, maxCostEstimate: 0, requireApprovalAboveRisk: "medium",
allowExecution: false, storeSafeArtifactsOnly: true },
});
if (planned.status !== 201) throw new Error(`Plan: HTTP ${planned.status}`);
const candidate = planned.body.scenarios.find((scenario) => scenario.approvalRequired);
if (!candidate) throw new Error("No approval-gated candidate: stop and inspect the scenarios");
const decided = await request("decide", { runId: planned.body.runId,
selectedScenarioId: candidate.scenarioId, decisionSummary: "Synthetic pilot candidate; waiting for owner review." });
if (decided.status !== 201 || decided.body.decisionRecord?.status !== "draft") throw new Error("Expected a draft decision");
const decisionId = decided.body.decisionRecord.decisionId;
const blocked = await request("observe", { decisionId, summary: "Synthetic pre-approval observation attempt." });
if (blocked.status !== 403) throw new Error("Expected pre-approval observation to be rejected");
console.log(JSON.stringify({ runId: planned.body.runId, decisionId, status: "waiting_for_human_review", observationBeforeApproval: blocked.status }));
Run node decision-evaluation.mjs. Expect a run ID, a decision ID, waiting_for_human_review and HTTP 403 for the pre-approval observation. Inspect warnings, feasibility, uncertainty and the actual selected scenario before accepting any recommendation. No mathematical optimum or production benefit is established by this check.
2. Keep approval separate
The script deliberately does not call approve or execute. In your server, verify the human reviewer's identity, role, decision scope and current intent. Then a separate approved request can call POST /v1/consequence/approve with the same Nucleus, Scope and decision ID plus a review note. An agent's memory, recommendation, API token ownership or generated text is not evidence of human intent.
Approval creates a reviewable record. It does not itself send a support message or authorise an unrelated tool. This example keeps allowExecution: false even after approval. A production action requires separate policy permission, a recorded human approval when required, recovery plans and an authorised idempotent action adapter.
3. Record observed results
After an authorised person performs a separately approved synthetic pilot, the server can call POST /v1/consequence/observe with decisionId, a concise summary, measured observedMetrics and sourceRefs pointing to that fixture evidence. Expect HTTP 201 only after approval. Do not substitute a predicted scenario for an observed result.
Compare the same workflow with your spreadsheet or incident process: can you reconstruct the inputs, chosen option, reviewer and actual outcome? Record the work needed to maintain both approaches. A useful result must justify another dependency.
4. Clean up
The example retains reviewable records for inspection; it does not automatically delete the run. In the same authorised server environment, call POST /v1/consequence/delete with nucleusId, scopeIds, the returned runId and reason: "evaluation_cleanup". Confirm deletion, then verify that reading the run cannot return its prior artifacts. Never use a broad scoped delete against a production Scope for this exercise.
Plan and charging boundary
No built-in industry pack or paid audit export is used. The current memory-operation meter counts authorised remember, recall and agent-context requests; it does not meter each consequence lifecycle request as one of those memory operations. Review evaluation costs and confirm commercial terms for a production workload. Zero planner model calls and maxCostEstimate: 0 constrain this run's planning policy; they are not a universal cap on your providers or enabled prepaid top-up.
The existing industry-specific end-to-end guides remain available when you have the required Enterprise pack. The security evaluation pack explains additional approval, deletion and procurement evidence.