Connecting Enterprise Systems

Mixed chains: deterministic enterprise apps + AI agents, one accountability layer.

No enterprise runs pure AI-agent chains. Real workflows mix AI agents with Salesforce, NetSuite, SAP, billing systems, and internal APIs. AGLedger handles the full chain — the mandate lifecycle is the same regardless of whether the caller is an AI agent, an ERP system, or a human.

The real-world chain

Salesforce (creates PO)  →  AI Agent (sources vendor)  →  NetSuite (books payment)
     principal                   performer                    performer
     deterministic               non-deterministic            deterministic

Each system creates or fulfills mandates using standard HTTP calls. AGLedger does not know or care what is behind the API key.

Pattern 1: ERP assigns, AI agent delivers

Your ERP creates a mandate with exact specifications. Your AI agent fulfills it. Your ERP renders the verdict using its own business rules.

ERP creates mandate

curl -X POST "$API_BASE/v1/mandates/agent" \
  -H "Authorization: Bearer $ERP_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "principalAgentId": "'$ERP_AGENT_ID'",
    "performerAgentId": "'$AI_AGENT_ID'",
    "contractType": "ACH-PROC-v1",
    "contractVersion": "1",
    "platform": "erp-integration",
    "criteria": {
      "item_spec": "Industrial pressure sensors, Model PS-200, ISO 9001",
      "quantity": { "target": 200, "tolerance_pct": 5, "unit": "units" },
      "price_ceiling": { "amount": 50000, "currency": "USD" },
      "deadline": "2026-04-05T00:00:00Z"
    },
    "tolerance": { "quantity_pct": 5, "price_margin": 2500, "grace_seconds": 86400 },
    "verificationMode": "principal",
    "metadata": {
      "source": "erp-system",
      "poNumber": "PO-2026-04821",
      "department": "manufacturing"
    }
  }'

verificationMode: "principal" means the ERP renders the verdict, not AGLedger's tolerance engine.

AI agent submits receipt

The agent found a different supplier at a different price:

curl -X POST "$API_BASE/v1/mandates/$MANDATE_ID/receipts" \
  -H "Authorization: Bearer $AI_AGENT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agentId": "'$AI_AGENT_ID'",
    "evidence": {
      "item_secured": "Pressure sensors, Model PS-200X (upgraded), ISO 9001 + ISO 14001",
      "quantity": 195,
      "total_cost": { "amount": 47500, "currency": "USD" },
      "supplier": { "id": "SUP-GLOBAL-019", "name": "GlobalSensor Ltd." },
      "confirmation_ref": "GS-20260329-001"
    }
  }'

ERP renders verdict

curl -X POST "$API_BASE/v1/mandates/$MANDATE_ID/outcome" \
  -H "Authorization: Bearer $ERP_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "outcome": "PASS", "receiptId": "'$RECEIPT_ID'" }'

Pattern 2: Downstream chain trigger

The AI agent's completed procurement triggers a billing workflow:

curl -X POST "$API_BASE/v1/mandates" \
  -H "Authorization: Bearer $BILLING_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "enterpriseId": "'$ENTERPRISE_ID'",
    "contractType": "ACH-TXN-v1",
    "contractVersion": "1",
    "platform": "billing-system",
    "agentId": "'$BILLING_AGENT_ID'",
    "criteria": {
      "description": "Process payment: $47,500 to GlobalSensor Ltd."
    },
    "tolerance": {},
    "metadata": {
      "upstreamMandateId": "'$PROCUREMENT_MANDATE_ID'",
      "poNumber": "PO-2026-04821"
    }
  }'

Retry safety (idempotency)

Deterministic systems retry. AGLedger handles this safely:

First attempt:  201 Created         →  receipt accepted
Retry attempt:  422 Unprocessable   →  mandate already moved past ACTIVE

Your retry logic can treat 422 as "already processed" and move on.

Error handling

Enterprise apps need structured errors. AGLedger returns RFC 7807 problem details:

{
  "type": "https://api.agledger.ai/problems/validation-error",
  "title": "Validation Error",
  "status": 400,
  "detail": "body must have required property 'criteria'",
  "errors": [{ "instancePath": "", "keyword": "required", "params": { "missingProperty": "criteria" } }]
}

Actor types

| Actor Type | Integration | Key Difference | |---|---|---| | AI Agent | SDK or HTTP. Variable payloads. Self-corrects from 422s. | Non-deterministic — needs schema discovery | | Enterprise App | HTTP. Fixed payloads. Retry logic. | Deterministic — breaks on schema changes, never hallucinates | | Human | Dashboard or API. | The ultimate principal |

AGLedger treats them all the same. A mandate is a mandate.


Validated with 18 assertions against the live API. View test source.