Python SDK for OmegaEngine — Decision infrastructure for autonomous AI
Project description
OmegaEngine Python SDK
Decision infrastructure for autonomous AI.
OmegaEngine evaluates whether AI-generated actions should be allowed to execute. This SDK provides a Python client for OmegaEngine authorization and decision APIs.
Installation
pip install omegaengine
PyPI release in progress — if the command above doesn't resolve yet, install from source:
pip install "git+https://github.com/TheArkhitect/Omegaengine.git#subdirectory=sdk/python"
Quick Start
from omegaengine import OmegaClient
client = OmegaClient.create(
api_key="your-api-key",
base_url="https://omegaengine.ai",
)
# Authorize execution before side effects (recommended first path)
authz = client.authorize(
agent_id="sales-agent",
action="send_email",
vendor="SendGrid",
amount=0,
)
print("Authorize decision:", authz["decision"])
# Stateful authorization session (start -> step -> end)
session = client.authorize_session_start(
agent_id="sales-agent",
metadata={"runId": "run-42"},
)
session_id = session["session"]["session_id"]
step = client.authorize_session_step(
session_id=session_id,
action="send_email",
vendor="SendGrid",
)
client.authorize_session_end(
session_id=session_id,
reason="workflow complete",
)
# Advanced: full scenario judgment (v2/judge)
decision = client.judge(
"AI agent wants to send a $5,000 wire transfer to a new vendor",
context="First-time vendor, no previous transactions",
domain="FINANCIAL",
risk_tolerance="low",
)
judge = decision.get("judge", {})
if judge.get("riskLevel") == "HIGH" or judge.get("needsHumanReview"):
print(f"⚠️ Escalating: {judge.get('summary')}")
API Reference
client.authorize(**kwargs)
Authorize an agent action before it executes (POST /api/authorize).
authz = client.authorize(
agent_id="payments-agent",
action="wire_transfer",
amount=25000,
vendor="acme-bank",
risk_level="high",
metadata={"ticket": "finops-4421"},
)
print(authz["decision"], authz["audit_id"])
client.authorize_session_start(**kwargs)
Start a stateful authorization session (POST /api/authorize/session/start).
client.authorize_session_step(**kwargs)
Authorize a step within a session (POST /api/authorize/session/step).
client.authorize_session_end(**kwargs)
Finalize a session and return summary (POST /api/authorize/session/end).
client.judge(scenario, **kwargs)
Advanced method — evaluates a scenario through the full v2/judge decision pipeline.
result = client.judge(
"Transfer $50,000 to vendor",
context="Quarterly payroll processing",
risk_tolerance="low",
domain="finance",
metadata={"dept": "HR", "amount": 50000},
agent_name="payroll-bot",
)
Parameters:
| Parameter | Type | Description |
|---|---|---|
scenario |
str |
The scenario to evaluate (required) |
context |
str |
Additional context |
risk_tolerance |
str |
"low", "medium", or "high" |
domain |
str |
Domain classification |
metadata |
dict |
Arbitrary metadata |
agent_name |
str |
Name of the AI agent |
client_tag |
str |
Client identifier |
privacy_mode |
bool |
Enable privacy-preserving mode |
trace_id |
str |
External trace ID for correlation |
client.feedback(request_id, **kwargs)
Submit feedback on a previous decision for RLHF.
client.feedback(
"req-abc123",
verdict="accurate",
rating=5,
comment="Decision was correct",
)
client.verify(request_id)
Verify the cryptographic proof chain for a decision.
result = client.verify("req-abc123")
print("Valid:", result["valid"])
client.health()
Check API health status.
status = client.health()
print("Status:", status["status"])
Error Handling
The SDK provides typed exceptions for common error scenarios:
from omegaengine import (
OmegaError,
OmegaAuthError,
OmegaRateLimitError,
OmegaSafetyBlockError,
)
try:
result = client.judge("scenario")
except OmegaSafetyBlockError as e:
print(f"Blocked by safety: {e.violations}")
except OmegaRateLimitError as e:
print(f"Rate limited. Retry after: {e.retry_after}s")
except OmegaAuthError:
print("Invalid API key")
except OmegaError as e:
print(f"API error ({e.status_code}): {e}")
Configuration
from omegaengine import OmegaClient, OmegaClientOptions
client = OmegaClient(OmegaClientOptions(
api_key="your-key",
base_url="http://localhost:3000", # Custom endpoint
admin_key="admin-key", # For admin operations
max_retries=3, # Retry count (default: 2)
timeout_sec=15.0, # Request timeout (default: 10s)
))
TypeScript SDK Parity
This Python SDK mirrors the TypeScript SDK API:
| TypeScript | Python |
|---|---|
client.authorize({agent_id, action}) |
client.authorize(agent_id=..., action=...) |
client.judge({scenario}) |
client.judge(scenario) |
client.feedback({requestId, verdict}) |
client.feedback(request_id, verdict=verdict) |
client.verify(requestId) |
client.verify(request_id) |
License
Apache-2.0 — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file omegaengine-2.5.0.tar.gz.
File metadata
- Download URL: omegaengine-2.5.0.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7d053dd4a5ea52e4583a6fa5efb0e69bcbfe292efaec98e4deeacc4bd8f753a
|
|
| MD5 |
42233535fd97ff0c30e326beac1f4d52
|
|
| BLAKE2b-256 |
c6a4c78b98281c5d19ad52a636cbd16d6a3a4c38fe22c7c4874f4a00cf51cb78
|
File details
Details for the file omegaengine-2.5.0-py3-none-any.whl.
File metadata
- Download URL: omegaengine-2.5.0-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9b1ff0f3091b6bca167ed4e8f5ba0fb32e0721b010ca418e646f2991205736b
|
|
| MD5 |
add09f58e8655e4321d1fa11dc105e1b
|
|
| BLAKE2b-256 |
fcf9773d1fbfc86fd9e743987c180e499f19f227449770adad110b4110256a1e
|