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.
1Install
Install the Vienna OS SDK for your language. Choose JavaScript/Node.js or Python:
npm install vienna-ospip install vienna-os2Initialize
Get your API key from console.regulator.ai → API Keys and initialize the Vienna client:
import { ViennaClient } from 'vienna-os';
const vienna = new ViennaClient({
apiKey: process.env.VIENNA_API_KEY, // Get from console.regulator.ai → API Keys
});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:
// 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);
}# 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:
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);
}
}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}")UNAUTHORIZED— Invalid or missing API keyRATE_LIMITED— Too many requests (5000/15min default)NETWORK_ERROR— Connection timeout or DNS failureINVALID_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 ConsoleFramework 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:
from vienna_os import ViennaGovernance
# Add as a callback handler
chain = LLMChain(
llm=ChatOpenAI(),
callbacks=[ViennaGovernance(api_key="vos_...")]
)
# Every LLM call is now governedCrewAI
Govern CrewAI agent actions automatically:
from vienna_os.crewai import ViennaCrewGovernance
crew = Crew(
agents=[researcher, writer],
governance=ViennaCrewGovernance(api_key="vos_...")
)
# Agent actions governed automaticallyOpenAI Function Calling
Wrap your function calls with Vienna governance:
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