SDK

JavaScript SDK

Resolve behavior, write traces and feedback, and preserve exact revision identity from application code with typed runtime errors.

EXECUTION BOUNDARY

The SDK is a client for Vira runtime/control APIs. It does not calculate behavior authority locally; resolve returns the exact identity the application must carry forward.

IDENTITY PRESERVED

Keep the behavior identity attached to the host framework.

  • project/application/environment
  • Behavior Point
  • traceId
  • profileId and exact revision
  • idempotency key

SUPPORTED OPERATIONS

Use Vira where the control boundary actually belongs.

  1. 01

    resolve governed behavior

  2. 02

    write runtime traces

  3. 03

    submit feedback/outcomes

  4. 04

    surface typed API errors

  5. 05

    reuse stable idempotency keys across retries

IMPLEMENTATION HOOK

Keep the host runtime native.

This example mirrors the repository documentation. The exact API contract remains in Docs and source.

import { ViraClient } from "@vira-behavior/sdk";
const vira = new ViraClient({
  baseUrl: process.env.VIRA_API_URL!,
  apiKey: process.env.VIRA_API_KEY!,
  failureMode: "open",
});

SECURITY BOUNDARY

Integration does not equal authority.

Boundary

Runtime keys are scoped to project, application, environment, and capability.

Boundary

Provider keys and control-plane credentials remain server-side.

LIMITATIONS

State what the adapter does not control.

  • Clients must not calculate or substitute behavior revisions.
  • Retry only appropriate transport/5xx failures with the same idempotency key.
  • Runtime keys cannot publish control-plane state.

Use the integration guide for the exact runtime contract.