Skip to main content

Quickstart: replay() Governance

Get replay() running in under 5 minutes with the primary public path: zero-config governance plus Governance Studio.


Prerequisites

  • Node.js 20+
  • An OpenAI or Anthropic API key
  • npm or yarn

1. Install

npm install vesanor <provider-sdk>

Anthropic works too. Install @anthropic-ai/sdk instead of openai and pass an Anthropic client. The SDK detects the provider automatically.


2. Wrap your client

The fastest path needs no local contracts and no local YAML:

import OpenAI from "openai";
import { replay } from "vesanor";

const client = new OpenAI();

const session = replay(client, {
apiKey: process.env.VESANOR_API_KEY,
agent: "orders-bot",
});

const response = await session.client.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: "Process this order" }],
tools: myToolDefinitions,
});

That is enough to start the zero-config governance flow.


3. Open Governance Studio

Run your app. Then open Governance Studio and review:

  • the workspace draft
  • open judgments
  • impact preview
  • approval preview

Approval is the Studio-side authority boundary for the browser path.


4. Approve

After approval:

  • development keeps behavior non-blocking
  • staging evaluates in advisory mode
  • production enforces protectively and fails closed when governance is unavailable

That is the main public runtime path.


What just happened

When you called session.client.chat.completions.create(), the zero-config governance flow ran:

  1. Lookupreplay() looked up governance state for the agent/environment
  2. Attach behavior — the SDK chose monitor/protect/govern behavior based on environment and approved-plan state
  3. Capture — request, response, tool definitions, and usage were buffered for upload
  4. Review — the hosted side built or updated review state for Studio
  5. Enforce after approval — when an approved compiled artifact exists, the SDK rehydrates it and applies the corresponding runtime behavior

What to add next

FeatureWhat it doesGuide
Approval modelUnderstand what Studio approval freezes and what runtime attaches toApproval Model
Runtime statesUnderstand attachment, degraded state, and fail-closed behaviorRuntime States
Kill switchEmergency stop for runaway agentsKill Switch
Server-backed stateDurable governed sessions with stronger evidence on the wrapped pathGovern Mode
Operations runbookPractical responses for common states and failuresOperations Playbook

Archived local-pack path

If you explicitly need local YAML packs, hand-authored contract packs, or recorded local workflows, use the archived docs under docs/legacy/advanced-local/ in the repo.


Next steps