Installation

Add Sentinel SDK to your TypeScript project

2 min read

Installation

Requirements

  • Node.js >=20.0.0
  • TypeScript >=5.7

Install the Core Package

bash
npm install @sentinel-sdk/core
bash
pnpm add @sentinel-sdk/core
bash
yarn add @sentinel-sdk/core

Install the CLI (optional)

The CLI lets you scan inputs and simulate transactions from the terminal without writing code.

bash
npm install -g @sentinel-sdk/cli

Verify the installation:

bash
sentinel --version

Peer Dependencies

@sentinel-sdk/core has no required peer dependencies. The LLM judge feature requires an API key for your chosen provider (Anthropic, OpenAI, or a custom endpoint), which you supply via config — not as an npm dependency.

TypeScript Configuration

Sentinel is written with strict TypeScript and ships full .d.ts types. No additional @types packages are needed.

Ensure your tsconfig.json includes:

json
{
  "compilerOptions": {
    "target": "ES2020",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "strict": true
  }
}

Environment Variables

If you configure the LLM judge via apiKeyEnvVar, set the corresponding variable before running your agent:

bash
# For Anthropic
export ANTHROPIC_API_KEY=sk-ant-...

# For OpenAI
export OPENAI_API_KEY=sk-...

Prefer apiKeyEnvVar over apiKey

Use apiKeyEnvVar in your SentinelConfig rather than inlining the API key. This keeps credentials out of source code and lets you rotate keys without redeploying.

Verify Installation

typescript
import { Sentinel } from '@sentinel-sdk/core';

const sentinel = await Sentinel.create({
  mode: 'guard-only',
  promptGuard: {
    mode: 'rules',
  },
});

const result = await sentinel.scanInput('hello world');
console.log(result.safe); // true

Next Steps