LangGraph ଅର୍ଥପ୍ରଦାନ ଇଣ୍ଟେଗ୍ରେସନ୍।
LangGraph package ଦରକାର ନାହିଁ। ଏକ plain node ସତ୍ୟ blockchain0x client କୁ call କରେ, payment webhook ଆସିବା ପର୍ଯ୍ୟନ୍ତ interrupt() suspend କରେ, ଏବଂ graph resume ହୁଏ - runs across durable।
LangGraph-ନିର୍ଦ୍ଦିଷ୍ଟ କୌଣସି package ନାହିଁ, ଏବଂ ଆପଣଙ୍କୁ ଦରକାର ମଧ୍ୟ ନାହିଁ। ଆପଣଙ୍କ ରେ ଥିବା ସାଧାରଣ node ସତ୍ୟ client କୁ call କରେ, ଗୋଟିଏ payment webhook ଆସିବା ପର୍ଯ୍ୟନ୍ତ graph କୁ suspend କରେ, ଏବଂ handler ଏହାକୁ LangGraph ର ନିଜ + ସହିତ resume କରେ। Payments Base ରେ settle ହୁଏ।
ଦୃଢ ନିର୍ବାହ ପେମେଣ୍ଟ୍ ପରେ ପୁନରାବୃତ୍ତି ପ୍ୟାଟର୍ନ୍କୁ ସ୍ୱାଭାବିକ କରେ।
ଏଜେଣ୍ଟ-ଚାଳିତ ପେମେଣ୍ଟର କଠିନ ଅଂଶ ହେଉଛି async gap: ଆପଣ ପେମେଣ୍ଟ ଅନୁରୋଧ କରନ୍ତି, କ୍ରେତା କିଛି ମିନିଟ୍ ପରେ (କିମ୍ବା କେବେ ନୁହେଁ) ଦେୟ କରେ, ଏବଂ ଆପଣଙ୍କୁ ଯେଉଁଠାରେ ଥିଲେ ସେହି state ହରାଇ ନଦେଇ କାମ ପୁନରାରମ୍ଭ କରିବାକୁ ପଡ଼େ। ଏହି gap କୁ bridge କରିବା ପାଇଁ ଅଧିକାଂଶ agent framework job queue + manual state-store ଉପରେ ନିର୍ଭର କରେ। LangGraph ଭିତରେ ଏହି primitive ପୂର୍ବରୁ ଅଛି: interrupt() ଏକ node ଠାରେ graph କୁ suspend କରେ ଏବଂ checkpointer state କୁ disk ରେ persist କରେ। Resume କରିବାକୁ ଗୋଟିଏ call ହିଁ ଲାଗେ।
recipeଟି କୌଣସି special machinery ବିନା ଏହାକୁ ଭଲଭାବେ ବ୍ୟବହାର କରେ। ଗୋଟିଏ plain pay node blockchain0x.payments.create କୁ call କରେ। ଗୋଟିଏ await_settlement node suspend କରିବାକୁ interrupt() call କରେ, ଏବଂ checkpointer state କୁ persist କରେ। webhook handler signature verify କରେ, graph.updateState ସହିତ matching thread ରେ settled set କରେ, ଏବଂ interrupt ଠାରୁ ଆଗକୁ ଚାଲିବାକୁ graph.invoke call କରେ। graph ପୂର୍ବ ନୋଡ୍ରୁ ଆସୁଥିବା କୌଣସି LLM context ସହିତ ସେଠାରୁ ହିଁ ପୁନରାରମ୍ଭ କରେ - ସବୁକିଛି LangGraph ର ନିଜ API ବ୍ୟବହାର କରି।
LangGraph ଏବଂ core SDK ଇନଷ୍ଟଲ୍ କରନ୍ତୁ। ଅତିରିକ୍ତ package ନାହିଁ।
Node 18+ ଏବଂ @langchain/langgraph 0.2+ ସହ real @blockchain0x/node client। କୌଣସି ଭାଷାରେ ଯୋଗ କରିବାକୁ LangGraph adapter ନାହିଁ - Python LangGraph user ମାନେ langgraph ଏବଂ blockchain0x Python client install କରନ୍ତି ଏବଂ Python ପକ୍ଷରେ interrupt() ଏବଂ Command(resume=...) ସହ ସେହି recipe ଲେଖନ୍ତି।
npm install @langchain/langgraph @blockchain0x/node
export BLOCKCHAIN0X_API_KEY=sk_test_... # sk_test_ = Base Sepolia, sk_live_ = Base mainnet export BLOCKCHAIN0X_WEBHOOK_SECRET=... # for the webhook handler
BLOCKCHAIN0X_API_KEY ହେଉଛି ଆପଣଙ୍କ dashboard ରୁ ମିଳୁଥିବା sk_test_ testnet କିମ୍ବା sk_live_ mainnet key; client ଏହାକୁ environment ରୁ ପଢ଼େ। BLOCKCHAIN0X_WEBHOOK_SECRET (webhook create କିମ୍ବା rotate କରିବାବେଳେ ଗୋଟିଏଥର ମିଳୁଥିବା) webhooks handle କରୁଥିବା process ରେ ଆବଶ୍ୟକ। ଯଦି ଆପଣଙ୍କ graph ଗୋଟିଏ process ରେ ଚାଲେ ଏବଂ handler ଅନ୍ୟ ଗୋଟିଏରେ, ଦୁହେଁକୁ ସମାନ checkpointer (ଯଥା shared Postgres) ଆବଶ୍ୟକ, ଯାହାଦ୍ୱାରା handler suspended thread କୁ ଖୋଜିପାରିବ।
ଏକ ତିନି-ନୋଡ୍ ଗ୍ରାଫ୍: ଦେୟ, ବିଶ୍ରାମ, ଡେଲିଭରୀ।
ନିମ୍ନରେ typed State, real blockchain0x.payments.create କୁ call କରୁଥିବା pay node, interrupt-based await_settlement node, ଏବଂ chain payment move ହୋଇଥିବାକୁ confirm କରିବା ପରେ dependent work ଚଳାଉଥିବା deliver node ସହିତ ଏକ ସମ୍ପୂର୍ଣ୍ଣ LangGraph workflow ଅଛି।
import { StateGraph, START, END, MemorySaver, interrupt, Annotation } from "@langchain/langgraph"; import { createClient } from "@blockchain0x/node"; const blockchain0x = createClient({ apiKey: process.env.BLOCKCHAIN0X_API_KEY! }); const State = Annotation.Root({ agentId: Annotation<string>(), to: Annotation<string>(), amountWei: Annotation<string>(), // USDC base units: "10000" = 0.01 USDC settled: Annotation<boolean>(), }); // A plain node that calls the real SDK. No dedicated package needed. async function pay(state: typeof State.State) { await blockchain0x.payments.create({ agentId: state.agentId, to: state.to, amountWei: state.amountWei, }); return {}; } // Suspend the graph until the payment.sent webhook resumes this thread. function awaitSettlement() { interrupt("awaiting on-chain settlement"); return {}; } async function deliver() { // Funds have moved - do the work that depended on the payment. return {}; } const graph = new StateGraph(State) .addNode("pay", pay) .addNode("await_settlement", awaitSettlement) .addNode("deliver", deliver) .addEdge(START, "pay") .addEdge("pay", "await_settlement") .addConditionalEdges("await_settlement", (s) => (s.settled ? "deliver" : END)) .addEdge("deliver", END) .compile({ checkpointer: new MemorySaver() });
When the graph runs, the pay node submits the USDC transfer through the SDK. The await_settlement node calls interrupt(), which suspends the graph and persists state via the checkpointer. The conditional edge waits to be told settled=true before routing to deliver; if settlement never lands, a timeout sweep routes it to END. amountWei is base units, so 0.01 USDC is "10000".
ଓେଭୁକ୍ ପରୀକ୍ଷା କରନ୍ତୁ, ପରେ ଥ୍ରେଡ୍ ପୁନରାମ୍ବ କରନ୍ତୁ।
handler Node SDK ର webhooks.verify ସହିତ signature verify କରେ, ଆପଣଙ୍କ own mapping ରୁ suspended LangGraph thread କୁ lookup କରେ, graph.updateState ସହ settled set କରେ, ଏବଂ interrupt ଠାରୁ ଜାରି ରଖିବା ପାଇଁ graph.invoke(null, config) କୁ call କରେ। କୌଣସି special helper ନୁହେଁ - ସେଗୁଡ଼ିକ LangGraph ର ନିଜ API।
import express from "express"; import { webhooks } from "@blockchain0x/node"; import { graph } from "./graph"; const app = express(); // Capture the RAW body. The HMAC is over the exact bytes on the wire. app.use(express.raw({ type: "application/json" })); app.post("/webhooks/payment", async (req, res) => { const result = webhooks.verify({ headers: req.headers, rawBody: req.body, // Buffer, raw bytes secret: process.env.BLOCKCHAIN0X_WEBHOOK_SECRET!, }); if (!result.ok) return res.status(400).json({ code: result.code }); if (result.eventType === "payment.sent") { // You map the event to the suspended graph thread (your own store). const config = { configurable: { thread_id: threadFor(result.eventId) } }; await graph.updateState(config, { settled: true }); await graph.invoke(null, config); // resume from the interrupt } res.status(200).send("ok"); });
webhooks.verify raw body ଉପରେ constant time ରେ HMAC-SHA256 କରେ ଏବଂ ଏକ discriminated union ଫେରାଇଦିଏ - result.ok ଉପରେ branch କରନ୍ତୁ, try/catch ନାହିଁ। result.eventId କୁ ଆପଣ ସସ୍ପେଣ୍ଡ କରିଥିବା thread ସହିତ map କରନ୍ତୁ, ପରେ graph.updateState + graph.invoke(null, config) persisted checkpoint ରୁ ପୁନଃଆରମ୍ଭ କରେ ଏବଂ graph runs deliver କରେ। Shipped events ହେଉଛି payment.received, payment.sent, wallet.deployed, ଏବଂ webhook.test.
ଆପଣ wrap କରୁଥିବା client open ଅଟେ। ଏହାକୁ ପଢ଼ନ୍ତୁ।
Clone କରିବା ପାଇଁ LangGraph starter package ନାହିଁ - ଉପରେ ଥିବା recipe ହିଁ integration। blockchain0x SDKs GitHub ଉପରେ open source ଅଟେ; ଏହି recipe Python SDK (blockchain0x-python) କୁ wrap କରେ, ଏବଂ docs ରେ full method surface ଅଛି। node bodies ଏବଂ webhook verify ପାଇଁ reference ଭାବେ ଏହାକୁ ପଢନ୍ତୁ।
github.com/tosh-labs/blockchain0x-pythonFull SDK method surface ଏବଂ webhook signature scheme the docs ରେ documented ଅଛି। Base Sepolia ବିରୁଦ୍ଧରେ sk_test_ key ରୁ ଆରମ୍ଭ କରନ୍ତୁ, ପରେ graph ଆପଣ ଆଶା କରୁଥିବା ଭଳି resume ହେଲେ sk_live_ କୁ switch କରନ୍ତୁ।
ଲ୍ୟାଙ୍ଗ୍ଗ୍ରାଫ୍-ନିର୍ଦ୍ଦିଷ୍ଟ ଜାଲକୁ ଏଡାଇବାକୁ ପାଞ୍ଚ ଜାଲ।
LangGraphର ଦୃଢ-କାର୍ଯ୍ୟ ମଡେଲ୍ ଶକ୍ତିଶାଳୀ କିନ୍ତୁ ଚେକ୍ପଏଣ୍ଟ, ଅବରୋଧ, ଏବଂ ରାଜ୍ୟ ଅଦ୍ୟତନ ସହିତ ଏହାର ନିଜସ୍ୱ ଚାଲାକୀ ଅଛି।
LangGraph package ନାହିଁ - ଏକ ସାଧାରଣ node SDK କୁ call କରେ
Blockchain0x LangChain ଏବଂ CrewAI ପାଇଁ adapters ସହିତ MCP server ମଧ୍ୟ ship କରେ; npm କିମ୍ବା pip ରେ LangGraph ପାଇଁ dedicated package ନାହିଁ। ଉପରେ ଥିବା recipe ହିଁ path: ଏକ ସାଧାରଣ graph node real @blockchain0x/node client କୁ call କରେ, ଏବଂ ଆପଣ LangGraph ର ନିଜ graph.updateState + graph.invoke ସହିତ resume କରନ୍ତୁ। କୌଣସି special payment-node class ନାହିଁ ଏବଂ import କରିବାକୁ କୌଣସି resume helper ମଧ୍ୟ ନାହିଁ - ସେଗୁଡିକ କେବେ ଥିଲା ନାହିଁ।
ଚେକ୍ପଏଣ୍ଟର୍ ଅଭାବ
LangGraph ର interrupt() କେବଳ ତେବେ କାମ କରେ ଯେତେବେଳେ graph ରେ checkpointer ଥାଏ। ଏହା ବିନା, process exit ହେବାବେଳେ state ହାରାଇଯାଏ ଏବଂ webhook handler ପାଖରେ resume କରିବାକୁ କୌଣସି thread ରହେ ନାହିଁ। development ପାଇଁ MemorySaver ଏବଂ production ପାଇଁ SqliteSaver କିମ୍ବା PostgresSaver ବ୍ୟବହାର କରନ୍ତୁ। ଯଦି ଆପଣଙ୍କ graph ଏବଂ webhook handler ଭିନ୍ନ process ରେ ଚାଲେ, ସେମାନେ ଏକେ checkpointer (ଉଦାହରଣସ୍ୱରୂପ ଏକ Postgres) share କରିବା ଦରକାର, ଯାହାଦ୍ୱାରା handler suspended thread କୁ ଖୋଜି ପାରିବ।
Webhook କୁ ସଠିକ୍ thread ସହ map କରିବା ଆପଣଙ୍କ କାମ
webhook ଆପଣଙ୍କୁ payment settled ହେବାକୁ କହେ; ଏହା ଆପଣଙ୍କ LangGraph thread_id ଜାଣେ ନାହିଁ। ନିଜର mapping ରଖନ୍ତୁ - graph ଆରମ୍ଭ କରିବାବେଳେ agent, recipient, କିମ୍ବା ଆପଣ set କରିଥିବା idempotency key ଅନୁସାରେ thread_id ସଞ୍ଚୟ କରନ୍ତୁ, ତାପରେ handler ଭିତରେ ଏହାକୁ ଖୋଜନ୍ତୁ। ଉପରେ ଥିବା threadFor() call ସେହି lookup ହିଁ। ଏହାକୁ ଭୁଲ କଲେ graph.invoke ଭୁଲ thread କୁ resume କରିବ କିମ୍ବା ସମ୍ପୂର୍ଣ୍ଣ ନୁହେଁ।
କୌଣସି ସେଟଲ୍ମେଣ୍ଟ ପଥକୁ ହ୍ୟାଣ୍ଡଲ୍ କରନ୍ତୁ, କିମ୍ବା ସଦାକାଳ ପାଇଁ ଅସ୍ଥାଗିତ କରନ୍ତୁ
await_settlement ରୁ ଆସୁଥିବା conditional edge କେବଳ settled ଯେତେବେଳେ true ଥାଏ ସେତେବେଳେ deliver କୁ route କରେ। ଯଦି payment କେବେ land ହୁଏ ନାହିଁ, thread ଅନନ୍ତକାଳ ପର୍ଯ୍ୟନ୍ତ suspended ରହିଯାଏ। ଏକ timeout ଯୋଡ଼ନ୍ତୁ: stale thread ଗୁଡ଼ିକୁ settled=false ସହିତ resume କରୁଥିବା scheduled sweep, ଯାହାଦ୍ୱାରା edge END କୁ route କରେ, କିମ୍ବା payment.sent-versus-deadline check। Suspended thread କିଛି cost କରେ ନାହିଁ, କିନ୍ତୁ ଏହା ନିଜେ ମଧ୍ୟ ସମାପ୍ତ ହୁଏ ନାହିଁ।
ରାଶିଗୁଡ଼ିକ USDC base units ରେ, string ଭାବେ
payments.create takes amountWei: a string of USDC base units (6 decimals), so 0.01 USDC is "10000" and 5 USDC is "5000000". It also does not retry by default and can answer 503 until the chain adapter is wired for your network. Handle that in the pay node - route to END or a retry node on error rather than letting the graph wedge.