Skip to main content

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:

  • Atrium and AsyncAtrium clients
  • chat.completions.create with 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.typed marker

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:

Pull requests welcome. For larger changes, open an issue first to discuss the direction.


License

MIT — see LICENSE.

Metadata

Release files for monago-atrium 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for monago-atrium 0.1.0
File Size Uploaded Provenance Actions
monago_atrium-0.1.0.tar.gz 12.9 kB Without provenance Details for monago_atrium-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for monago-atrium 0.1.0
File Interpreter ABI Platform Actions
monago_atrium-0.1.0-py3-none-any.whl Python 3 none any Details for monago_atrium-0.1.0-py3-none-any.whl

Total release size: 25.5 kB

Release files / monago_atrium-0.1.0.tar.gz

Download URL monago_atrium-0.1.0.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9254fc2496ad7226c8a68fee86e0be76d625bd5972670214c397132fb65a2318
BLAKE2b-256 checksum
How to use checksums
32c78329d7a4cb3b18ed0815e994b96452967bf428061d4b0b07b5a11815feed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release files / monago_atrium-0.1.0-py3-none-any.whl

Download URL monago_atrium-0.1.0-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
75c2c9ed3976a58bae5df6d172e52db45fabd3219a537d0d41c570b5f135497b
BLAKE2b-256 checksum
How to use checksums
1221c7e485b17347603c3d8f93d44511e40e13945a67cbb5e6fd8814889716fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Security for monago-atrium 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page