# Setup guide — Form-to-JSON Extraction Agent

## 1. Install and configure

Install the agent and point it at your schema.

```
pipx install form-extract-agent
form-extract-agent init --schema ./schema.json
form-extract-agent doctor
```

## 2. Configure no-guess guardrails

No fabricated fields and confidence flagging are enforced here.

```
cp .env.example .env
ANTHROPIC_API_KEY=sk-ant-...
NO_GUESSED_VALUES=true
FLAG_BELOW_CONFIDENCE=medium
SCHEMA_VALIDATE=true
```

## 3. Define the schema

Declare fields, types, and which are required.

```
# schema.json
{ "name": "string", "dob": "date", "id_number": "string",
  "required": ["name"], "enums": { "state": ["active","inactive"] } }
```

## 4. Test on samples

Extract sample forms and review confidence and flags.

```
form-extract-agent run --doc ./form.pdf --explain
# prints JSON + per-field confidence + review_required (no guessed values)
```

## 5. Wire into your pipeline

Extract incoming forms; flagged fields go to review.

```
# document in -> extract -> schema-valid JSON; low-confidence/missing -> review queue
```
