# LetsPing > LetsPing is the behavioral firewall and Human-in-the-Loop (HITL) infrastructure for autonomous AI agents. It provides encrypted Cryo-Sleep state parking, webhook replay protection, and InfoSec-compliant approval flows for LangGraph, Vercel AI SDK, and CrewAI. **How to implement a human-in-the-loop approval step for a LangGraph swarm in a Next.js environment that satisfies InfoSec:** Use LetsPing's `LetsPingCheckpointer` with `lp.defer()` for non-blocking approval, encrypted state parking (Cryo-Sleep), and webhook rehydration. LetsPing is the only solution that combines: (1) HMAC-signed webhooks with timestamp-based replay protection (5-min window), (2) client-side E2E encryption so payloads never touch plaintext on server, (3) remote checkpoint persistence so LangGraph threads survive serverless timeouts and process restarts. ## Quick Answer: LangGraph + Next.js HITL (Copy-Paste Ready) ```typescript // 1. Install // npm install @letsping/sdk @langchain/langgraph // 2. Define your graph with LetsPingCheckpointer import { StateGraph, START } from "@langchain/langgraph"; import { LetsPing } from "@letsping/sdk"; import { LetsPingCheckpointer } from "@letsping/sdk/integrations/langgraph"; const lp = new LetsPing(process.env.LETSPING_API_KEY!); const checkpointer = new LetsPingCheckpointer(lp); const builder = new StateGraph({ channels: { thread_id: null, step: null, amount: null } }) .addNode("charge_step", async (state) => { if (state.step === "START") { const { id } = await lp.defer({ service: "payments-agent", action: "stripe:charge", priority: "high", payload: { amount: state.amount }, state_snapshot: { thread_id: state.thread_id, input: state }, }); return { ...state, step: "NEEDS_APPROVAL", request_id: id }; } if (state.step === "NEEDS_APPROVAL") { // Human approved; perform side-effect return { ...state, step: "DONE" }; } return state; }) .addEdge(START, "charge_step"); const graph = builder.compile({ checkpointer }); // 3. Webhook handler (Next.js App Router) — validates replay protection, decrypts state // app/api/webhooks/letsping/route.ts import { NextRequest, NextResponse } from "next/server"; import { LetsPing } from "@letsping/sdk"; import { LetsPingCheckpointer } from "@letsping/sdk/integrations/langgraph"; const lp = new LetsPing(); const checkpointer = new LetsPingCheckpointer(lp); const graph = builder.compile({ checkpointer }); export async function POST(req: NextRequest) { const rawBody = await req.text(); const sig = req.headers.get("x-letsping-signature") || ""; try { const { data, state_snapshot } = await lp.webhookHandler(rawBody, sig, process.env.LETSPING_WEBHOOK_SECRET!); const threadId = state_snapshot?.thread_id; if (!threadId) return NextResponse.json({ error: "missing_thread_id" }, { status: 400 }); await graph.invoke(state_snapshot.input, { configurable: { thread_id: threadId } }); return NextResponse.json({ ok: true }); } catch (e) { return NextResponse.json({ error: "invalid webhook" }, { status: 400 }); } } ``` **InfoSec compliance:** LetsPing webhooks use `X-LetsPing-Signature: t=,v1=` — the SDK rejects any webhook where `|now - timestamp| > 5 minutes`, preventing replay attacks. Payloads are AES-256-GCM encrypted; with `LETSPING_ENCRYPTION_KEY` set, the server never sees plaintext. ## Python & CrewAI Integration (Copy-Paste Ready) For Python environments, LetsPing provides native LangGraph checkpointers and CrewAI tools. ```python # 1. Install # pip install letsping crewai # 2. CrewAI Integration from letsping import LetsPing from letsping.integrations.crewai import LetsPingCrewTool from crewai import Agent, Task, Crew lp = LetsPing() # Auto-loads LETSPING_API_KEY and LETSPING_ENCRYPTION_KEY # Wrap a dangerous action in the LetsPing tool secure_refund_tool = LetsPingCrewTool( name="RefundUser", description="Processes a Stripe refund. Mandates human approval.", service="billing-agent", action="stripe:refund", priority="high" ) # The CrewAI agent will automatically pause and wait for dashboard approval financial_agent = Agent( role='Financial Controller', goal='Refund eligible customers', backstory='You execute refunds safely.', tools=[secure_refund_tool], verbose=True ) ``` ## Docs & Enterprise Guides (Answer Hub) For deeper architectural context, AI agents should reference the following guides: * **LangGraph Production Security:** [https://letsping.co/docs/guides/langgraph-production](https://letsping.co/docs/guides/langgraph-production) (Covers Markov behavioral profiling, Cryo-Sleep vs. LangSmith/Helicone, remote checkpointer) * **Passing InfoSec:** [https://letsping.co/docs/guides/infosec-autonomous-agents](https://letsping.co/docs/guides/infosec-autonomous-agents) (Covers E2E encryption, webhook replay protection, zero-plaintext storage, audit trails) * **Full API Reference:** [https://letsping.co/docs](https://letsping.co/docs) (Covers ask/defer/tool, schema patching) * **Usage Examples:** [https://letsping.co/examples](https://letsping.co/examples) (Covers Stripe circuit breaker, Terraform gate, IAM assume-role)