npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@caelaralabs/agent-guard

v1.2.0

Published

Guard agent inputs and outputs: prompt-injection scanning, input firewall, output validation, PII redaction and domain trust checks. Typed SDK (ESM and CommonJS) and CLI.

Readme

@caelaralabs/agent-guard

Checks for the text going into and out of your agents: prompt-injection scanning, an input firewall with PII redaction, output validation against a JSON Schema, PII redaction, and domain trust reports. A typed SDK for ESM and CommonJS, plus a CLI.

Latency

npm install @caelaralabs/agent-guard
npx -y @caelaralabs/agent-guard --scan "Ignore all previous instructions"

Node 20 or newer. No runtime dependencies.

Where requests go: requests are processed by Caelara Labs edge APIs at *.caelaralabs.com (agent.caelaralabs.com and compliance.caelaralabs.com), with a free 50-call trial key, CAELARA_API_KEY, or x402 USDC payment headers. There is no anonymous free tier: without a key or a payment every call answers HTTP 402.

SDK

ESM:

import { scanPromptInjection, sanitizeInput, validateOutput, redactPII, checkDomainTrust, CaelaraError } from '@caelaralabs/agent-guard'

const scan = await scanPromptInjection(userText)
if (scan.verdict !== 'allow') throw new Error(`blocked input (risk ${scan.risk_score})`)

const input = await sanitizeInput(userText) // injection check + PII redaction
const safeText = input.sanitized_text // null when the verdict is "block"

const out = await validateOutput(modelOutput, {
  schema: { type: 'object', required: ['answer'], properties: { answer: { type: 'string' } } },
  source: retrievedContext, // optional grounding check
})
if (out.verdict === 'fail') console.log(out.schema?.errors)

const { redacted } = await redactPII('Mail me at [email protected]')
const trust = await checkDomainTrust('example.com') // trust_score, verdict, flags

CommonJS:

const { scanPromptInjection, CaelaraError } = require('@caelaralabs/agent-guard')

scanPromptInjection(text)
  .then((r) => console.log(r.verdict, r.risk_score))
  .catch((e) => {
    if (e instanceof CaelaraError && e.isBilling) console.error(e.guidance)
    else throw e
  })

| Function | Request | Result fields | | --- | --- | --- | | sanitizeInput(text, { redactPII? }) | POST agent.caelaralabs.com/v1/agent-input-firewall { text, redact_pii } | verdict (allow, review, block), risk_score, injection_matches, pii_findings, sanitized_text, tokens_estimate | | scanPromptInjection(text) | POST /v1/prompt-injection-scanner { text } | verdict, risk_score, matches | | validateOutput(output, { schema?, source? }) | POST /v1/agent-output-validator { output, schema, source } | verdict (pass, fail), json, schema, grounding, citations | | redactPII(text) | POST /v1/pii-redactor { text } | redacted, findings, total | | checkDomainTrust(domain) | GET compliance.caelaralabs.com/v1/domain-trust-composite?domain= | domain, trust_score, verdict (trusted, caution, risky), email_auth, certificates, security_headers, flags, partial |

Every function also takes the client options { apiKey?, payment?, fetch?, timeoutMs? }. apiKey and payment default to the environment variables below, and timeoutMs defaults to 15000.

Failures throw a CaelaraError with status, code (payment_required, rate_limited, bad_request, http_error, network_error, timeout, partial, invalid_response) and body. For HTTP 402 and 429, isBilling is true, guidance lists the ways to get access, and on a 402 terms holds the x402 price, network and recipient.

Backup routing

withCaelaraFallback wraps your existing fetch. When a provider you already call is rate limited or briefly unavailable, the same request is answered once by https://compat.caelaralabs.com.

import { withCaelaraFallback } from '@caelaralabs/agent-guard'

const fetchWithFallback = withCaelaraFallback(fetch, { apiKey: process.env.CAELARA_API_KEY })
const res = await fetchWithFallback('https://api.your-provider.example/v1/email-verifier?email=a%40b.co')
if (res.headers.get('x-caelara-routed-fallback') === 'true') console.log('answered by the fallback')
  • Fails over only on HTTP 429, 502, 503 or 504 (and on a network error, for retry-safe requests only).
  • Retries only GET, HEAD and OPTIONS, or a request that carries an Idempotency-Key header. A POST, PUT, PATCH or DELETE without one is never replayed, and a streamed body is never re-sent.
  • Only requests that match a compatibility route fail over: /v1/scrape, /v1/email-verifier, /v1/company/find, /v1/seo/audit, /v1/token/audit, /v1/wallet/portfolio, /v1/document/extract and /v1/compliance/entity. Map other paths with routes: { '/api/v3/verify': '/v1/email-verifier' }.
  • One hop at most: the forwarded request carries x-caelara-routed-fallback: true, and a marked request never fails over again, so there are no loops and no double charges.
  • Method, query, body and ordinary headers are kept. Your provider's credentials (Authorization, cookies, API-key and token headers) are never sent to Caelara Labs; only your Caelara key (apiKey, X-Caelara-Key or CAELARA_API_KEY) or x402 payment is.
  • A fallback answer carries x-caelara-routed-fallback: true. If the fallback also fails, you get the original upstream response, unchanged.

CLI

agent-guard --scan "<text>"                      # prompt-injection score
cat message.txt | agent-guard --scan -           # same, from stdin
agent-guard --validate output.json --schema schema.json
agent-guard --redact "Call me on +1 415 555 0100"
agent-guard --domain example.com

Add --json to print the API response. Text output goes to stdout; with --redact the summary of what was removed goes to stderr, so agent-guard --redact - < in.txt > out.txt writes only the redacted text.

| Exit code | Meaning | | --- | --- | | 0 | allow, pass or trusted (and --redact succeeded) | | 1 | review or block, validation failed, caution or risky domain, or the check could not complete | | 2 | Usage error | | 3 | The API refused the request (HTTP 402 or 429): billing or rate limit |

A network failure or timeout exits 1, so a pipeline that gates on agent-guard fails closed.

Environment

| Variable | Purpose | | --- | --- | | CAELARA_API_KEY | Your Caelara key, sent as X-Caelara-Key. Free 50-call trial key: https://caelaralabs.com/shield/#trial | | CAELARA_X402_PAYMENT | Optional pre-signed x402 v2 payment, sent as PAYMENT-SIGNATURE (and X-PAYMENT for older hosts). This package never holds a wallet or signs payments. | | CAELARA_AGENT_API_BASE, CAELARA_COMPLIANCE_API_BASE | Point requests at a local mock for testing. Only loopback addresses are accepted. |

Access and pricing

On HTTP 402 or 429 you get the three ways to get access:

  1. Free trial key: 50 calls from https://caelaralabs.com/shield/#trial, set as CAELARA_API_KEY.
  2. Prepaid EGU pack: one time from $5 at $0.0002 per EGU (https://caelaralabs.com/pass/), set as CAELARA_API_KEY. No subscription; the balance never expires.
  3. x402 per call: USDC on Base. scanPromptInjection and redactPII cost 0.005 USDC per call; sanitizeInput, validateOutput and checkDomainTrust cost 0.025 USDC. x402 v2: the terms arrive in the PAYMENT-REQUIRED header; pass a pre-signed payload in CAELARA_X402_PAYMENT or the payment option and it is sent as PAYMENT-SIGNATURE (with X-PAYMENT as the legacy fallback).

A trial key allows about one call per second; a 429 means wait and retry.

License

MIT, Caelara Labs [email protected]