Quickstart

Quickstart (SDK)

가장 빠른 시작 방법입니다. `sapper-ai` 하나만 설치하고 `createGuard()`로 tool-call 입력을 검사하세요.

3줄 연동

`createGuard()` + `guard.check()`로 즉시 적용

프리셋 정책

monitor/standard/strict/paranoid 등 프리셋 제공

1) 설치

npm 또는 pnpm 중 하나를 사용하세요.

Install

npm install sapper-ai
# or
pnpm install sapper-ai

2) (선택) 정책 파일 생성

`npx sapper-ai init`는 `sapperai.config.yaml`을 생성합니다. (프리셋/임계치/감사로그 경로 등)

Init Wizard

npx sapper-ai init

sapperai.config.yaml (example)

mode: enforce
defaultAction: allow
failOpen: true

detectors:
  - rules

thresholds:
  riskThreshold: 0.7
  blockMinConfidence: 0.5

3) tool-call 입력 검사

차단 결과(`action: block`)면 실행을 중단하거나 에러를 던지는 식으로 연결하세요.

SDK Usage

import { createGuard } from 'sapper-ai'

const guard = createGuard('standard')

const decision = await guard.check({ toolName: 'shell', arguments: { cmd: 'ls' } })

if (decision.action === 'block') {
  throw new Error(`Blocked: ${decision.reasons.join(', ')}`)
}