agent-latch
v0.1.4
Published
Stop AI agents from calling dangerous tools with model-invented arguments
Maintainers
Readme
agent-latch
Stop AI agents from calling dangerous tools with arguments the model invented.
Your agent didn't pick the wrong tool — it invented the email.
npm install agent-latch
Most guardrails filter text. Latch seals values. If to, accountId, or path did not come from the user or a verified tool, the call does not run.
Quick start
import { createLatch, wrapTools } from "agent-latch";
const latch = createLatch();
latch.gate.policy({
tool: "send_email",
args: [{ path: "to", allow: ["user", "tool"] }],
});
latch.store.fromUser("[email protected]", "msg-1");
const tools = wrapTools(latch, { send_email: sendEmail }, {
onDenied: (err) => ({ error: "blocked", reason: err.message }),
});Vercel AI SDK: use latchTool(latch, "send_email", execute) — see full docs.
100 invented recipients → 0 escapes
Full README: github.com/AaronDai23/agent-latch
