Skip to main content

Proof SDK

The Cronozen Proof SDK provides a lightweight, type-safe client for the Decision Proof API. Record AI decisions, add human approvals, and export audit-ready evidence.
Package: cronozen · Size: 11.2KB · Dependencies: Zero · Formats: CJS + ESM + TypeScript

Installation


Quick Start


API Reference

cz.decision.record(params)

Create a new decision event with structured metadata.
Returns: DecisionEventResponse
Event types: agent_execution | workflow_step | human_approval | ai_recommendation | automated_action | policy_decision | escalation | custom

Idempotency

Pass idempotencyKey to safely retry without creating duplicates. If the same key is sent again, the original event is returned instead of creating a new one.
Use idempotency keys for any event triggered by webhooks, queue consumers, or cron jobs where retries are expected.

cz.decision.approve(id, params)

Add human approval and seal the decision with SHA-256.
Once approved, the event is sealed — its hash becomes part of the immutable chain.
Calling approve() on an already-sealed event throws ConflictError (409). This is by design — sealed events cannot be modified.

cz.decision.get(id)

Retrieve a single decision event with full metadata.

cz.decision.list(params?)

List decision events with optional filters.
Returns: DecisionEventListResponse

cz.evidence.get(id)

Retrieve sealed evidence with full hash chain verification data. Returns the complete event payload including input data, AI context, approval chain, and chain integrity status.
Use evidence.get() for chain integrity verification and compliance checks. Use evidence.export() when you need a portable audit document.
Throws NotFoundError if the decision hasn’t been sealed yet.

cz.evidence.export(id)

Export audit-ready document in JSON-LD v2 format.
Export includes:
  • Structured decision record (actor, action, input, AI context)
  • Approval chain with timestamps
  • SHA-256 hash chain link and position
  • Evidence level and verification metadata

Error Handling

The SDK provides 9 typed error classes for precise error handling:

Handling 409 Conflict (Sealed Events)

The most common non-trivial error. Occurs when two approvers act simultaneously, or retry logic re-sends an already-successful approval.
Combine idempotencyKey on decision.record() with ConflictError handling on decision.approve() for fully retry-safe integrations.

Non-Blocking Integration

For production use, wrap Proof calls so they never block your business logic:
If CZ_KEY environment variable is not set, you can make the SDK client silently disable itself. This means you can add Proof integration to your codebase and activate it per-environment by simply setting the key.

Integration Patterns

Settlement Flow

AI Agent Workflow

Webhook (Coming Soon)


Configuration


What’s Next

  • Proof Admin Console — Visual decision timeline and audit dashboard
  • Multi-approval policies — Route approvals by amount, risk level, or decision type
  • Webhook notifications — Real-time alerts on specific event types
  • Batch recording — Record multiple decisions in a single API call

Get API Key

Sign up and generate your Proof API key to get started.