Skip to main content

Govern Your Agent in 5 Minutes

Get from zero to a governed agent intent in under five minutes. This quickstart walks you through installation, initialization, and your first governed action with Vienna OS.

Vienna OS supports any framework that can make HTTP requests. This guide shows JavaScript/TypeScript and Python examples, plus framework integrations for LangChain, CrewAI, and OpenAI function calling.

1Install

Install the Vienna OS SDK for your language. Choose JavaScript/Node.js or Python:

Node.js / JavaScriptbash
npm install vienna-os
Pythonbash
pip install vienna-os

2Initialize

Get your API key from console.regulator.ai → API Keys and initialize the Vienna client:

JavaScript / TypeScriptjavascript
import { ViennaClient } from 'vienna-os';

const vienna = new ViennaClient({
  apiKey: process.env.VIENNA_API_KEY, // Get from console.regulator.ai → API Keys
});
Pythonpython
from vienna_os import ViennaClient
import os

vienna = ViennaClient(
    api_key=os.environ['VIENNA_API_KEY']  # Get from console.regulator.ai → API Keys
)

3Govern an Action

Before your agent acts, check with Vienna. The governance pipeline will evaluate policies, handle approvals if needed, and issue execution warrants:

JavaScript / TypeScriptjavascript
// Before your agent acts, submit an intent
const result = await vienna.submitIntent({
  action: 'deploy_to_production',
  payload: { 
    service: 'api-gateway',
    version: '2.4.1',
    environment: 'production' 
  }
});

if (result.pipeline === 'executed') {
  // Auto-approved and executed
  console.log('Deployed:', result.execution_id);
  console.log('Warrant:', result.warrant?.id);
} else if (result.pipeline === 'pending_approval') {
  // Requires human approval
  console.log('Awaiting approval:', result.proposal_id);
} else if (result.pipeline === 'denied') {
  // Blocked by policy
  console.error('Denied:', result.reason);
}
Pythonpython
# Before your agent acts, submit an intent
result = vienna.submit_intent(
    action='deploy_to_production',
    payload={
        'service': 'api-gateway',
        'version': '2.4.1',
        'environment': 'production'
    }
)

if result.pipeline == 'executed':
    # Auto-approved and executed
    print(f"Deployed: {result.execution_id}")
    print(f"Warrant: {result.warrant.id if result.warrant else None}")
elif result.pipeline == 'pending_approval':
    # Requires human approval
    print(f"Awaiting approval: {result.proposal_id}")
elif result.pipeline == 'denied':
    # Blocked by policy
    print(f"Denied: {result.reason}")

4Handle Errors

Always wrap Vienna calls in error handling. Common errors include authentication failures, rate limits, and network issues:

JavaScript Error Handlingjavascript
try {
  const result = await vienna.submitIntent({
    action: 'deploy_to_production',
    payload: { service: 'api-gateway', version: '2.4.1' }
  });

  if (result.pipeline === 'executed') {
    console.log('Deployed:', result.execution_id);
  } else if (result.pipeline === 'pending_approval') {
    console.log('Awaiting approval:', result.proposal_id);
  } else if (result.pipeline === 'denied') {
    console.error('Denied:', result.reason);
  }
} catch (error) {
  if (error.code === 'UNAUTHORIZED') {
    console.error('Invalid API key. Get one from console.regulator.ai → API Keys');
  } else if (error.code === 'RATE_LIMITED') {
    console.error('Rate limit exceeded. Retry in', error.retryAfter, 'seconds');
  } else if (error.code === 'NETWORK_ERROR') {
    console.error('Network error. Check your connection.');
  } else {
    console.error('Vienna error:', error.message);
  }
}
Python Error Handlingpython
from vienna_os import ViennaClient, ViennaError, UnauthorizedError, RateLimitError

try:
    result = vienna.submit_intent(
        action='deploy_to_production',
        payload={'service': 'api-gateway', 'version': '2.4.1'}
    )

    if result.pipeline == 'executed':
        print(f"Deployed: {result.execution_id}")
    elif result.pipeline == 'pending_approval':
        print(f"Awaiting approval: {result.proposal_id}")
    elif result.pipeline == 'denied':
        print(f"Denied: {result.reason}")

except UnauthorizedError:
    print("Invalid API key. Get one from console.regulator.ai → API Keys")
except RateLimitError as e:
    print(f"Rate limit exceeded. Retry in {e.retry_after} seconds")
except ViennaError as e:
    print(f"Vienna error: {e.message}")
Common Errors:
  • UNAUTHORIZED — Invalid or missing API key
  • RATE_LIMITED — Too many requests (5000/15min default)
  • NETWORK_ERROR — Connection timeout or DNS failure
  • INVALID_REQUEST — Missing required fields (action, payload)

5See It Live

Check the Vienna OS console to see your governance events, audit trail, and agent activity:

Console Dashboard

Open Console
Real-time governance events and decisions
Complete audit trail for compliance
Agent fleet management and trust scoring
Policy configuration and testing

Framework Integrations

Vienna OS integrates seamlessly with popular AI frameworks. Here's how to add governance to your existing agents:

LangChain

Add Vienna governance as a callback handler to automatically govern every LLM call:

LangChain Integrationpython
from vienna_os import ViennaGovernance

# Add as a callback handler
chain = LLMChain(
    llm=ChatOpenAI(),
    callbacks=[ViennaGovernance(api_key="vos_...")]
)
# Every LLM call is now governed

CrewAI

Govern CrewAI agent actions automatically:

CrewAI Integrationpython
from vienna_os.crewai import ViennaCrewGovernance

crew = Crew(
    agents=[researcher, writer],
    governance=ViennaCrewGovernance(api_key="vos_...")
)
# Agent actions governed automatically

OpenAI Function Calling

Wrap your function calls with Vienna governance:

OpenAI Function Callingjavascript
import { ViennaClient } from 'vienna-os';
const vienna = new ViennaClient({ 
  apiKey: 'vos_...',
  agentId: 'openai-agent',
  baseUrl: 'https://console.regulator.ai'
});

// Submit intent before each function call
const result = await vienna.submitIntent({
  action: 'call_function',
  payload: { function: 'transfer_funds', args: {...} }
});
// Use result.warrant to prove authorization
That's it! In 4 steps you've added enterprise-grade governance to your AI agent. Every action is now policy-evaluated, audited, and potentially approved before execution. Your agent can't go rogue or make unauthorized changes.