honeyprompt
v0.4.0
Published
Detect prompt-injection attempts before untrusted text reaches a tool-capable agent.
Maintainers
Readme
honeyprompt for Node.js
Inspect untrusted text for prompt-injection attempts before passing it to a tool-capable agent. The package uses inert honeypot tools: attempted calls are returned as evidence and are never executed.
Requires Node.js 22 or newer.
npm install https://github.com/hacknlove/honeyprompt/releases/download/v0.4.0/honeyprompt-0.4.0.tgzimport { inspect } from "honeyprompt";
const result = await inspect(untrustedText);
if (result.status === "clean") {
await productionAgent.run(result.input);
} else {
console.error(result.toolCalls);
}For a fail-closed boundary, guard() returns the exact original string when
clean and throws PromptInjectionDetectedError when a tool call is detected:
import { guard } from "honeyprompt";
const cleanText = await guard(untrustedText);
await productionAgent.run(cleanText);The default client reads OPENAI_API_KEY. Pass any supported option explicitly
or inject an existing OpenAI client:
import OpenAI from "openai";
import { inspect } from "honeyprompt";
const result = await inspect(untrustedText, {
client: new OpenAI(),
model: "gpt-5.6-luna",
reasoningEffort: "low",
});The library never writes to stdout or stderr. Operational failures throw
HoneypromptOperationalError; detection is represented by the typed result
from inspect() or by PromptInjectionDetectedError from guard().
