Home / Home / Tutorials / Integrate sipi.bot with LangChain

Integrate sipi.bot with LangChain

LangChain agents call tools; tools spend money. Adding the guard is a few lines — here's the exact walkthrough.

Step 1 — Get a key

Create an agent key from the dashboard (or use the evaluate endpoint anonymously on self-host).

Step 2 — Add the guard tool

Register sipi.bot as a tool the agent can call before any purchase.

Step 3 — Call it before spending

In the tool that spends, call the guard with amount, merchant, and category. Branch on APPROVED / BLOCKED / FLAGGED.

Step 4 — Start with three rules

A per-transaction cap, a merchant allowlist, and a velocity limit.

Guard call

import requests
from langchain.agents import tool

@tool
def guard_spend(amount: float, merchant: str, category: str) -> str:
    r = requests.post(
        "https://sipi.bot/v1/transactions/evaluate",
        json={"amount": amount, "merchant": merchant, "category": category},
        headers={"Authorization": "Bearer YOUR_KEY"},
    )
    return r.json()["decision"]  # APPROVED | BLOCKED | FLAGGED

Deterministic, ~5 ms, no model call.

FAQ

Does this slow the agent?

No — about 5 ms per check, only on spend actions.

Is there a LangChain wrapper?

A client wrapper takes a few lines — or just use the HTTP call above.

Related

Stop the next $12,400 night.

One API call (or MCP tool) in front of every agent transaction — APPROVED, BLOCKED, or FLAGGED, deterministic, ~5 ms, fully logged.

See plans — from $99/mo Try a live check