Use casesRegulated work

Insurance claims intake

Typed extraction into structs beats prompt-and-parse, and JSONL tracing gives you a per-claim audit trail with token and cost attribution.

The problem

Claims arrive as free text, photos, and PDFs. Someone has to turn that into structured fields - policy number, loss date, peril, reserve estimate - before downstream systems can act. The usual approach is an LLM call followed by regex or a second model pass to coerce JSON, which fails quietly when a field is missing or the wrong type.

Regulators and internal audit want more than a log line that says "model returned OK". They want a replayable record: which model, which prompt, which tokens, what it cost, and what struct came out - tied to a claim id.

Why Ecko

Typed extraction
Declare the output as a struct. The runtime validates the model's answer against it before your code runs, so a missing reserve field is a catchable error, not a null pointer three systems later.
JSONL tracing
Set ECKO_AI_TRACE and every ai call appends one JSON object per line: provider, model, tokens, latency and retries. Pipe the file into your SIEM or attach it to the claim record.
Per-claim attribution
Built-in tokens() counts each claim's text and cost() prices it at the rates you pass, so a batch run can write spend next to each extracted claim without a separate metering service.

In practice

extract.ecko
type Claim { policy_id: String, loss_date: String, peril: String, reserve: Decimal }

fn intake(raw) = ai[Claim] "Extract a first-notice-of-loss from: {raw}"

raw = "Pipe burst in the kitchen on 3 March. Policy HX-2231."
claim = intake(raw)

# Price the call at your provider's rates, per claim, in the same process.
spend = cost(tokens(raw), tokens(string(claim)), 0.15, 0.6)
print("{claim.policy_id}: {claim.peril}, ${spend}")
# ECKO_AI_TRACE=claims.jsonl ecko extract.ecko
# appends one JSON line per ai call

Further reading

Try it on your workload.