CL SDK

Deterministic insurance intelligence primitives for regulated AI agents.

Clarity Labs builds deterministic AI agents for regulated industries, starting with commercial insurance.

CL SDK is the insurance intelligence layer behind those agents: a pure TypeScript library for extracting, reasoning about, and acting on insurance documents with deterministic scaffolding around model calls. It is provider-agnostic by design: bring any LLM via plain callback functions. No framework dependency.

Version 1.0 makes source-grounded workflows first class. Extraction records page-aware source spans, query and application agents can reason over those spans, and policy change endorsement workflows produce validated submission packets with quoted evidence.

Capabilities

Document Extraction

Deterministic extraction pipeline with focused model calls that turns insurance PDFs into structured data — coverages, limits, definitions, covered reasons, exclusions, endorsements — with page-level provenance and review loops.

Source Grounding

Reusable source spans, page references, quoted evidence, and retrievers for extraction, query, application, and endorsement workflows.

Query Agent

Citation-backed question answering over stored documents plus inbound photos, PDFs, and text. Decomposes questions, retrieves source evidence, reasons with intent-specific prompts, and verifies grounding.

Application Processing

Bounded application workflows handle intake — field extraction, auto-fill from prior answers, topic-based question batching, PDF mapping, and source-backed field provenance.

Policy Change Endorsements

PCE workflows intake requested changes, collect evidence, validate readiness, and generate carrier-ready submission packets.

Case Workflows

Shared case primitives track proposals, quoted evidence, dedupe decisions, and human-review state across agent flows.

Agent System

Composable prompt modules for building insurance-aware agents across email, chat, SMS, Slack, and Discord with human-reviewable behavior.

Storage & Memory

DocumentStore and MemoryStore interfaces for persisting extracted documents, vector chunks, and conversation history. Includes SQLite reference implementation.

Install

npm install @claritylabs/cl-sdk pdf-lib zod
import { createExtractor } from "@claritylabs/cl-sdk";

const extractor = createExtractor({ generateText, generateObject });
const { document, chunks, sourceSpans } = await extractor.extract(pdfBase64);

console.log(document.carrier);    // "Hartford"
console.log(document.coverages);  // [{ name: "General Liability", limit: "$1,000,000", ... }]
console.log(sourceSpans.length);  // page-backed source references, when provided
console.log(chunks.length);       // 24 chunks ready for vector storage

Get started