Skip to content

Errors ​

Every error the SDK throws means the protected action did not run. All of them extend AithorizedError, which has a code and, when a request was created, a requestId. Their messages are written to be handed back to the model as-is.

ClasscodeWhenExtra fields
AithorizedRejectedErrorREJECTEDA human rejected it.feedback: what the reviewer wrote, for the agent to act on.
AithorizedExpiredErrorEXPIREDNobody decided before the time limit.
AithorizedDeniedErrorDENIEDA DENY rule matched (locally, before any request).ruleId
AithorizedKillSwitchErrorKILL_SWITCH_ACTIVEThe kill switch is on for this workspace, agent or session.
AithorizedCircuitBrokenErrorCIRCUIT_BROKENThe agent is frozen by the circuit breaker; a human must unfreeze it.
AithorizedSuspendedErrorTENANT_SUSPENDEDThe workspace is suspended by the service.
AithorizedVerificationErrorVERIFICATION_FAILEDThe signed decision did not check out (signature, key directory, hashes, approver count or an edit outside the allowed fields).check: which check failed.
AithorizedHttpErrorthe API's codeAny other API error, after retries.status, errorBody
ts
import { AithorizedRejectedError, AithorizedError } from '@aithorized/sdk';

try {
  await refund({ charge: 'ch_1', amount: 45000 });
} catch (err) {
  if (err instanceof AithorizedRejectedError) return `Refund refused: ${err.feedback}`;
  if (err instanceof AithorizedError) return err.message; // fixed, model-readable text
  throw err;
}

Retries ​

Creating a request is retried a few times on network errors and 5xx, always with the same idempotency key, so a retry never creates a second request. isRetryableCreateError(err) tells you whether an error belongs to that class.

The policy engine, MCP proxy, SDK and hook are MIT-licensed.