ActAuth (Python)
Part of LoopEngine — a runtime for defining and running AI agents through a transparent ReAct loop — handling rule-based permission gating (allow/ask/deny) with human-approval hooks. Works standalone too, no dependency on LoopEngine itself.
Reference implementation of the rule engine, scoped resolution, conditions, and audit log. See the root README for the product pitch and rule format; this file only covers what's specific to the Python package.
Install
pip install -e ".[dev]"
Quickstart
python examples/quickstart.py
import asyncio
from actauth import AuditLog, Gate, Scope
async def main():
gate = Gate.from_config(
"examples/actauth.yml",
audit_log=AuditLog("actauth-audit.jsonl"),
)
scope = Scope(tenant="beta-fintech", environment="production", agent="payments-agent")
result = await gate.evaluate("send_refund", {"amount": 5000}, scope)
print(result.decision, result.reason)
asyncio.run(main())
Run the tests
pytest
Project layout
src/actauth/
models.py Decision, Scope, Rule, EvaluationResult
conditions.py safe {field, op, value} evaluator, no eval()
rules.py RuleSet — loads YAML, resolves scope + conditions
audit.py AuditLog — append-only JSONL
approvers.py Approver interface, ConsoleApprover, SlackApprover
gate.py Gate — ties the above together
examples/
actauth.yml example rule set
quickstart.py runnable end-to-end demo
tests/
Status
Rule engine, scoping, conditions, audit log, and SlackApprover are real
and tested. No agent-SDK adapter yet.
ConsoleApprover
The default Approver — a blocking terminal prompt, useful for local dev
and for exercising the full ask pipeline without standing up Slack:
from actauth import Gate
from actauth.approvers import ConsoleApprover
gate = Gate.from_config("actauth.yml", approver=ConsoleApprover())
# this is also the default if you omit `approver`
result = await gate.evaluate("send_refund", {"amount": 900}, scope)
# prints scope/tool/args/reason, then blocks on `approve? [y/N]`
SlackApprover
from actauth.approvers import SlackApprover
approver = SlackApprover(
bot_token=os.environ["SLACK_BOT_TOKEN"],
channel="#approvals",
signing_secret=os.environ["SLACK_SIGNING_SECRET"],
)
# wire your own route for the Slack app's Interactivity Request URL:
@app.post("/slack/interactions")
async def slack_interactions(request):
raw_body = await request.body()
await approver.handle_interaction(
raw_body.decode(),
request.headers["x-slack-request-timestamp"],
request.headers["x-slack-signature"],
)
return Response(status_code=200)
request_approval() posts an interactive Approve/Deny message and resolves
when handle_interaction() is called with the matching click — verified
against Slack's request signature, timing out (deny) after
timeout_seconds (default 5 minutes) if nobody responds.
Release files for actauth 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| actauth-0.0.4.tar.gz | 10.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| actauth-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.3 kB
Release files / actauth-0.0.4.tar.gz
| Download URL | actauth-0.0.4.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7fdb711dbd0539f289fe7dd5dc5865e7cf58a98014ca39f3749bd9c62ce81dec
|
|
BLAKE2b-256 checksum How to use checksums |
b6de2e97608ca3898b16dac9d59f8ac6f7593e6f62e17f43035416db1724f058
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.8
|
Release files / actauth-0.0.4-py3-none-any.whl
| Download URL | actauth-0.0.4-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6f2c109efe8198f43451d4d3e26f62dbdebc20b75a6b70d9abec091d9995df3a
|
|
BLAKE2b-256 checksum How to use checksums |
49a7a59074f96b37b533f7e853e472952f1edd18515ea35c93ecf65f5ee8ae74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.8
|