Loading…
Drop a gate node between plan and execute so the graph's conditional edge branches on the verdict instead of a guess.
For: JS / Node agent builders running multi-step LangGraph workflows
Escalates a planned step whose blast radius exceeds the encoded ceiling.
Blocks a step that falls outside the agent's declared scope.
Escalates when the plan itself flags that a human approval is required.
# LangGraph Plan → Execute Gate
# Fork: place decionisGateNode between plan and execute; the conditional edge
# branches on state.decionis.outcome (allowed / blocked / errored).
apiVersion: decionis.dev/v1
kind: PolicyPack
metadata:
name: langgraph-plan-execute-gate
surface: langchain
workflow_key: agent_plan_execution
standards: [SOC2-CC7.2, ISO27001-A.8.9]
defaults:
mode: shadow
emit_dossier: true
rules:
- name: step_blast_radius_gate
when: "node == 'execute'"
decision: |
ALLOW IF step.risk_score < 60
ESCALATE IF step.risk_score < 85
BLOCK OTHERWISE
reason_code: step_risk_over_threshold
- name: out_of_scope_step_block
when: "node == 'execute'"
decision: |
BLOCK IF outside_scope == true
ALLOW OTHERWISE
reason_code: step_outside_agent_scope
- name: human_in_the_loop_hold
when: "node == 'execute'"
decision: |
ESCALATE IF requires_human == true
ALLOW OTHERWISE
reason_code: plan_requires_human_approval
Fork it, change the thresholds to match your environment, and deploy in shadow mode first — it defaults to listen-only so nothing in your live pipeline changes.
Same wrap-and-forget pattern as the Python version, for Node-land agents.
// npm i @decionis/langchain @decionis/sdk-node
import { createDecionisNodeSdk } from "@decionis/sdk-node";
import { DecionisGateTool } from "@decionis/langchain";
const client = createDecionisNodeSdk({
baseUrl: "https://api.decionis.com",
apiKey: process.env.DECIONIS_API_KEY!,
});
const gatedRefund = DecionisGateTool.wrap({
innerTool: sendRefund,
client,
orgId: process.env.DECIONIS_ORG_ID!,
decisionType: "refund_execution",
shadowMode: true, // ← every verdict recorded; inner tool always runs
siteBaseUrl: "https://decionis.com",
});
await agent.bindTools([gatedRefund]);