Skip to content

Quick Start ​

Get your first governed execution running in under 5 minutes.

1. Create an account ​

Sign up at stellrai.com. Your API key is shown once on the onboarding screen — copy it now.

2. Install the SDK ​

Package: @hybridb/sdk on npm

bash
npm install @hybridb/sdk
bash
yarn add @hybridb/sdk
bash
pnpm add @hybridb/sdk

3. Initialise the client ​

typescript
import { HybriDBClient } from '@hybridb/sdk';

const hdb = new HybriDBClient({
  baseUrl: 'https://hybridb.stellrai.com',
  apiKey:  process.env.HDB_API_KEY!,
});

Store your API key in an environment variable. Never hardcode it or expose it in client-side code.

4. Request a decision ​

Before any governed action runs, request a decision. The policy engine evaluates your rules and returns approved, blocked, or escalated.

typescript
const decision = await hdb.requestDecision({
  decisionType: 'payment.authorize',
  action:       'payment.initiate',
  inputData: {
    actorId:  'user:alice',
    amount:   15000,
    currency: 'USD',
  },
});

if (decision.outcome !== 'approved') {
  // Policy blocked — do not proceed
  throw new Error(`Blocked: ${decision.rationale}`);
}

5. Trigger a pipeline ​

Pass the decisionId when triggering a pipeline. Stellrai enforces that a valid approved decision exists before execution starts.

typescript
const execution = await hdb.triggerPipelineByName('payment.execute.standard', {
  decisionId: decision.decisionId,
  input: {
    amount: 15000,
    to:     'acct_9k2x',
  },
});

console.log(execution.id);     // exec_abc123
console.log(execution.status); // 'completed'

6. Roll back if needed ​

Every execution is reversible within its rollback window (default: 30 minutes).

typescript
await hdb.reversibility.rollback(execution.id, {
  reason: 'user_request',
});

What just happened ​

Behind the scenes Stellrai ran the full governance loop automatically:

StepWhat happened
Policy checkYour rules were evaluated against the input data
Decision issuedapproved result stored with full rationale
Execution checkpointedEvery pipeline step was traced and saved
Audit entry writtenImmutable log entry created — actor, action, outcome
Rollback armedCompensation handlers registered, reversible for 30 min

Next steps ​

hybriDB is the kernel inside Stellrai.