Configuration

Complete reference for SentinelConfig and all nested configuration types

4 min read

Configuration

SentinelConfig is the top-level configuration object passed to Sentinel.create(). All fields use readonly for immutability. Once created, the config is deep-frozen.

SentinelConfig

typescript
interface SentinelConfig {
  mode?: SentinelMode            // default: 'full'
  promptGuard?: PromptGuardConfig
  executionSandbox?: ExecutionSandboxConfig
  debug?: boolean
}
FieldTypeDefaultDescription
modeSentinelMode'full'Pipeline mode
promptGuardPromptGuardConfig?Guard config; omit to disable
executionSandboxExecutionSandboxConfig?Sandbox config; omit to disable
debugboolean?falseEnable verbose logging

SentinelMode

typescript
type SentinelMode = 'full' | 'guard-only' | 'sandbox-only'

PromptGuardConfig

typescript
interface PromptGuardConfig {
  mode: ScanMode
  llm?: LLMJudgeConfig
  rules?: RuleEngineConfig
  enabled?: boolean
}
FieldTypeDefaultDescription
modeScanModerequired'rules', 'llm', or 'both'
llmLLMJudgeConfig?Required when mode is 'llm' or 'both'
rulesRuleEngineConfig?Optional rule engine config
enabledboolean?trueSet to false to disable at runtime

LLMJudgeConfig

typescript
interface LLMJudgeConfig {
  provider: LLMProvider
  model?: string
  apiKey?: string
  apiKeyEnvVar?: string
  baseUrl?: string
  timeoutMs?: number
  customPrompt?: string
}
FieldTypeDefaultDescription
providerLLMProviderrequired'anthropic', 'openai', or 'custom'
modelstring?'claude-haiku-4-5'Model ID override
apiKeystring?Inline API key (prefer apiKeyEnvVar)
apiKeyEnvVarstring?Name of the env var containing the API key
baseUrlstring?Custom base URL (for 'custom' provider)
timeoutMsnumber?5000LLM call timeout in milliseconds
customPromptstring?Replace the built-in security prompt

RuleEngineConfig

typescript
interface RuleEngineConfig {
  rulePacks?: string[]
  customRulesPath?: string
}
FieldTypeDescription
rulePacksstring[]?Built-in pack names (e.g., ['default'])
customRulesPathstring?Path to a custom YAML rules file

ExecutionSandboxConfig

typescript
interface ExecutionSandboxConfig {
  rpcEndpoint: string
  policy: PolicyConfig
  enabled?: boolean
}
FieldTypeDefaultDescription
rpcEndpointstringrequiredSolana RPC URL
policyPolicyConfigrequiredTransaction policy
enabledboolean?trueSet to false to disable at runtime

PolicyConfig

typescript
interface PolicyConfig {
  spendingLimits: SpendingLimits
  programAllowlist?: string[]
  recipientBlocklist?: string[]
  timeBounds?: TimeBoundConfig
  cooldown?: CooldownConfig
  rateLimit?: { maxTxPerHour: number }
  riskThreshold?: number
}
FieldTypeDefaultDescription
spendingLimitsSpendingLimitsrequiredPer-tx, daily, and weekly SOL limits
programAllowliststring[]?If set, only these program IDs are allowed
recipientBlockliststring[]?Block transfers to these addresses
timeBoundsTimeBoundConfig?Restrict to certain hours/days
cooldownCooldownConfig?Minimum ms between transactions
rateLimitobject?Max transactions per hour
riskThresholdnumber?70Block if risk score exceeds this value (0–100)

SpendingLimits

typescript
interface SpendingLimits {
  maxPerTx: number
  maxDaily: number
  maxWeekly: number
}

All values are in SOL.

TimeBoundConfig

typescript
interface TimeBoundConfig {
  activeHours?: { start: string; end: string }  // 'HH:MM' format
  activeDays?: number[]                          // 0=Sunday, 6=Saturday
  timezone?: string                              // IANA timezone
}

CooldownConfig

typescript
interface CooldownConfig {
  minMs: number
}

Complete Example

typescript
const sentinel = await Sentinel.create({
  mode: 'full',
  debug: false,

  promptGuard: {
    mode: 'both',
    rules: {
      rulePacks: ['default'],
      customRulesPath: './rules/custom.yaml',
    },
    llm: {
      provider: 'anthropic',
      apiKeyEnvVar: 'ANTHROPIC_API_KEY',
      model: 'claude-haiku-4-5',
      timeoutMs: 4000,
    },
  },

  executionSandbox: {
    rpcEndpoint: process.env.SOLANA_RPC_URL!,
    policy: {
      spendingLimits: {
        maxPerTx: 5,
        maxDaily: 50,
        maxWeekly: 200,
      },
      programAllowlist: [
        'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA',
        'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJe1bAe',
      ],
      timeBounds: {
        activeHours: { start: '08:00', end: '20:00' },
        activeDays: [1, 2, 3, 4, 5],
        timezone: 'America/New_York',
      },
      cooldown: { minMs: 2000 },
      rateLimit: { maxTxPerHour: 30 },
      riskThreshold: 65,
    },
  },
});