Once.
LANGCHAIN / LANGGRAPH / SAFE TOOL EXECUTION

Make consequential LangChain and LangGraph agent tools safe to retry.

Agent tools can trigger refunds, payments, bookings and other external writes. If the action succeeds but its response is lost, blindly invoking the tool again can repeat the real-world side effect.

Short answer: Give the logical operation a stable identity and route supported consequential execution through durable state and provider reconciliation instead of treating every tool invocation as a new action.

The retry failure

  1. A LangChain or LangGraph agent invokes a consequential tool.
  2. The external provider performs the action.
  3. The response is lost, times out or becomes ambiguous.
  4. The workflow cannot prove whether the action happened.
  5. The tool is invoked again.
  6. A blind retry can duplicate the side effect.

The Once pattern

const operationId = Once.id("refund", orderId);

await once.execute({
  operationId,
  provider,
  action: {
    type: "refund",
    order_id: orderId
  }
});

The same logical refund receives the same operation ID on every retry. Another agent-tool invocation is therefore not automatically treated as permission to perform a new external action.

LangChain / LangGraph example

The Once repository includes a working JavaScript example using the LangChain tool pattern with @once-agent/sdk. The same execution-safety boundary can be used for consequential tools orchestrated through LangGraph workflows.

View the Once + LangChain / LangGraph example on GitHub

Claim boundary: Once does not claim universal exactly-once execution. Safety depends on stable operation identity, durable Once state, the provider integration and sufficiently authoritative provider truth. When the outcome cannot be established safely, Once can preserve uncertainty instead of blindly repeating the action.

Add execution safety to agent tools

npm install @once-agent/sdk

Try the Once tester · SDK package · LangChain / LangGraph example