tobeverified
v0.5.1
Published
Runtime verification for non-deterministic AI agent actions and outputs — TypeScript SDK
Downloads
21
Maintainers
Readme
tobeverified — TypeScript SDK
Runtime verification for non-deterministic AI agent actions and outputs.
tobeverified submits each call to an independent verification agent (LLM judge with your policy + authoritative typologies, low-confidence cases route to a human reviewer). Use it where unit tests don't reach: refund classifications, fraud screens, PII redaction, intent routing, tool-call validation.
Install
npm install tobeverified
# or
pnpm add tobeverified
# or
yarn add tobeverifiedUse
import { TBV } from "tobeverified";
const tbv = new TBV();
// reads TBV_API_KEY and TBV_BASE_URL from process.env
const result = await tbv.verify({
prompt: "Is this customer message a refund request?",
context: { message: "I'd like my money back." },
allowedVerdicts: ["yes", "no"],
confidenceThreshold: 0.85,
});
console.log(result.final_verdict, result.final_tier);
// → 'yes' 'agent' (or 'human' if confidence was below threshold)verify() is fire-and-wait: submits, polls until terminal state. For non-blocking flows use submit() + wait() separately.
Decorator pattern
import { verified } from "tobeverified";
const moderate = verified(
{
allowedVerdicts: ["safe", "unsafe", "needs_review"],
confidenceThreshold: 0.9,
source: "my-app/comment-mod",
},
async (text: string) => ({
prompt: "Is this comment safe to publish?",
context: { text },
}),
);
const result = await moderate("user-supplied content");
// result.verdict, result.tier, result.outputGet an API key
Sign in at app.tobeverified.com → API keys → create. Plaintext is shown exactly once.
export TBV_API_KEY=tbv_live_...Reviewer queue
Verifications routed to human_needed (confidence below threshold) appear at review.tobeverified.com for the account that submitted them. Anyone signed in to the account can resolve. The verification agent's first-pass verdict, confidence, and rationale are shown alongside the verdict form.
Constructor options
new TBV({
baseUrl, // override TBV_BASE_URL
apiKey, // override TBV_API_KEY
fetch, // pass a custom fetch (Cloudflare Workers, etc.)
});Runtime support
- Node 18+ (built-in
fetch) - Cloudflare Workers (pass
fetch: self.fetchif module resolution complains) - Browsers — not recommended; you'd be leaking the API key. Proxy through your server.
Status
Developer preview. Versioned 0.x until the API contract is frozen; expect minor surface changes. Production deployments tracked via docs.tobeverified.com.
