Agent Armor API Reference
    Preparing search index...

    Class AgentArmor

    Index
    • get mlActive(): boolean

      True when an ML classifier is loaded and will run on scan() and the other async methods.

      Returns boolean

    • get patternVersion(): string

      Get the current pattern database version.

      Returns string

    • Pre-execution action gate (#57). Check a proposed agent action against the configured allowedActions allowlist and return a deterministic verdict.

      This is the positive-allowlist complement to the deny-list detector pipeline: it admits only explicitly permitted actions and fails closed on everything else, independent of any detector confidence threshold. With no allowedActions configured, every action is denied.

      Parameters

      Returns ActionVerdict

      const armor = AgentArmor.regexOnly({
      allowedActions: [{ tool: 'http.get', hosts: ['api.internal.example.com'] }],
      });
      const verdict = armor.checkAction({ tool: 'http.post', args: { url: '...' } });
      if (!verdict.admissible) throw new ActionBlockedError(verdict.reason);
    • Scan a multi-turn conversation for agent traps (sync).

      Each turn is scanned independently (turns), and the recent turns are also scanned for cross-turn split payloads (crossTurnThreats). Cross-turn semantic accumulation is reserved for the ML classifier (see session.accumulation) and is inactive here.

      Parameters

      Returns SessionScanResult

    • Fetch the latest patterns from a remote URL and validate them. URL is required: there is no default endpoint. It must be https (http is allowed for localhost only), redirects must stay on https, and the body is capped at 2 MiB. Throws PatternValidationError if the database is unsafe to load; see validatePatternDatabase for the checks. Load the result with loadPatterns; nothing changes until you do.

      Parameters

      • url: string

      Returns Promise<PatternDatabase>