Developer API

Minimum Examples

These short examples show the simplicity and clarity of AiSQL. Each example demonstrates how real decisions can be expressed using familiar data and straightforward rules — without machine learning, without model training, and without complexity.


Call Center Routing (Deterministic JSON Table Evaluation)

A live inbound support call is submitted to ZeroTrain for routing. The engine evaluates structured customer attributes — including call intent, sentiment score, VIP status, payment failure flags, and escalation history — against a deterministic routing table.

The routing model is provided as a structured JSON resultset. Each row represents a routing policy rule with explicit conditions and a defined action outcome.

Request

{
  "InputSource": {
    "CustomerTenureMonths": 48,
    "AccountStatus": "Active",
    "CallIntent": "BillingDispute",
    "SentimentScore": -0.62,
    "OpenTicketCount": 2,
    "IsVIP": true,
    "HasPaymentFailure": true,
    "EstimatedCallDurationMinutes": 18,
    "PreviousEscalations": 1
  },
  "ModelSource": {
    "resultsets": {
      "RoutingRules": [
        {
          "ID": "CC-001",
          "CallIntent": "BillingDispute",
          "SentimentScore": "< -0.50",
          "IsVIP": true,
          "HasPaymentFailure": null,
          "PreviousEscalations": null,
          "OpenTicketCount": null,
          "Weight": 0.9,
          "IsEnabled": true,
          "Action": "EscalateToSupervisor"
        },
        {
          "ID": "CC-002",
          "CallIntent": "BillingDispute",
          "SentimentScore": null,
          "IsVIP": null,
          "HasPaymentFailure": true,
          "PreviousEscalations": null,
          "OpenTicketCount": null,
          "Weight": 0.75,
          "IsEnabled": true,
          "Action": "RouteToTier2"
        },
        {
          "ID": "CC-003",
          "CallIntent": null,
          "SentimentScore": "< -0.30",
          "IsVIP": null,
          "HasPaymentFailure": null,
          "PreviousEscalations": ">= 1",
          "OpenTicketCount": null,
          "Weight": 0.6,
          "IsEnabled": true,
          "Action": "RouteToRetention"
        },
        {
          "ID": "CC-004",
          "CallIntent": null,
          "SentimentScore": null,
          "IsVIP": null,
          "HasPaymentFailure": null,
          "PreviousEscalations": null,
          "OpenTicketCount": "> 3",
          "Weight": 0.5,
          "IsEnabled": true,
          "Action": "RouteToTier2"
        },
        {
          "ID": "CC-005",
          "CallIntent": null,
          "SentimentScore": null,
          "IsVIP": null,
          "HasPaymentFailure": null,
          "PreviousEscalations": null,
          "OpenTicketCount": null,
          "Weight": 0.2,
          "IsEnabled": true,
          "Action": "RouteToTier1"
        }
      ]
    }
  },
  "Options": {
    "DataSettings": {
      "ActionColumnName": "Action",
      "PriorityColumnName": "Weight",
      "WeightColumnName": "Weight",
      "DecisionIdColumnName": "ID",
      "RowFilter": "IsEnabled = true",
      "ModelName": "CallCenterRoutingModel"
    },
    "ContextOptions": {
      "CustomTag": "Call-Session-2026-0045"
    },
    "OutputSettings": {
      "ExecutionTraceMode": "Compact"
    }
  }
}

In this scenario:

  • CallIntent = BillingDispute
  • SentimentScore = -0.62 (strong negative)
  • IsVIP = true
  • HasPaymentFailure = true
  • PreviousEscalations = 1

ZeroTrain evaluates each enabled rule row independently, applying structured condition matching and weight influence.

Response

{
    "header": {
        "product": "ZeroTrain.Ai Core",
        "correlationId": "0681ab95-5816-4922-b6bb-e344ebffbe63",
        "customTag": "Call-Session-2026-0045",
        "createdUTC": "2026-02-16T23:21:59.0984458Z",
        "processingTime": "9.527 ms 🔥",
        "rowsEvaluated": 4,
        "resultCount": 1,
        "errorCount": 0,
        "warningCount": 0
    },
    "results": [
        {
            "modelName": "CallCenterRoutingModel",
            "decisionId": "CC-001",
            "action": "EscalateToSupervisor",
            "confidenceScore": 0.9579,
            "logicPassed": true,
            "logicTrace": [
                "R1",
                "C4:P"
            ]
        }
    ],
    "errors": [],
    "warnings": []
}

The selected action (EscalateToSupervisor) corresponds to rule CC-001, which matches:

  • Billing dispute intent
  • SentimentScore < -0.50
  • VIP customer status

The confidence score reflects structural alignment strength between the runtime inputs and the rule row — it is not a statistical prediction.

Because ZeroTrain is deterministic, identical inputs will always produce the same routing outcome.

Loan Approval (JSON Model Source)

A loan application is evaluated against a structured JSON-based decision model submitted directly within the request.

Request

{
  "InputSource": {
    "CreditScore": 720,
    "AnnualIncome": 85000,
    "DebtToIncomeRatio": 0.28,
    "LoanAmount": 250000
  },
  "ModelSource": {
    "resultsets": {
      "LoanRules": [
        {
          "ID": "L-001",
          "CreditScore": ">= 700",
          "DebtToIncomeRatio": "<= 0.35",
          "Weight": 0.9,
          "IsEnabled": true,
          "Action": "Approve"
        },
        {
          "ID": "L-002",
          "CreditScore": ">= 650",
          "DebtToIncomeRatio": "<= 0.45",
          "Weight": 0.6,
          "IsEnabled": true,
          "Action": "Review"
        },
        {
          "ID": "L-003",
          "CreditScore": "< 650",
          "Weight": 0.3,
          "IsEnabled": true,
          "Action": "Decline"
        }
      ]
    }
  },
  "Options": {
    "DataSettings": {
      "ActionColumnName": "Action",
      "PriorityColumnName": "CreditScore",
      "WeightColumnName": "Weight",
      "DecisionIdColumnName": "ID",
      "RowFilter": "IsEnabled = true",
      "ModelName": "LoanApprovalModel"
    },
    "ContextOptions": {
      "CustomTag": "LoanApp-2026-0001"
    },
    "OutputSettings": {
      "ExecutionTraceMode": "Compact"
    }
  }
}

Response

{
    "header": {
        "product": "ZeroTrain.Ai Core",
        "correlationId": "3908c90e-9b0a-45f5-bfb7-fc52e9304fb9",
        "customTag": "LoanApp-2026-0001",
        "createdUTC": "2026-02-16T22:24:11.3780483Z",
        "processingTime": "46.40 µs ⚡",
        "rowsEvaluated": 3,
        "resultCount": 1,
        "errorCount": 0,
        "warningCount": 0
    },
    "results": [
        {
            "modelName": "LoanApprovalModel",
            "decisionId": "L-001",
            "action": "Approve",
            "confidenceScore": 0.9515,
            "logicPassed": true,
            "logicTrace": [
                "R1",
                "C1:P",
                "C3:P"
            ]
        }
    ],
    "errors": [],
    "warnings": []
}

Insurance Claim Triage (CSV Model Source)

An insurance claim is evaluated using a routing model provided as CSV data within the request.

Request

{
  "InputSource": {
    "ClaimAmount": 18000,
    "PolicyAgeMonths": 36,
    "ClaimHistoryCount": 1,
    "FraudRiskScore": 0.18,
    "InjuryReported": true
  },
  "ModelSource": "ID,ClaimAmount,PolicyAgeMonths,ClaimHistoryCount,FraudRiskScore,Weight,IsEnabled,Action\nI-001,<= 20000,>= 24,<= 2,<= 0.25,0.9,true,AutoApprove\nI-002,<= 50000,>= 12,<= 3,<= 0.40,0.6,true,ManualReview\nI-003,> 50000,,> 3,> 0.40,0.3,true,Escalate",
  "Options": {
    "DataSettings": {
      "ActionColumnName": "Action",
      "PriorityColumnName": "ClaimAmount",
      "WeightColumnName": "Weight",
      "DecisionIdColumnName": "ID",
      "RowFilter": "IsEnabled = true",
      "ModelName": "InsuranceClaimTriage"
    },
    "ContextOptions": {
      "CustomTag": "Claim-2026-0042"
    },
    "OutputSettings": {
      "ExecutionTraceMode": "Compact"
    }
  }
}

Response

{
    "header": {
        "product": "ZeroTrain.Ai Core",
        "correlationId": "2dce00d8-9b7a-4e09-b333-b587215416b7",
        "customTag": "Claim-2026-0042",
        "createdUTC": "2026-02-16T22:39:24.9784103Z",
        "processingTime": "60.50 µs ⚡",
        "rowsEvaluated": 3,
        "resultCount": 1,
        "errorCount": 0,
        "warningCount": 0
    },
    "results": [
        {
            "modelName": "InsuranceClaimTriage",
            "decisionId": "I-002",
            "action": "ManualReview",
            "confidenceScore": 0.6241,
            "logicPassed": true,
            "logicTrace": [
                "R2",
                "C1:P",
                "C2:P",
                "C3:P",
                "C4:P"
            ]
        }
    ],
    "errors": [],
    "warnings": []
}

Supply Chain Routing (Base64 Model Source)

Shipment data is evaluated against a model transmitted as a Base64-encoded dataset, demonstrating transport flexibility.

Request

{
  "InputSource": {
    "InventoryLevel": 150,
    "DeliveryUrgency": 4
  },
  "ModelSource": "PERhdGFTZXQ+PFN1cHBseUNoYWluUm91dGluZ01vZGVsPjxJRD5TQy0wMDE8L0lEPjxJbnZlbnRvcnlMZXZlbD4yMDA8L0ludmVudG9yeUxldmVsPjxEZWxpdmVyeVVyZ2VuY3k+NDwvRGVsaXZlcnlVcmdlbmN5PjxXZWlnaHQ+MC45PC9XZWlnaHQ+PElzRW5hYmxlZD50cnVlPC9Jc0VuYWJsZWQ+PEFjdGlvbj5FeHBlZGl0ZTwvQWN0aW9uPjwvU3VwcGx5Q2hhaW5Sb3V0aW5nTW9kZWw+PFN1cHBseUNoYWluUm91dGluZ01vZGVsPjxJRD5TQy0wMDI8L0lEPjxJbnZlbnRvcnlMZXZlbD4xMDA8L0ludmVudG9yeUxldmVsPjxEZWxpdmVyeVVyZ2VuY3k+MjwvRGVsaXZlcnlVcmdlbmN5PjxXZWlnaHQ+MC42PC9XZWlnaHQ+PElzRW5hYmxlZD50cnVlPC9Jc0VuYWJsZWQ+PEFjdGlvbj5TdGFuZGFyZDwvQWN0aW9uPjwvU3VwcGx5Q2hhaW5Sb3V0aW5nTW9kZWw+PFN1cHBseUNoYWluUm91dGluZ01vZGVsPjxJRD5TQy0wMDM8L0lEPjxJbnZlbnRvcnlMZXZlbD41MDwvSW52ZW50b3J5TGV2ZWw+PERlbGl2ZXJ5VXJnZW5jeT4xPC9EZWxpdmVyeVVyZ2VuY3k+PFdlaWdodD4wLjM8L1dlaWdodD48SXNFbmFibGVkPmZhbHNlPC9Jc0VuYWJsZWQ+PEFjdGlvbj5Ib2xkPC9BY3Rpb24+PC9TdXBwbHlDaGFpblJvdXRpbmdNb2RlbD48L0RhdGFTZXQ+",
  "Options": {
    "DataSettings": {
      "ActionColumnName": "Action",
      "PriorityColumnName": "InventoryLevel",
      "WeightColumnName": "Weight",
      "DecisionIdColumnName": "ID",
      "RowFilter": "IsEnabled = true",
      "ModelName": "SupplyChainRoutingModel"
    }
  }
}

Response

{
    "header": {
        "product": "ZeroTrain.Ai Core",
        "correlationId": "b25799f7-079f-4df5-9d52-6002c4e60f94",
        "customTag": null,
        "createdUTC": "2026-02-16T22:24:33.1880961Z",
        "processingTime": "36.50 µs ⚡",
        "rowsEvaluated": 2,
        "resultCount": 1,
        "errorCount": 0,
        "warningCount": 0
    },
    "results": [
        {
            "modelName": "SupplyChainRoutingModel",
            "decisionId": "SC-001",
            "action": "Expedite",
            "confidenceScore": 0.875,
            "logicPassed": null,
            "logicTrace": []
        }
    ],
    "errors": [],
    "warnings": []
}

Trading Decision Engine (Numeric Model Source)

Market data is submitted to ZeroTrain and evaluated against a structured numeric trading model defined inline within the request.

Request

{
  "InputSource": {
    "LastPrice": 102.45,
    "Volume": 1500000,
    "VolatilityIndex": 22.8,
    "MovingAverageSpread": 1.35
  },
  "ModelSource": {
    "resultsets": {
      "TradingRules": [
        {
          "ID": "TR-001",
          "VolatilityIndex": ">= 20",
          "MovingAverageSpread": ">= 1.0",
          "Weight": 0.8,
          "IsEnabled": true,
          "Action": "Buy"
        },
        {
          "ID": "TR-002",
          "VolatilityIndex": "< 20",
          "MovingAverageSpread": "< 0",
          "Weight": 0.6,
          "IsEnabled": true,
          "Action": "Sell"
        },
        {
          "ID": "TR-003",
          "Weight": 0.2,
          "IsEnabled": true,
          "Action": "Hold"
        }
      ]
    }
  },
  "Options": {
    "DataSettings": {
      "ActionColumnName": "Action",
      "PriorityColumnName": "VolatilityIndex",
      "WeightColumnName": "Weight",
      "DecisionIdColumnName": "ID",
      "RowFilter": "IsEnabled = true",
      "ModelName": "TradingDecisionModel"
    },
    "ContextOptions": {
      "CustomTag": "Trade-Session-Alpha"
    },
    "OutputSettings": {
      "ExecutionTraceMode": "Compact"
    }
  }
}

Response

{
    "header": {
        "product": "ZeroTrain.Ai Core",
        "correlationId": "9a0c41e6-5bc8-4595-83f3-7b47dd495d54",
        "customTag": "Trade-Session-Alpha",
        "createdUTC": "2026-02-16T22:24:56.946648Z",
        "processingTime": "39.40 µs ⚡",
        "rowsEvaluated": 2,
        "resultCount": 1,
        "errorCount": 0,
        "warningCount": 0
    },
    "results": [
        {
            "modelName": "TradingDecisionModel",
            "decisionId": "TR-001",
            "action": "Buy",
            "confidenceScore": 0.8711,
            "logicPassed": true,
            "logicTrace": [
                "R1",
                "C3:P",
                "C4:P"
            ]
        }
    ],
    "errors": [],
    "warnings": []
}