@pendral/bellwether
v0.1.0
Published
Official TypeScript SDK, CLI and healthcare data toolkit for Bellwether: members, cohorts, measures and gaps, care management, claims, FHIR, HL7, X12, de-identification, knowledge graphs, embeddings, vector stores and signed webhooks.
Readme
Bellwether TypeScript SDK
The official TypeScript SDK, CLI and healthcare data toolkit for Bellwether, the population health platform for health plans. Read Member 360, build cohorts, run quality measures and close gaps, manage care, propose outreach, run reports, ingest claims and clinical data, export in bulk and receive signed webhooks, with every request and response fully typed. The toolkit runs inside your own environment and turns FHIR, HL7 v2, X12 and CSV into one canonical model you can de-identify, graph, embed, index and analyze without sending PHI anywhere.
- The whole platform. Members and every Member 360 view, claims, cohorts, measures, gaps, reference codes, care programs, plans, goals, tasks and teams, outreach, agents, analyses, reports, population analytics, providers, prior authorizations, ingest, HL7 ADT, FHIR R4, bulk export, events, webhooks, audit and AI usage.
- PHI safe by default. De-identified unless your credential is on the PHI tier. Nothing logs headers or bodies, error messages never quote member data, and the toolkit refuses to send identified text to a model or vector store unless you acknowledge a BAA in code.
- A data toolkit for your environment. FHIR R4 (bundles, Bulk Data, SMART backend auth), HL7 v2 (ADT, ORU, MLLP), X12 837, 835 and 834, CSV, code validation, Safe Harbor de-identification, a knowledge graph, embeddings, vector stores and local analytics with small-cell suppression.
- Safe retries. Every write carries an idempotency key the API honours, so a retried request never creates a second care task.
- LLM ready. Tool definitions for the Anthropic, OpenAI and AI SDK formats and an MCP server, de-identified unless you say otherwise.
- Zero dependencies. Every adapter takes your own client or
fetch. No supply-chain surface in a PHI pipeline. - Runs anywhere. Node.js 20+, Bun, Deno, Vercel and Cloudflare Workers. ESM and CommonJS.
Installation
npm install @pendral/bellwetherGetting started
An administrator issues a service credential under Configuration → Agents → Issue credential. It acts in one
organization, on one data tier, with the scopes you pick. Set it as BELLWETHER_API_KEY and your plan's address as
BELLWETHER_BASE_URL (each plan runs its own deployment, so there is no default).
import Bellwether from "@pendral/bellwether";
const bw = new Bellwether(); // reads BELLWETHER_API_KEY and BELLWETHER_BASE_URL
const me = await bw.identity.get();
console.log(me.agent.dataTier, me.agent.effectiveScopes);
for await (const member of bw.members.list({ limit: 200 })) {
console.log(member.memberRef);
}identity.get() tells you your tier, your scopes and which operations you can call, so an integration can check
itself at startup.
Data tiers and PHI safety
Every credential is on one of two tiers, set when it is issued:
| | De-identified (default) | PHI (BAA attested) |
| --- | --- | --- |
| Member reference | Pseudonym M-XXXXXXXX | Member id |
| Dates | Year only, ages 90 and over as "90+" | Full dates |
| Geography | State | Full address, with phi:view |
| Names, contact data, ids, free text | Removed, named in withheld | As a person with the same permissions sees them |
Every member-linked record carries memberRef, and every input that names a member takes either form for your tier.
Pseudonyms come from de-identified work, for example an analysis a de-identified integration published. A PHI-tier
integration with the phi:view scope can resolve them to members through the audited reidentify call. It takes
pseudonyms only: on the PHI tier, memberRef is already the member id.
const analysis = (await bw.analyses.list({ limit: 1 })).data[0];
if (analysis) {
const resolved = await bw.members.reidentify(analysis.memberTokens); // PHI tier and phi:view, audited
for (const [pseudonym, member] of Object.entries(resolved)) console.log(pseudonym, member?.memberId ?? "not found");
}The SDK itself never logs bodies or headers. The optional logger receives the method, path template, status,
duration and request id only. Keys are kept out of JSON.stringify and console.log.
Member 360
const member = await bw.members.get(memberRef);
const [claims, labs, meds, conditions, risk, gaps, plans] = await Promise.all([
bw.members.claims.list(memberRef, { limit: 50 }),
bw.members.labs.list(memberRef),
bw.members.medications.list(memberRef),
bw.members.conditions.list(memberRef),
bw.members.risk.get(memberRef),
bw.members.gaps.list(memberRef),
bw.members.carePlans.list(memberRef),
]);
for await (const event of bw.members.timeline(memberRef)) {
console.log(event.type, event.date, event.label);
}
await bw.members.notes.create(memberRef, { body: "Called about the HbA1c result.", category: "outreach" });
await bw.members.setDoNotContact(memberRef, { doNotContact: true, reason: "Asked not to be called." });Vitals, encounters, coverage and the care team are under bw.members too. Plan-wide claims are at
bw.claims.list({ memberRef, dateFrom, dateTo }) and bw.claims.get(id), with lines and diagnoses.
Cohorts, measures and gaps
const cohort = await bw.cohorts.create({
name: "Diabetes, 18 to 75",
rules: {
version: 1,
groups: [{ conditions: [{ field: "diagnosis", codes: ["E10", "E11"], lookbackMonths: 24 }, { field: "age", min: 18, max: 75 }] }],
},
});
// Recounts and measure runs are queued (HTTP 202): wait for them before reading results.
const run = await bw.cohorts.runs.wait(cohort.id, await bw.cohorts.refresh(cohort.id));
if (run.status === "success") {
for await (const m of bw.cohorts.members.list(cohort.id)) console.log(m);
}
const measureRun = await bw.measures.runs.wait(measureId, await bw.measures.run(measureId));
const results = await bw.measures.results.list(measureId, { limit: 100 });
for await (const gap of bw.gaps.list({ measureId, status: "open" })) {
console.log(gap.memberRef, gap.rate.name);
}Conditions inside a group are ANDed and groups are ORed. Code search and value sets are at
bw.reference.codes.search({ q: "E11" }) and bw.reference.valueSets.get(id).
Care management
const programs = await bw.carePrograms.list();
const plan = await bw.carePrograms.enroll(programs.data[0]!.id, { member: memberRef, note: "Referred by the gap report." });
await bw.carePlans.goals.create(plan.id, { title: "HbA1c under 8 by March", targetDate: "2027-03-31" });
const task = await bw.careTasks.create({ member: memberRef, title: "Schedule a diabetic eye exam", priority: "high", dueInDays: 7 });
await bw.careTasks.complete(task.id, { note: "Booked for next Tuesday." });
const workload = await bw.careTeams.workload();Assignment follows the plan's licensure rules. When nobody licensed is available the work stays unassigned and the response says so.
Outreach and agents
Agents propose; people approve. The API can draft outreach and start agent runs, but there is no approve or reject call anywhere in the SDK. Proposals wait for a person in the Bellwether app.
const proposal = await bw.comms.proposals.create({
member: memberRef,
channel: "sms",
message: "Hi, this is your health plan. Your annual eye exam is due. Reply YES to book.",
rationale: "Open diabetic eye exam gap; the member prefers text.",
});
const started = await bw.agents.trigger("gap-outreach", { input: { measureId } });
const runDetail = await bw.agents.runs.get(started.id);
for await (const decision of bw.agents.decisions.list({ limit: 50 })) console.log(decision.status);Analytics and reports
const reportRun = await bw.reports.run({
plan: { version: 2, title: "Members by county", entity: "members", metric: "count", groupBy: ["county"] },
});
const done = await bw.reports.runs.wait(reportRun);
const table = await bw.reports.runs.results(done.id);
const csv = await bw.reports.runs.csv(done.id);
const costs = await bw.population.costs({ months: 12 });
const utilization = await bw.population.utilization();
const providers = await bw.providers.list({ attributed: true, limit: 10 });
const scorecard = await bw.providers.scorecard(providers.data[0]!.id);Small cells are suppressed on the server with your plan's threshold; a suppressed cell never carries a number.
Ingest: records, files, HL7 and FHIR
const pushed = await bw.ingest.records.push({
source: "CLINIC_FEED",
records: [
{ type: "member", sourceId: "p-100", memberNumber: "A100", firstName: "Jane", lastName: "Doe", dob: "1970-04-02" },
{ type: "labResult", sourceId: "lab-1", memberSourceId: "p-100", resultDate: "2026-03-06", code: "4548-4", valueNum: 7.1, unit: "%" },
],
});
console.log(pushed.summary); // { received, created, updated, unchanged, rejected }
const upload = await bw.ingest.uploads.create({ kind: "fhir", files: new File([JSON.stringify(fhirBundle)], "bundle.json") });
await bw.adt.send(hl7Message); // HL7 v2 ADT to /api/adt
const patients = await bw.fhir.search("Patient", { identifier: "A100" });Pushing the same sourceId again updates the record; a sourceModifiedAt older than the stored one is skipped as
unchanged. Rejected records come back with field paths and codes, never the value you sent. Pipeline runs are at
bw.ingest.runs.trigger({ connectionId }) and bw.ingest.runs.wait(...).
Bulk export
const stream = bw.exports.stream("claims", { updatedSince: "2026-01-01T00:00:00Z" });
for await (const claim of stream) await save(claim);
console.log("resume from", stream.cursor); // null once the export is complete
const page = await bw.exports.list("members", { limit: 1000 });stream reads NDJSON one record at a time and follows cursors to the end, so millions of rows never sit in memory.
On the de-identified tier, record ids become stable R- references that still join across exports.
Events and webhooks
Poll the event feed, with resume:
for await (const event of bw.events.iterate({ types: ["adt.discharged", "gap.opened"] })) {
if (event.type === "adt.discharged") console.log(event.data.memberRef, event.data.dischargeDate);
}Or have Bellwether push to you. Create an endpoint once and keep its secret:
const endpoint = await bw.webhookEndpoints.create({
name: "Transitions of care",
url: "https://hooks.example.com/bellwether",
events: ["adt.discharged", "care_task.completed"],
});
// endpoint.secret is shown once. Store it as BELLWETHER_WEBHOOK_SECRET.
await bw.webhookEndpoints.test(endpoint.id);Verify every delivery. The handler works with Next.js route handlers, Hono, Bun, Deno and Workers:
import { createWebhookHandler } from "@pendral/bellwether/webhooks";
export const POST = createWebhookHandler({
secret: process.env.BELLWETHER_WEBHOOK_SECRET!,
on: {
"adt.discharged": async (event) => {
console.log("follow up with", event.data.memberRef);
},
},
});Payloads are thin: ids, codes and the member reference for your endpoint's tier, never names or free text. Fetch
details through the API with your own authorization. Unsigned or stale deliveries answer 400; a handler that throws
answers 500 so the delivery is retried, with backoff for up to three days. While rotating, pass both secrets:
secret: [newSecret, oldSecret].
The data toolkit
Each module is its own subpath, has no dependencies and runs without a Bellwether account.
Pipelines
import { fromBellwetherExport, fromCsv, pipeline, toBundle } from "@pendral/bellwether/data";
import { createDeidentifier } from "@pendral/bellwether/deid";
const deid = createDeidentifier({ secret: process.env.DEID_SECRET!, method: "safe-harbor" });
const sink = toBundle();
const report = await pipeline(fromBellwetherExport(bw, { datasets: ["members", "claims", "labs"] }))
.deidentify(deid)
.validate({ onInvalid: "quarantine" })
.to(sink)
.run();
console.log(report.read, report.written, report.quarantinedCount);
const fromFile = pipeline(
fromCsv(csvText, { resourceType: "Patient", mapping: { id: "member_id", birthDate: "dob", sex: "gender" } })
);Sinks write to arrays, bundles, NDJSON, callbacks or SQL (toSql with your own driver for Postgres, SQL Server,
Snowflake, BigQuery, DuckDB or SQLite). Node file helpers are at @pendral/bellwether/data/node.
FHIR, HL7 and X12
import { fromFhirServer, parseBundle, smartBackend, toCanonical } from "@pendral/bellwether/fhir";
import { ack, parse, toCanonical as hl7ToCanonical } from "@pendral/bellwether/hl7";
import { matchRemittance, parse835, parse837 } from "@pendral/bellwether/x12";
const records = toCanonical(parseBundle(fhirBundle));
const auth = smartBackend({ clientId: "bellwether", privateKey: process.env.SMART_KEY!, keyId: "k1", scope: "system/*.read" });
for await (const record of fromFhirServer({ baseUrl: "https://ehr.example.org/fhir", auth, searches: [{ resourceType: "Patient" }] })) {
console.log(record.resourceType);
}
const message = parse(hl7Message);
const { records: adtRecords } = hl7ToCanonical(message);
const reply = ack(message, "AA");
declare const x12Claims: string;
declare const x12Remits: string;
const claims = parse837(x12Claims);
const remits = parse835(x12Remits);
const matched = matchRemittance(claims.claims, remits.remittances);Codes
import { detectCodeSystem, inValueSet, normalizeNdc, parseCode, validateNpi, VALUE_SETS } from "@pendral/bellwether/codes";
parseCode("ICD-10-CM", "E119"); // { system: "ICD-10-CM", code: "E11.9" }
validateNpi("1234567893").valid; // true
normalizeNdc("0093-7214-01").ndc11; // "00093721401"
inValueSet({ system: "ICD-10-CM", code: "E11.9" }, VALUE_SETS.diabetes); // true
detectCodeSystem("4548-4").system; // "LOINC"Validators check shape and check digits (NPI, LOINC, SNOMED); value sets are curated and labeled as not certified.
De-identification
import { assertNoPhi, createDeidentifier, kAnonymity, scrubText, suppressSmallCells } from "@pendral/bellwether/deid";
import type { Bundle } from "@pendral/bellwether/data";
declare const bundle: Bundle;
const safeHarbor = createDeidentifier({ secret: process.env.DEID_SECRET!, method: "safe-harbor" });
const shared = safeHarbor.bundle(bundle); // years, ZIP3, no names, ids or contact data
assertNoPhi(shared.patients);
const research = createDeidentifier({ secret: process.env.DEID_SECRET!, method: "pseudonymize", dateShift: { maxDays: 30, perPatient: true } });
const { text } = scrubText("Patient: John Smith, MRN 448812, called 555-201-3344.", { replacement: "tag" });
// "Patient: [NAME], MRN [MRN], called [PHONE]."
const cells = suppressSmallCells([42, 7, 19], { threshold: 11 });
const k = kAnonymity(shared.patients.map((p) => ({ year: p.birthDate ?? "", state: p.address?.state ?? "" })), ["year", "state"]);Safe Harbor output keeps years only, collapses ages 90 and over, keeps state and ZIP3 (000 for restricted prefixes) and drops the 18 identifiers. Pseudonyms are HMAC-SHA256 tokens, stable for one secret. Pseudonymization with real dates is a limited data set, not de-identified data, and the docs say so.
Knowledge graph
import { buildGraph, toCypher } from "@pendral/bellwether/graph";
import { createDeidentifier } from "@pendral/bellwether/deid";
import type { Bundle } from "@pendral/bellwether/data";
declare const bundle: Bundle;
const graph = buildGraph(bundle, { deidentifier: createDeidentifier({ secret: process.env.DEID_SECRET!, method: "pseudonymize" }) });
const continuity = graph.careFragmentation();
const leakage = graph.referralLeakage(["1234567893"]);
const statements = toCypher(graph); // or toNeo4j(driver, graph), toGremlin, toGraphML, toRdfPatients, providers, facilities, payers, conditions, medications, claims and encounters, with attribution, referrals, shared patients and comorbidity edges, plus PageRank, betweenness, communities and care fragmentation.
Embeddings and vector stores
import { embedRecords, openAICompatible } from "@pendral/bellwether/embeddings";
import { createRetriever, pgvector, ragContext, upsertChunks } from "@pendral/bellwether/vector";
import type { Bundle } from "@pendral/bellwether/data";
declare const bundle: Bundle;
declare const db: { query(sql: string, params: unknown[]): Promise<{ rows: Record<string, unknown>[] }> };
const provider = openAICompatible({ baseUrl: "https://api.openai.com/v1", apiKey: process.env.OPENAI_API_KEY!, model: "text-embedding-3-small", dimensions: 1536 });
const chunks = await embedRecords(bundle, { provider, serializer: "patientSummary", secret: process.env.DEID_SECRET! });
const store = pgvector({ executor: db, dimensions: 1536 });
await upsertChunks(store, chunks);
const retriever = createRetriever({ store, provider });
const hits = await retriever.search("uncontrolled diabetes after a recent discharge", { topK: 8 });
const context = ragContext(hits, { maxTokens: 2000 });Text is de-identified before it is embedded, and the PHI guard refuses to send anything that still looks identified
unless you pass phi: { baa: true }. The guard is best effort: it finds identifiers by shape and names by context, plus
a strict check for capitalized name pairs in free text. Run clinical notes through a Deidentifier before embed(texts)
sends them to a vendor without a BAA. Adapters: in-memory (with HNSW), pgvector, SQL Server, Azure AI Search, Qdrant,
Pinecone, Weaviate, Elasticsearch and OpenSearch. Providers: OpenAI compatible (OpenAI, Azure OpenAI, vLLM, Ollama),
Voyage, Cohere, Bedrock, Vertex and your own.
Analytics
import { allCauseReadmissions, population, REFERENCE_MEASURES, runMeasure } from "@pendral/bellwether/analytics";
import type { Bundle } from "@pendral/bellwether/data";
declare const bundle: Bundle;
const pmpm = population(bundle).groupBy("lineOfBusiness", "quarter").measure("members", "pmpm", "admitsPer1000").run();
const hba1c = runMeasure(REFERENCE_MEASURES.hba1cControl(), bundle);
const readmits = allCauseReadmissions(bundle, { period: { start: "2026-01-01", end: "2026-06-30" } });Cohort rules use the same JSON as the platform, and small-cell suppression is on by default (threshold 11, with the complementary rule). Reference measures are labeled HEDIS-like, not certified.
LLM tools and MCP
import { loadBellwetherTools } from "@pendral/bellwether/ai";
const tools = await loadBellwetherTools(bw); // read-only, only what this credential can call
const anthropicTools = tools.toAnthropicTools();
const openaiTools = tools.toOpenAITools({ api: "responses", strict: true });Pass the definitions to your model, then run each tool call with tools.runAnthropicToolCall(block) or
tools.runOpenAIToolCall(call). Results are de-identified on your side unless you pass phi: { baa: true }, even on a
PHI-tier credential, so identified text never reaches a third-party model by accident. Writes are off unless you set
readOnly: false.
The same tools as an MCP server, over stdio or Streamable HTTP:
import { createMcpServer, loadBellwetherTools } from "@pendral/bellwether/ai";
const server = createMcpServer({ bw, tools: await loadBellwetherTools(bw) });
export const POST = server.httpHandler({ authorize: (req) => req.headers.get("authorization") === `Bearer ${process.env.MCP_TOKEN}` });Or from the command line: npx -p @pendral/bellwether bellwether mcp.
EvryAI and Vocalis integrations
Give EvryAI agents Bellwether tools that act for exactly one member, verified from the agent's on-behalf-of token:
import { bellwetherTools, createBellwetherToolHandler } from "@pendral/bellwether/integrations/evryai";
declare const verifyOnBehalfOf: Parameters<typeof createBellwetherToolHandler>[0]["verify"];
const definitions = await bellwetherTools(bw, { url: "https://tools.example.com/bellwether" });
export const POST = createBellwetherToolHandler({ bw, verify: verifyOnBehalfOf, audience: "https://tools.example.com/bellwether" });Sync a cohort or a measure's open gaps into a Vocalis campaign (PHI tier, respecting do-not-contact and consent), and write call outcomes back as care notes and tasks:
import { createVocalisWebhookBridge, syncGapsToVocalis } from "@pendral/bellwether/integrations/vocalis";
declare const vocalis: Parameters<typeof syncGapsToVocalis>[0]["vocalis"] & Parameters<typeof createVocalisWebhookBridge>[0]["vocalis"];
const report = await syncGapsToVocalis({ bw, vocalis, measureId, contactListId: "cl_123" });
console.log(report);
export const POST = createVocalisWebhookBridge({ vocalisSecret: process.env.VOCALIS_WEBHOOK_SECRET!, bw, vocalis });bridgeEventsToEvryAI turns Bellwether events (for example adt.discharged) into EvryAI runs or journeys, once per
event.
Testing
@pendral/bellwether/testing is an in-process Bellwether over a synthetic plan, so you can test without a network or
real data:
import Bellwether from "@pendral/bellwether";
import { createMockBellwether, signWebhook, syntheticBundle } from "@pendral/bellwether/testing";
const mock = createMockBellwether({ tier: "deidentified", members: 50, seed: 7 });
const client = new Bellwether({ apiKey: mock.apiKey, baseUrl: mock.baseUrl, fetch: mock.fetch });
const page = await client.members.list();
const synthetic = syntheticBundle({ patients: 100, seed: 1 });Event fixtures for every type and signWebhook cover webhook handler tests.
The mock implements the operations integrations use most: identity, members and Member 360 reads (not timeline),
claims, cohorts (list, get, members), gaps, care tasks, comms proposals, events and exports (members, claims, rx-fills
and labs). Any other operation answers 501 not_implemented; register your own answer with mock.on(operationId, handler)
when a test needs one.
Command line
npx -p @pendral/bellwether bellwether whoami
npx -p @pendral/bellwether bellwether members list --limit 20
npx -p @pendral/bellwether bellwether export claims --ndjson --since 2026-01-01 --out claims.ndjson
npx -p @pendral/bellwether bellwether events tail --types adt.discharged
npx -p @pendral/bellwether bellwether deid records.ndjson --out safe.ndjson
npx -p @pendral/bellwether bellwether codes validate ICD-10-CM E119
npx -p @pendral/bellwether bellwether x12 parse claims.837
npx -p @pendral/bellwether bellwether request GET /api/agent/v1/members --query limit=5Output files are created with mode 0600 and never overwritten without --force. The key is never printed.
Errors
Every failure is a BellwetherError carrying status, code, message, hint, docs and requestId. Messages never
contain member data.
import { NotFoundError, PermissionDeniedError, PhiTierRequiredError, RateLimitError } from "@pendral/bellwether";
try {
await bw.members.get(memberRef);
} catch (error) {
if (error instanceof NotFoundError) console.error("No such member in this organization");
else if (error instanceof PhiTierRequiredError) console.error("This needs a PHI-tier credential");
else if (error instanceof PermissionDeniedError) console.error(error.hint);
else if (error instanceof RateLimitError) console.error(`Retry in ${error.retryAfterSeconds}s`);
else throw error;
}| Class | When |
| --- | --- |
| BadRequestError | The request failed validation (400). The message names the field, never its value. |
| AuthenticationError | The key is missing, invalid, expired or revoked (401). |
| PermissionDeniedError | The credential lacks a scope, or access is denied (403). |
| PhiTierRequiredError | The call needs a PHI-tier credential (403). |
| NotFoundError | The record does not exist, or belongs to another organization (404). |
| ConflictError | A duplicate, a state that does not allow this, or an idempotency key reused with a different request (409). |
| UnprocessableEntityError | Valid JSON that breaks a business rule (422). |
| RateLimitError | Over the credential's limit (429). retryAfterSeconds says when to try again. |
| InternalServerError | Something failed on our side (5xx). Quote requestId to support. |
| APIConnectionError / APIConnectionTimeoutError / APIUserAbortError | No response, a timeout, or your signal aborted. |
Retries and idempotency
Network errors, timeouts, 408, 429 and 5xx are retried twice with jittered backoff (0.5 s base, 8 s cap) that honours
Retry-After. No other 4xx is retried. Every POST, PATCH, PUT and DELETE sends an Idempotency-Key, reused across
retries, so the API runs the request once and replays the stored response to every repeat (Idempotent-Replayed: true).
Pass your own key to make an operation idempotent across your own retries:
const created = await bw.careTasks
.create({ member: memberRef, title: "Post-discharge call" }, { idempotencyKey: `discharge-${runId}` })
.withResponse();
console.log(created.data.id, created.idempotentReplay, created.requestId);Configuration
const client = new Bellwether({
apiKey: process.env.BELLWETHER_API_KEY,
baseUrl: "https://plan.example.com",
maxRetries: 2,
timeoutMs: 60_000,
});| Option | Default | |
| --- | --- | --- |
| apiKey | BELLWETHER_API_KEY | A Platform API key, bwa_ followed by 48 hex characters. |
| fhirApiKey | BELLWETHER_FHIR_API_KEY | Optional organization key for FHIR and ADT; a PHI-tier apiKey works too. |
| baseUrl | BELLWETHER_BASE_URL | Your plan's deployment. HTTPS, except localhost. |
| maxRetries | 2 | Per request. Override per call with { maxRetries }. |
| timeoutMs | 60000 | Per attempt, including reading the body. |
| fetch | global fetch | Your own, for proxies, instrumentation or tests. |
| defaultHeaders | | Sent with every request. Cannot replace the credential or the idempotency key. |
| logger | silent | { debug(message, fields) }. Never receives bodies or headers. |
Every call also takes { signal, timeoutMs, maxRetries, idempotencyKey, headers } as its last argument. For an
endpoint newer than this SDK, bw.request("members.get", { params: { id } }) calls any operation by id and
bw.raw("GET", "/api/agent/v1/...") calls any path, both with the client's credentials, retries and errors.
Keep keys on your server. The client refuses to start in a browser unless you pass dangerouslyAllowBrowser: true.
Runtime support
- Node.js 20 or later, Bun, Deno, Vercel Edge and Cloudflare Workers: anything with
fetch, Web Crypto andReadableStream. - The CLI and
@pendral/bellwether/data/nodeneed Node.js (or a runtime with Node compatibility). - TypeScript 5 or later, if you use TypeScript. ESM and CommonJS builds ship side by side.
Security
- HIPAA. Bellwether is built for covered entities and their business associates. PHI-tier credentials require a BAA attestation when issued, every read of member data is audited, and every write is audited on its own.
- What never leaves your environment. The data toolkit (FHIR, HL7, X12, CSV, de-identification, graph, embeddings,
vector stores, analytics) runs entirely in your process. It makes no network call you did not configure, and it will
not send identified text to a model, embedding provider or external vector store without
phi: { baa: true }. - Transport. HTTPS only, redirects refused, keys validated and never echoed, path parameters encoded, and caller headers cannot replace the credential.
- Webhooks. HMAC-SHA256 signatures with a timestamp, checked in constant time against every active secret.
- Reporting a vulnerability. Contact your Bellwether account team. Please do not include PHI in a report.
Versioning
This package follows semantic versioning. While it is 0.x, a minor version can include breaking changes, listed in
CHANGELOG.md. The Platform API path (/api/agent/v1) is versioned separately and stays backward
compatible within v1.
Support
See the documentation for guides and the full API reference. For help, contact
your Bellwether account team and include the requestId from the error or the X-Request-Id response header.
License
Proprietary. Copyright © 2026 Pendral, Inc. All rights reserved. See LICENSE.
