Metadata-Version: 2.4
Name: actpass
Version: 1.1.0
Summary: ActPass Python SDK — signed action authorization for AI agents (zero dependencies)
Project-URL: Homepage, https://app.actpass.org
Author: ActPass
License: MIT
Keywords: agents,ai,authorization,mcp,security
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Security
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# ActPass Python SDK

Zero-dependency (stdlib-only) Python client for the ActPass runtime, mirroring
the TypeScript `@actpass/sdk` surface (spec §14).

## Install

```bash
pip install actpass
```

## Usage (§14.2)

```python
from actpass import create_actpass

# The API key IS your identity: the server resolves tenant + agent from it.
client = create_actpass(api_key="sk_...")

# Preflight + guarded execution in one call. execute_fn runs ONLY on allow/warn.
result = client.guard(
    goal="resolve_refund_request",
    tool="stripe.refund.create",
    resource="stripe:charge:ch_123",
    args={"chargeId": "ch_123", "amount": 14900, "currency": "USD"},
    execute_fn=lambda ctx: stripe.Refund.create(charge="ch_123", amount=14900),
)
print(result["decision"]["decision"])   # allow | deny | require_approval | ...
```

Other methods: `preflight()`, `issue_passport()`, `verify_passport()`,
`revoke_passport()`, `record_evidence()`, plus `hash_payload()` /
`sign_payload()` helpers for evidence hashing.

## Behavior
- **Fails closed:** any non-2xx (except 401/403, which return the parsed body)
  raises `ActPassError`; a network failure raises too. `guard()` only executes
  your function on `allow`/`warn`.
- **Tenant is a hint:** sent as `x-actpass-tenant`; the gateway resolves the
  authoritative tenant from the authenticated principal (§11.2).
- **Zero dependencies:** `urllib`/`json`/`hmac`/`hashlib` from the stdlib only.

## Test

```bash
cd packages/sdk-python && python -m unittest discover -s tests
```
