Skip to content

TypeScript SDK — @uks/sdk

Build, validate, and consume UKS packets programmatically in TypeScript or JavaScript. Same bundled schema as the CLI, so validation results match exactly.

bash
npm install @uks/sdk

Validate

ts
import { validate } from '@uks/sdk';

const result = validate(packet);
if (!result.valid) {
  console.error(result.errors);
}

Build a packet

The SDK provides typed builders so you construct valid packets by construction — required fields, evidence grades, and clinical statuses are all typed.

ts
import { buildPacket } from '@uks/sdk';

const packet = buildPacket({
  packet_id: 'uks-omega3-v1',
  conformance_level: 'L1',
  created_at: '2026-06-15T00:00:00Z',
  topic: { title: 'Omega-3 Fatty Acids' },
  sources: [{
    id: 'src_001',
    title: 'EPA and DHA supplementation and cardiovascular risk',
    source_type: 'meta_analysis',
    credibility_score: 9,
    evidence_grade: 'high',
    clinical_status: 'validated',
    license_label: 'CC BY 4.0',
    rights_url: 'https://creativecommons.org/licenses/by/4.0/',
  }],
});

Registry client

@uks/sdk/registry is a dependency-free client for the public Registry — search, pull, and the graph-aware answer endpoint.

ts
import { RegistryClient } from '@uks/sdk/registry';

const registry = new RegistryClient(); // defaults to the public registry
const results = await registry.searchHybrid('magnesium glycinate sleep');
const answer  = await registry.answer('does CoQ10 help statin myalgia?');

Framework adapters

The SDK ships adapters so registry knowledge drops into popular agent frameworks:

  • @uks/sdk/langchain — LangChain retriever
  • @uks/sdk/llamaindex — LlamaIndex reader
  • @uks/sdk/vercel-ai — Vercel AI SDK tool

Each is dependency-free at the core and adapts registry results into the framework's native shape.

→ Related: Python SDK · Query the Registry · CLI

Released under the MIT License.