Metadata-Version: 2.4
Name: sigmodx
Version: 0.3.0
Summary: Sigmodx SDK for invoice approval agent instrumentation
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: httpx>=0.27.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"

# Sigmodx Python SDK

Install:

```bash
pip install sigmodx
```

## Quickstart

```python
from decimal import Decimal
from sigmodx import SigmodxClient, InvoiceDecision, hash_inputs

payload = {
    "invoice_amount": 142500.00,
    "vendor_id": "VENDOR-4821",
    "po_reference": "PO-4821",
    "invoice_reference": "INV-2026-0042",
}

client = SigmodxClient(api_key="sk_...", agent_id="your-agent-uuid")
decision = InvoiceDecision(
    decision_type="approve",
    input_hash=hash_inputs(payload),
    rationale="Within delegated authority; PO matches contract.",
    confidence=0.94,
    invoice_amount=Decimal("142500.00"),
    vendor_name="Acme Consulting LLC",
    vendor_id="VENDOR-4821",
    po_reference="PO-4821",
    invoice_reference="INV-2026-0042",
    delegated_authority_limit=Decimal("500000.00"),
)

result = client.submit_invoice_decision(decision)
print(result.decision_event_id, result.requires_human_approval)
client.close()
```

## `hash_inputs()`

Include structural fields your agent used to decide (amounts, references, field names). Keys are sorted before hashing so the digest is stable.

**Security:** Never include sensitive field values in `hash_inputs()` if you do not want them derivable. Hash the structural payload — field names, amounts, references. Sigmodx stores only the hash.

## Error handling

- `AgentBlockedError` — agent reliability state is `BLOCK` (HTTP 403).
- `SigmodxError` — other API failures.
