WardenLoop Python SDK
Add human oversight to your AI agents in minutes.
pip install wardenloop
Quickstart
from wardenloop import Warden
warden = Warden(api_key="wl_...")
# Your agent wants to delete files
result = warden.guard(
action="delete_files",
payload={"path": "/user/documents/invoices/", "count": 47},
risk="critical",
)
if result.approved:
delete_files("/user/documents/invoices/")
else:
print(f"Action blocked: {result.reason}")
When .guard() is called with risk="critical", WardenLoop:
- Logs the action to your dashboard
- Sends a Slack message to your operator: "Agent wants to delete 47 files — Approve / Deny"
- Waits for the human response (up to 5 minutes by default)
- Returns the result to your agent
Low-risk actions are auto-approved instantly with no waiting.
Risk levels
| Level | Behaviour |
|---|---|
low |
Auto-approved immediately |
medium |
Notifies operator, waits for approval |
high |
Notifies operator, waits for approval |
critical |
Notifies operator, waits for approval |
Examples
Send email (medium risk)
result = warden.guard(
action="send_email",
payload={"to": "ceo@acme.com", "subject": "Q4 Report"},
risk="medium",
message="Agent wants to send the quarterly report to the CEO.",
)
if result: # GuardResult is truthy when approved
send_email(...)
Execute payment (critical)
result = warden.guard(
action="execute_payment",
payload={"amount": 15000, "currency": "USD", "recipient": "vendor@example.com"},
risk="critical",
)
if result.approved:
process_payment(...)
elif result.status == "timeout":
print("No operator response — payment skipped.")
else:
print(f"Payment denied: {result.reason}")
Fire-and-forget audit log
# Log what your agent did without waiting for approval
action_id = warden.log(
action="read_database",
payload={"table": "users", "rows_read": 1200},
risk="low",
)
Configuration
warden = Warden(
api_key="wl_...", # or set WARDENLOOP_API_KEY env var
timeout=600, # seconds to wait for approval (default: 300)
poll_interval=5, # seconds between status checks (default: 3)
raise_on_denied=True, # raise ActionDeniedError instead of returning False
raise_on_timeout=True, # raise ActionTimeoutError instead of returning False
fail_closed=True, # block actions if backend is unreachable (default)
)
Environment variable
export WARDENLOOP_API_KEY=wl_your_key_here
warden = Warden() # picks up key automatically
Error handling
from wardenloop import (
ActionDeniedError,
ActionTimeoutError,
BackendUnavailableError,
LimitExceededError,
AuthenticationError,
)
warden = Warden(api_key="wl_...", raise_on_denied=True, raise_on_timeout=True)
try:
result = warden.guard("delete_all_records", risk="critical")
except ActionDeniedError as e:
print(f"Denied: {e.reason}")
except ActionTimeoutError as e:
print(f"No response after {e.timeout}s")
except BackendUnavailableError:
print("WardenLoop is unreachable — action blocked")
except LimitExceededError as e:
print(f"Action budget exceeded: {e.used}/{e.limit}")
except AuthenticationError:
print("Invalid API key")
Fail-closed by default
If the WardenLoop backend is unreachable, guard() raises BackendUnavailableError
and the action is blocked — this is the safe default.
To allow actions when the backend is down (fail-open):
warden = Warden(api_key="wl_...", fail_closed=False)
Dependencies
The SDK has zero required dependencies and works with Python's built-in urllib.
Install httpx for better performance and connection pooling:
pip install wardenloop[httpx]
Get your API key
Sign up at app.wardenloopai.com
License
MIT
Metadata
Release files for wardenloop 0.1.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 | Provenance | Actions |
|---|---|---|---|---|
| wardenloop-0.1.0.tar.gz | 8.0 kB | Without provenance | Details for wardenloop-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wardenloop-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for wardenloop-0.1.0-py3-none-any.whl |
Total release size: 17.0 kB
Release files / wardenloop-0.1.0.tar.gz
| Download URL | wardenloop-0.1.0.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b67de50763a1f806dd421411791d15ddfb95050c07e4198f1df325247dae8b2c
|
|
BLAKE2b-256 checksum How to use checksums |
827b5fdcd3ba6882ca5714cdf6316ee125d9101c15e18db1dd0e64d8e31e048a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / wardenloop-0.1.0-py3-none-any.whl
| Download URL | wardenloop-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9bf6823656e6298233760b45ac549c66c46b031d75240c22eedfa1b37bbc311a
|
|
BLAKE2b-256 checksum How to use checksums |
90776e18a7f34ca6894ec691584557f50a56bac48f549d66efe82bbf23467764
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Security for wardenloop 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.