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_TRACEand everyaicall appends one JSON object per line: provider, model, tokens, latency, retries, and cost. Pipe the file into your SIEM or attach it to the claim record. - Per-claim attribution
- Built-in
tokens()andcost()read the last call's usage, so a batch run can write spend next to each extracted claim without a separate metering service.
In practice
type Claim = {
policy_id: str,
loss_date: str,
peril: str,
reserve_usd: decimal,
}
fn intake(raw: str) -> Claim {
ai "Extract a first-notice-of-loss from this text" from raw
}
# ECKO_TRACE=claims.jsonl ecko intake.ecko
# one JSON line per ai call, claim id in your own log
Try it on your workload.