# aigentsy

**Provable. Payable. Institutional.**

JavaScript SDK for AiGentsy, the institutional graph layer for agent commerce.

AiGentsy gives agent workflows portable ProofPacks, offline verification, explicit acceptance gates, and settlement coordination through existing payment rails.

## Install

    npm install aigentsy

## What it does

- Create signed ProofPacks for consequential agent work
- Verify ProofPacks offline
- Submit work through explicit acceptance gates
- Coordinate settlement after verification and acceptance
- Work with Node.js 18+ and modern browsers
- Use zero runtime dependencies

## Why AiGentsy

Agent work needs proof before payment.

AiGentsy provides:

- ProofPack v2.0.0 for portable signed evidence
- Offline verification without relying on AiGentsy servers
- Acceptance-gated settlement coordination
- Ed25519 + HMAC signing
- RFC 6962 transparency log support
- HoverStack compute governance
- ProofPack Reuse as the benchmark-proven HoverStack capability for redundant-work reduction

## HoverStack and ProofPack Reuse

HoverStack is AiGentsy’s compute-governance layer. It records and signs consequential compute decisions, including when prior ProofPack-backed work is safely reused.

ProofPack Reuse is the benchmark-proven HoverStack capability that eliminates redundant inference when agents encounter already-attested work. Internally, this mechanism is called Prior-Artifact Sufficiency.

## Six live consequence-gate demos

AiGentsy is the acceptance gate between autonomous work and real-world consequence. Five live test-mode endpoints prove the same shape: proof verifies, acceptance fails, and downstream consequence stays held. The runtime emits a signed `REJECTED` (or held) event carrying a `policy_snapshot` (matched rule, evaluated inputs, policy hash) and, where applicable, an embedded `adapter_evaluation`. Every held response returns `downstream_triggered: false` and a consequence-class-specific safety marker.

| Demo | Endpoint | Safety marker |
|------|----------|---------------|
| Payout Held | `POST /demo/payout-held/run` | `no_funds_moved` |
| Deployment Held | `POST /demo/deployment-held/run` | `no_deployment_triggered` |
| Handoff Held | `POST /demo/handoff-held/run` | `no_handoff_triggered` |
| API Action Held | `POST /demo/api-action-held/run` | `no_external_api_call_made` |
| Procurement Held | `POST /demo/procurement-held/run` | `no_purchase_order_created`, `no_vendor_commitment_made` |

These are test-mode only. `test_mode=true` is returned on every held response, alongside the safety marker shown above and `downstream_triggered=false`. Funds are not moved, deployments are not triggered, handoffs are not executed, external API calls are not made, purchase orders are not created, and vendor commitments are not made.

Run any of them directly with `fetch`:

```js
const r = await fetch(
  "https://aigentsy-ame-runtime.onrender.com/demo/payout-held/run",
  { method: "POST" }
);
const out = await r.json();
// out.consequence_state === "payout_held"
// out.downstream_triggered === false
// out.no_funds_moved === true
// out.test_mode === true
```

The Verified-but-Rejected scenario plus the five held scenarios above are also runnable in the browser at [aigentsy.com/playground](https://aigentsy.com/playground).

Wedge invariant: **mandate before work, evidence before acceptance, acceptance before consequence, settlement when value moves.**

## Related packages

- `aigentsy-verify` - standalone offline ProofPack verifier
- `aigentsy-langgraph` - LangGraph nodes for AiGentsy workflows

## Links

- Docs: https://aigentsy.com/integrations
- Protocol: https://github.com/AiGentsyProtocol/aigentsy-protocol
- Runtime repo: https://gitlab.com/AiGentsy/aigentsy-ame-runtime

## License

MIT
