aegis-platform-sdk (Python)
Typed Python client + functional namespace for the AEGIS platform — IAM, OSDK applications, ontology surface, LLM inference, RAG. Maps 1:1 to the HTTPS API.
- Distribution:
pip install aegis-platform-sdk - Import:
from aegis import … - Repo: https://github.com/Safe-Core/aegis-python-sdk (private)
- CI / release: see
PUBLISHING.md
The package name on disk is aegis (the legacy aegis_sdk
shim is deprecated and removed in v0.3).
Install
pip install aegis-platform-sdk
# or, from source while developing AEGIS:
pip install -e ./aegis-python-sdk
Two ways to use
Client style — explicit auth, structured access
from aegis import AegisClient
# Issue an OSDK token in the AEGIS UI: Governance → OSDK Applications.
client = AegisClient(
base_url="https://aegis.example.com",
token="osdk_xK9pQzR2L8mYvN4w...",
)
me = client.auth.me()
print(me.username, me.permissions) # → osdk:my-app, ["ontology.types.read", ...]
users = client.iam.users.list()
for u in users:
print(u.username, u.roles)
nav = client.iam.nav.tree()
for s in nav.sections:
print(s.id, "·", len(s.items), "items")
The OSDK token is shown once on creation. Treat it like a database credential — rotate, never commit.
Functional style — Palantir-like namespace
from aegis import inference
# Auto-uses a default client built from AEGIS_API_URL / AEGIS_TOKEN env vars.
out = inference.complete("Summarise the latest threat indicators")
print(out["response_text"])
answer = inference.chat(
messages=[{"role": "user", "content": "What intel exists on elections?"}],
rag_sources=["telegram", "tiktok_comments"],
)
models = inference.models()
collections = inference.collections()
Pin a pre-authed client globally:
import aegis
client = aegis.AegisClient(token="osdk_…")
aegis.set_default_client(client)
# Now every aegis.inference.* call uses the bearer.
aegis.inference.complete("hi")
Or pass it per-call:
aegis.inference.complete("hi", client=my_client)
Quick start — human auth (login)
from aegis import AegisClient
client = AegisClient(base_url="https://aegis.example.com")
pair = client.auth.login(username="alice", password="…", totp_code="123456")
# JWT is now attached to the client; refresh handled by client.auth.refresh(...).
me = client.auth.me()
client.auth.change_password("…", "new-strong-pass-12+chars")
client.auth.logout(pair.refresh_token)
Surface
| Group | Methods |
|---|---|
client.auth |
login, me, refresh, logout, change_password |
client.iam.users |
list, get |
client.iam.roles |
list, get |
client.iam.permissions |
list(resource=…) |
client.iam.nav |
tree(as_role_id=…) |
client.osdk |
list, get, create(name, scopes, expires_at), rotate, revoke |
aegis.inference (module-level) |
complete(prompt, …), chat(messages, rag_sources=…), models(), collections(), chat_with_rag(query, …), audit_trail(limit, provider) |
Write surfaces (PUT / PATCH / DELETE for users, roles, etc.) are on the short-term roadmap — open an issue if you need them sooner.
Errors
from aegis import AegisClient, PermissionDeniedError, AuthError
try:
client.iam.users.list()
except PermissionDeniedError as exc:
print(f"missing perm: {exc.detail}")
except AuthError as exc:
print(f"token expired or invalid: {exc.detail}")
Hierarchy: AegisAPIError ← AuthError (401) · PermissionDeniedError (403) · NotFoundError (404).
Environment overrides
| Var | Effect |
|---|---|
AEGIS_API_URL |
default base URL when none is passed |
AEGIS_TOKEN |
default bearer token when none is passed |
Development
cd aegis-python-sdk
pip install -e ".[dev]"
pytest -v
The unit suite uses respx to stub the HTTPS surface — no live stack
needed. The integration suite (under tests/integration/) runs against
a real ontology-module API at $AEGIS_API_URL and is skipped if the
service is unreachable.
Release files for aegis-platform-sdk 0.11.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aegis_platform_sdk-0.11.0.tar.gz | 180.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aegis_platform_sdk-0.11.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 348.8 kB
Release files / aegis_platform_sdk-0.11.0.tar.gz
| Download URL | aegis_platform_sdk-0.11.0.tar.gz |
|---|---|
| Size | 180.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f4fe840ff58b9619a388995a5eb7e8300a11c17089f4b27cfe8fd8f4f40612b4
|
|
BLAKE2b-256 checksum How to use checksums |
0bea5cb0334cef783cff6bcedb6c0e169032689bd019900f9ff48964b8eea90a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 31, 2026.
Transparency logRelease files / aegis_platform_sdk-0.11.0-py3-none-any.whl
| Download URL | aegis_platform_sdk-0.11.0-py3-none-any.whl |
|---|---|
| Size | 168.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
16a7577c154fb737abf555ede8a6095070f6f60d1f8ffc7057d9b1bd1ceb6c24
|
|
BLAKE2b-256 checksum How to use checksums |
9710442e669f41047535d6fd9d146849337f36778fb95045cd06cdd3b55a84ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 31, 2026.
Transparency log