Atrium SDK — an AI runtime for governed systems. Governance visible (PII redaction, policy decisions, audit IDs, cost) on every call.
Project description
Atrium SDK — Python
An AI runtime for governed systems — not just an LLM wrapper.
Atrium SDK is the official Python client for the Monago Atrium gateway. It surfaces an OpenAI-compatible chat completion API, but with one critical difference: governance is visible on every call.
Every response carries a structured governance object — audit_id, pii_redacted, policy_decision, provider, latency_ms, cost_idr — parsed from the gateway's response headers. Blocks aren't opaque either: PII / security / policy blocks raise typed exceptions that carry the same audit trail.
This is the SDK for teams that need to ship LLM features into regulated environments (healthcare, finance, government) without losing the audit trail.
Install
pip install monago-atrium
Requires Python 3.10+.
Quickstart
from monago_atrium import Atrium
client = Atrium(api_key="sk-mng-your-key", base_url="https://api.monago.io/v1")
res = client.chat.completions.create(
model="gpt-5.4-mini",
messages=[
{"role": "user", "content": "Pasien NIK 3201... batuk 2 minggu"},
],
)
# OpenAI-compatible surface — drop-in for existing code.
print(res.content)
print(res.choices[0].finish_reason)
print(res.usage.total_tokens)
# The differentiator — governance, parsed and typed.
print(res.governance.audit_id) # "audit-uuid-..."
print(res.governance.pii_redacted) # ["NIK"]
print(res.governance.policy_decision) # "allowed"
print(res.governance.provider) # "openai"
print(res.governance.latency_ms) # 412.3
print(res.governance.cost_idr) # 12.5 (or None if gateway doesn't surface cost)
The API key can also come from the ATRIUM_API_KEY environment variable.
Async (FastAPI-friendly)
from monago_atrium import AsyncAtrium
async with AsyncAtrium(api_key="sk-mng-your-key") as client:
res = await client.chat.completions.create(
model="gpt-5.4-mini",
messages=[{"role": "user", "content": "Hello"}],
)
print(res.content, res.governance.audit_id)
Block errors carry governance too
When the gateway blocks a request (PII / security / policy / model), the SDK raises a typed exception that still carries the audit trail:
from monago_atrium import Atrium
from monago_atrium.exceptions import PIIBlockedError, SecurityBlockedError, PolicyBlockedError
client = Atrium(api_key="sk-mng-your-key")
try:
res = client.chat.completions.create(
model="gpt-5.4-mini",
messages=[{"role": "user", "content": "leak SSN 123-45-6789"}],
)
except PIIBlockedError as e:
print("blocked:", e.block_reason)
print("audit:", e.audit_id) # still traceable
print("decision:", e.policy_decision)
Exception hierarchy:
AtriumError
├── AuthError (401/403)
├── RateLimitError (429)
├── APIError (5xx / malformed)
├── TimeoutError
└── PolicyBlockedError (400/422/451 with policy_decision=blocked)
├── PIIBlockedError
├── SecurityBlockedError (prompt injection, jailbreak)
└── ModelNotAllowedError
Open-core note
The SDK itself is open source (MIT). The governance engine — policy DSL, PII detection, security analysis, audit trail — runs in the Atrium gateway, a hosted Monago service. Get an API key at monago.io.
Roadmap
Shipped:
-
AtriumandAsyncAtriumclients -
chat.completions.createwith an OpenAI-compatible body - Governance metadata parsed from
X-Monago-*response headers - Typed exception hierarchy with governance context on every block
- Full type hints +
py.typedmarker
Upcoming:
- Streaming chat completions (SSE)
- Eval hooks — pre- and post-response evaluators (toxicity, PII, custom)
- Skills — packaged tool / capability bundles
- Tracing — OpenTelemetry integration
- Request metadata tagging — attach
user_id/session_id/ custom fields to every audit record - Multi-agent — orchestration primitives
- TypeScript SDK —
@monagoio/atrium-sdk(npm), same API shape
Development
pip install -e ".[dev]"
pytest -v
Questions or contributions
Any questions, bug reports, or contributions — reach the founder directly:
- GitHub: @huseindra
- Email: husein@monago.io
Pull requests welcome. For larger changes, open an issue first to discuss the direction.
License
MIT — 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 monago_atrium-0.1.0.tar.gz.
File metadata
- Download URL: monago_atrium-0.1.0.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9254fc2496ad7226c8a68fee86e0be76d625bd5972670214c397132fb65a2318
|
|
| MD5 |
038e1b5b4423e9df3319b091d40036ba
|
|
| BLAKE2b-256 |
32c78329d7a4cb3b18ed0815e994b96452967bf428061d4b0b07b5a11815feed
|
File details
Details for the file monago_atrium-0.1.0-py3-none-any.whl.
File metadata
- Download URL: monago_atrium-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75c2c9ed3976a58bae5df6d172e52db45fabd3219a537d0d41c570b5f135497b
|
|
| MD5 |
78e1d720a93a401aaa3f95f37f16a333
|
|
| BLAKE2b-256 |
1221c7e485b17347603c3d8f93d44511e40e13945a67cbb5e6fd8814889716fe
|