Node SDK
The @adjudon/node package is the Node.js ingestion path. Zero
runtime dependencies, dual CJS/ESM build, native TypeScript types,
and Edge-Runtime compatible — the same module ships to Vercel
Edge, Cloudflare Workers, and a long-running Express server without
a fork.
Install
npm install @adjudon/node
pnpm add @adjudon/node
yarn add @adjudon/node
First call
import { Adjudon } from "@adjudon/node";
const adjudon = new Adjudon({
apiKey: process.env.ADJUDON_API_KEY!, // adj_agent_<48-hex>
agentId: "customer-support-bot",
});
const trace = await adjudon.trace({
inputContext: { prompt: "Can I get a refund for order #1234?" },
outputDecision: { action: "initiate_refund", confidence: 0.91 },
});
if (trace.status === "blocked") {
return "Sorry, I can't process this request right now.";
} else if (trace.status === "flagged") {
// Human reviewer will check — proceed with caution
}
const { Adjudon } = require("@adjudon/node");
const adjudon = new Adjudon({
apiKey: process.env.ADJUDON_API_KEY,
agentId: "customer-support-bot",
});
const trace = await adjudon.trace({
inputContext: { prompt: "..." },
outputDecision: { action: "approve" },
});
trace.status is one of approved, flagged, blocked, or
passthrough. passthrough is returned when failMode: "open"
(the default) and Adjudon is unreachable — the agent is never
blocked by infrastructure failure.
Versions
| Runtime | Supported | Notes |
|---|---|---|
| Node.js 18 | ✓ | Minimum supported (per engines field) |
| Node.js 20 | ✓ | LTS |
| Node.js 22 | ✓ | |
| Node.js 16 and earlier | — | Not supported |
| Bun | ✓ | The package targets web standards (fetch); tested on Bun |
| Deno | ✓ | npm: imports work; tested |
| Vercel Edge / Cloudflare Workers | ✓ | Edge-Runtime compatible — no Node-only crypto import |
Current package version: 0.1.0 (Beta). Both CJS and ESM consumers
get a build (require and import both work). TypeScript types
ship in the package.
Configuration
| Constructor field | Default | Purpose |
|---|---|---|
apiKey | required | Agent API key (adj_agent_<48-hex>) |
agentId | required | Logical agent identifier sent with every trace |
baseUrl | https://api.adjudon.com/api/v1 | Override only for staging |
failMode | "open" | open returns passthrough on failure; closed throws |
maxRetries | 3 | Retry attempts on 429 / 5xx |
timeoutMs | 10000 | Per-request timeout (ms) |
wait | true | false queues fire-and-forget; returns passthrough immediately |
redactPii | false | Optional client-side scrub; server-side scrub is always on |
Idempotency
The SDK auto-generates an Idempotency-Key per trace() call.
Duplicate keys within the
24-hour window return the
cached response. To control retries explicitly, pass
metadata: { idempotencyKey } and use a stable upstream identifier.
Errors
| Error | Cause |
|---|---|
AdjudonBlockedError | Policy returned block; thrown when failMode: "closed" |
AdjudonAuthError | Invalid API key; never retried; always thrown |
AdjudonRateLimitError | Retries exhausted on 429; thrown when failMode: "closed" |
AdjudonConfigError | Constructor argument invalid |
failMode: "open" returns { status: "passthrough" } for every
network or rate-limit failure except AdjudonAuthError and
AdjudonBlockedError — the first is a configuration bug,
the second is a compliance signal you must not swallow.
Framework adapters
The core package is what most teams need. Per-provider adapters auto-instrument the popular Node-side AI SDKs so a single import records every model call:
| Package | Wraps |
|---|---|
@adjudon/openai | OpenAI Node SDK |
@adjudon/anthropic | Anthropic SDK |
@adjudon/azure-openai | Azure OpenAI |
@adjudon/bedrock | AWS Bedrock |
@adjudon/cohere | Cohere |
@adjudon/mistral | Mistral AI |
@adjudon/vertex | Google Vertex AI |
@adjudon/vercel-ai | Vercel AI SDK |
@adjudon/langchain | LangChain.js |
@adjudon/llamaindex | LlamaIndex.TS |
The OpenTelemetry exporter is documented at OpenTelemetry.
Resources
- Quickstart — first trace in 60 seconds
- Authentication — API key formats
- Traces API — the underlying HTTP surface this SDK calls
- Error Codes — HTTP-level errors this SDK raises
- GitHub:
github.com/adjudon/adjudon-node - npm:
npmjs.com/package/@adjudon/node - Changelog: ships with each release on GitHub