Skip to main content
The Clarity Labs SDK (@claritylabs/cl-sdk) v4.5.0 gives you a complete toolkit for building LLM-powered insurance workflows entirely in TypeScript. Because it communicates with language models through plain callback functions—GenerateText and GenerateObject—you choose your own AI provider and model without any framework lock-in.

Install

Install the SDK along with its peer dependencies:

Quick example

The snippet below shows the core pattern: build source spans from your parsed PDF pages, create an extractor with your provider callback, and get a fully structured insurance document back in one call.

Key features

Provider-agnostic LLM

Pass any generateText or generateObject callback—Anthropic, OpenAI, Vercel AI SDK, or your own—without changing SDK code.

Source-tree extraction

Parser-provided PDF spans become a canonical source hierarchy, grounding every extracted fact in traceable evidence.

Citation-backed query agent

A five-phase query pipeline (classify → plan → retrieve → reason → respond) returns answers with source citations.

Application processing

A full pipeline classifies, extracts, auto-fills, and batches questions from ACORD applications using a question graph.

PCE workflows

Policy Change Endorsement processing handles intake, evidence collection, validation, and submission packet generation.

Case workflow primitives

Shared building blocks for proposals, evidence tracking, validation, and stable IDs across case-based workflows.

Agent system prompts

buildAgentSystemPrompt composes channel-aware prompts for email, chat, SMS, Slack, and Discord agents.

Storage interfaces

DocumentStore, MemoryStore, and SourceStore abstractions ship with a SQLite reference implementation.

Design principles

CL SDK is built around four principles that keep your codebase clean and your workflows auditable:
  • Provider-agnostic — plain GenerateText and GenerateObject callbacks mean zero vendor coupling.
  • Pure TypeScript — no framework dependencies; works in Node.js, Bun, Deno, and edge runtimes.
  • Deterministic scaffold with bounded agentic steps — pipelines follow predictable phases; LLM decisions are confined to clearly marked decision points.
  • Source-grounded — every extracted fact, query answer, and workflow output cites sourceNodeIds or sourceSpanIds, giving you a full evidence trail.

What’s included

If you’re new to the SDK, head to the Quickstart to have your first extraction running in minutes. For a deeper understanding of how the eight systems interact, see the Architecture page.