Zero-trust authorization and spending limits for AI agents. Ed25519-signed JWTs, policy enforcement, and payment gating.
Project description
mandatum
Spending limits and authorization for AI agents. One line of code to prevent your AI from overspending.
Install
pip install mandatum
Quick Start
from mandatum import Mandatum
m = Mandatum(
api_key="mdt_live_...",
base_url="https://mandatum-fbg9.onrender.com"
)
# Register an agent
agent = m.agents.create("ShoppingBot", type="payment", delegator="user@example.com")
# Check spending limits before payment
result = m.agents.spend(agent["id"], {
"amount": 350,
"currency": "INR",
"vendor": "DigitalOcean",
})
if result["allowed"]:
razorpay.order.create({"amount": 35000})
else:
print("Blocked:", result["reason"])
Payment Wrappers
from mandatum.payments import MandatumRazorpay
pay = MandatumRazorpay(razorpay_client, m, agent["id"])
result = pay.create_order(amount=50000, currency="INR")
if result["allowed"]:
print("✅ Order created:", result["order"])
Decorator Guard
from mandatum.integrations import mandatum_guard
@mandatum_guard(m, agent_id="agt_abc123", action="payments:execute")
def buy_groceries(items, amount=0):
return razorpay.order.create({"amount": amount * 100})
# Automatically checks limits — raises MandatumBlocked if over
buy_groceries(["milk", "bread"], amount=500)
Context Manager
from mandatum.integrations import MandatumGuard
with MandatumGuard(m, "agt_abc123") as guard:
guard.check_spend(amount=350, vendor="AWS")
# Only runs if spend was allowed
aws.create_instance(...)
API Reference
| Method | Description |
|---|---|
m.check(token, action, context) |
1-line permission gate |
m.agents.spend(id, params) |
Record spending + check limits |
m.agents.spending(id) |
Get spending summary |
m.agents.create/list/get/suspend/revoke |
Manage agents |
m.tokens.issue/verify/revoke |
Manage tokens |
m.policies.create/list/assign |
Manage policies |
m.audit.list/verify_chain |
Audit trail |
License
MIT
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
mandatumio-1.0.0.tar.gz
(7.0 kB
view details)
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 mandatumio-1.0.0.tar.gz.
File metadata
- Download URL: mandatumio-1.0.0.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0dc5de12aa5075e2989f982884641b369b8c6bca3db230d541cd79b2a7f9568a
|
|
| MD5 |
87f389b836542d688af9d80b12115705
|
|
| BLAKE2b-256 |
ba739cece346841174e1f1ea4efab34ba171a2e9231b164e6180a9615c92cd80
|
File details
Details for the file mandatumio-1.0.0-py3-none-any.whl.
File metadata
- Download URL: mandatumio-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6862b41157d065ded607a9be44f6149e5070c39469b8d67f05680ff8609c9328
|
|
| MD5 |
7e47bd8590973e7a01de2e0647653e60
|
|
| BLAKE2b-256 |
b827b117b1b7ef6a05de6c25f56f5d6de1420264772d417edb7cd83eb36b0136
|