Graph state
planner output
Use Stacksona Gate at conditional edges, tool nodes, or interrupt points so a graph can pause, collect a reviewer decision, and resume with an audit trail.
Governance object: graph state + pending node transition.
planner output
edge/node review
approve or reject
stored in state
approved branch
sensitive node
The useful integration point is the last safe moment before an external action, privileged read, or customer-visible response occurs.
Use these steps as the first implementation pass. Start with one high-risk action, verify the reviewer workflow, then expand coverage.
For Node.js or TypeScript guard services, start with the live SDK. For Python runtimes, call the same guard through your backend or a small HTTP wrapper.
npm i @stacksona/sdk
View SDK on npm
Keep the payload compact enough for a reviewer to decide quickly, but specific enough to explain exactly what the agent wants to do.
| Field | What to include |
|---|---|
| agent | Stable name for the agent, crew, graph, or workflow that is asking for approval. |
| action | Human-readable verb such as send_email, issue_refund, or execute_tool. |
| risk | Use low, medium, or high so reviewers can triage quickly. |
| subject | The customer, ticket, repository, account, or data source affected by the action. |
| context | Small, reviewable facts: proposed arguments, policy signals, retrieved sources, role, task id, and links. |
def route_after_planning(state):
action = state["proposed_action"]
decision = gate_request({
"agent": "refund-resolution-graph",
"action": action["name"],
"risk": action.get("risk", "medium"),
"subject": state["ticket_id"],
"context": {
"thread_id": state["thread_id"],
"current_node": "plan_action",
"next_node": action["target_node"],
"arguments": action["args"],
},
})
state["stacksona_decision_id"] = decision["id"]
if decision["status"] == "approved":
return action["target_node"]
return "wait_for_human_review"
Treat this as the shape of the guard. Replace gate_request, stacksona.gate.request, or run_tool with the SDK/API calls used in your runtime.
Conditional edges, tool nodes, and any node that mutates external systems.
Store the decision id in graph state, then resume from the review branch or approved edge.
Do not gate every LLM thought; gate the concrete action boundary.