@adcp/sdk API Reference - v7.9.0
    Preparing search index...

    Type Alias RetryDecision

    RetryDecision:
        | {
            action: "retry";
            delayMs: number;
            attemptCap: number;
            sameIdempotencyKey: true;
            reason: string;
        }
        | {
            action: "mutate-and-retry";
            delayMs: number;
            attemptCap: number;
            sameIdempotencyKey: false;
            reason: | "redirect"
            | "budget"
            | "requote"
            | "validation"
            | "capability"
            | "state";
            field?: string;
            suggestion?: string;
        }
        | {
            action: "escalate";
            reason: | "commercial"
            | "auth"
            | "governance_unreachable"
            | "idempotency_check_required"
            | "terminal"
            | "attempts_exhausted"
            | "unknown";
            message: string;
        }

    What the buyer agent should do next. Discriminated by action.

    • retry: replay with the SAME idempotency_key after delayMs. Use for server-side transients (RATE_LIMITED, SERVICE_UNAVAILABLE, CONFLICT).
    • mutate-and-retry: apply the seller's correction hint (read error.field / error.suggestion), then call again with a FRESH idempotency_key because the payload is now semantically different.
    • escalate: stop the agent loop and surface to a human. Includes commercial-relationship signals, auth failures, terminal errors, attempt-cap exhaustion, and unknown vendor codes.

    Type Declaration

    • {
          action: "retry";
          delayMs: number;
          attemptCap: number;
          sameIdempotencyKey: true;
          reason: string;
      }
      • action: "retry"
      • delayMs: number

        Delay before the retry, in milliseconds. Honors error.retry_after when present.

      • attemptCap: number

        Maximum attempts (including the original) before escalating.

      • sameIdempotencyKey: true

        Caller MUST replay with the same idempotency_key.

      • reason: string
    • {
          action: "mutate-and-retry";
          delayMs: number;
          attemptCap: number;
          sameIdempotencyKey: false;
          reason:
              | "redirect"
              | "budget"
              | "requote"
              | "validation"
              | "capability"
              | "state";
          field?: string;
          suggestion?: string;
      }
      • action: "mutate-and-retry"
      • delayMs: number

        Suggested pre-retry delay in milliseconds. Lightweight jitter so fleet operators don't all hit the seller in the same instant after a correlated storm (e.g., PROPOSAL_EXPIRED across thousands of campaigns at once).

      • attemptCap: number

        Maximum attempts (including the original) before escalating.

      • sameIdempotencyKey: false

        Caller MUST mint a fresh idempotency_key because the payload changes.

      • reason: "redirect" | "budget" | "requote" | "validation" | "capability" | "state"
      • Optionalfield?: string

        The field the seller flagged. Mirrors error.field.

      • Optionalsuggestion?: string

        The seller's correction hint. Mirrors error.suggestion.

    • {
          action: "escalate";
          reason:
              | "commercial"
              | "auth"
              | "governance_unreachable"
              | "idempotency_check_required"
              | "terminal"
              | "attempts_exhausted"
              | "unknown";
          message: string;
      }
      • action: "escalate"
      • reason:
            | "commercial"
            | "auth"
            | "governance_unreachable"
            | "idempotency_check_required"
            | "terminal"
            | "attempts_exhausted"
            | "unknown"
      • message: string

        Human-facing message. Mirrors error.message.