Skip to content

The TypeScript toolkit for System One.

Add structured decisions to your Agent with one evaluate() call. Define choices, scoring rubrics, and yes/no questions, then use typed answers directly in your code.

Open source · TypeScript · Node.js & Cloudflare Workers

Install the SDK
npm install @system-one-ai/sdk@0.5.3
decision.ts
import { SystemOne, choice } from '@system-one-ai/sdk';const client = new SystemOne({  baseURL: process.env.SYSTEM_ONE_BASE_URL!,  apiKey: process.env.SYSTEM_ONE_API_KEY!,  maxRetries: 0,});const result = await client.evaluate({  state: { message: 'I was charged twice.' },  questions: {    team: choice('Who should handle this?', {      billing: 'Payments and refunds',      support: 'Technical issues',    }),  },});result.answers.team.choice; // 'billing' | 'support'

Connect a model service

Set the endpoint and API key for your chosen service. Use System One API, connect directly to TypeSafe, or configure an adapter. Keep credentials in your server environment.

SDK documentation
.env
SYSTEM_ONE_BASE_URL=https://api.typesafe.ai/v1SYSTEM_ONE_API_KEY=YOUR_TYPESAFE_API_KEY

One interface for structured decisions

Types from question to answer

Choice results retain your option names as TypeScript literal types. Scores and yes/no probabilities return as numbers.

Connect your provider

Use System One API or TypeSafe directly. Optional OpenRouter and Vercel AI SDK adapters connect other supported model services.

Control request behavior

Configure timeouts and retries, cancel with AbortSignal, and handle typed errors in your application.

Connect to System One API

Use your System One API key to call the hosted service. Test inputs in the Playground and review request usage in the console.