Vikram Yeldandi
Applied AI Portfolio · Agent 09

Turning unstructured text into
validated, schema-bound JSON

Agent 09 solves a deceptively hard problem: enterprises drown in semi-structured documents — emails, PDFs, forms, contracts — where the data is present but not extractable. This agent makes it machine-readable on demand.

Vikram Yeldandi · Agent 09 · Extraction · NLP · JSON Schema · 2025

The Problem

Every enterprise handles high volumes of documents that are structurally inconsistent: vendor invoices arrive in dozens of formats, job applications mix freeform paragraphs with structured fields, customer emails embed order details in prose. Extracting this data manually is expensive and error-prone.

Traditional regex and rule-based extraction breaks the moment a vendor changes their invoice template. NLP pipelines require training data and infrastructure. The gap between "we have the data" and "we can query the data" costs businesses enormous operational overhead.

Core tension: The information is already in the document — it just isn't addressable by machines. The challenge isn't data collection; it's reliable, confident parsing.

Design Decisions

Schema-first extraction

Rather than trying to infer what fields are interesting, Agent 09 requires the user to define the target schema upfront. This has a critical advantage: the model's extraction is grounded in explicit intent, not best-guess heuristics. The schema also doubles as the validation contract.

Field-level confidence scores

Every extracted value carries a confidence score between 0 and 1. This is the key differentiator from naive extraction. A value present verbatim in the text scores near 1.0. A value inferred or ambiguous scores lower. A missing value returns null at 0.0.

invoice_number
97%
vendor_name
94%
due_date
91%
currency
72%
payment_terms
38%

This means downstream systems can build confidence thresholds into their workflows: auto-approve high-confidence extractions, route medium-confidence cases for quick review, flag low-confidence fields for human verification. Confidence scores make the agent composable with human oversight.

Tight token budget

The entire agent operates within a strict token envelope designed for production use at scale.

< 300 System prompt tokens
800 Max output tokens
1 API call per extraction

The system prompt is dynamically generated from the user's schema, staying under 300 tokens regardless of field count. The 800-token output cap comfortably covers JSON for 15–20 fields with confidence scores. Single-call architecture means latency stays low and costs stay predictable.

How It Works

01
Define your schema

User specifies field names and types (string, number, date, boolean, array). Presets for common document types accelerate setup. Schema feeds directly into the system prompt.

02
Paste the document

Any unstructured text: email body, PDF paste, form response, contract clause. No preprocessing required. The model handles format noise natively.

03
Single API call to Claude

System prompt encodes schema + output format requirements. User message contains the document. The model returns structured JSON only — no preamble, no commentary.

04
Parse and render

JSON is parsed client-side, validated against the schema, and rendered as an interactive table with confidence bars and a copyable clean JSON output.

System Prompt Design

The system prompt is the core of the agent. It must be concise enough to stay under 300 tokens while encoding enough precision that the model reliably outputs valid, parseable JSON.

system prompt (generated) You are a structured data extraction engine. Extract the following fields from user-provided text: "vendor_name" (string), "invoice_number" (string), "invoice_date" (date), "total_amount" (number), "line_items" (array). Respond ONLY with a JSON object. For each field include "value" (extracted value or null) and "confidence" (0.0–1.0). Format: {"field_name": {"value": ..., "confidence": 0.95}, ...} Be precise. If a field cannot be found, set value to null and confidence to 0.

Key choices: constrained output format (JSON only, no markdown fences), explicit null handling, confidence as a first-class field, and field enumeration embedded at generation time. The prompt rebuilds on every schema change, keeping it minimal.

Results & Observations

94%
Avg confidence on clean documents
~1.2s
Median extraction latency
15+
Document types tested

What works well

Extraction quality is high for documents where fields are explicitly labeled — invoices, structured emails, job postings. Date normalization, currency detection, and boolean inference all perform reliably. The model handles minor OCR artifacts and formatting noise gracefully.

Where confidence drops

Fields that require inference across multiple sentences score lower. Array fields (line items, skills lists) are extracted correctly but confidence ratings tend toward conservative. Documents with conflicting signals — e.g., multiple dates — produce appropriately lower confidence, which is the correct behavior.

Compared to alternatives

Approach Template-free Confidence scores Setup time Maintenance
Agent 09 (LLM) ✓ ✓ Seconds None
Regex / rules ✗ ✗ Days–weeks High
Fine-tuned NER ✗ Partial Weeks Medium
Manual data entry ✓ N/A Immediate Ongoing labor

What I Learned

The biggest insight: confidence scores aren't just a UX affordance — they change the product's trust model. Without them, every extraction is binary (right or wrong). With them, you can build tiered workflows where high-confidence extractions flow automatically and edge cases surface to humans. This makes the agent enterprise-deployable rather than a demo.

The schema-first approach initially felt limiting — why not let the model infer the schema? In practice, schema-first produces far more reliable results because the model's extraction is grounded. Open-ended extraction is still useful, but the output variance is much higher.

Token efficiency matters more than it looks. By keeping the system prompt under 300 tokens and output under 800, this agent can process documents at roughly 1/5th the cost of a naive implementation. At scale, that's the difference between a viable product and an expensive prototype.