Metadata-Version: 2.4
Name: enforgate
Version: 0.1.0
Summary: Official Python SDK for the Enforgate MCP gateway — action-boundary security for AI agents.
License: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# enforgate (Python)

Official Python SDK for the [Enforgate](../../README.md) gateway — action-boundary security for AI agents. Pure standard library, no dependencies.

## Install

```sh
pip install enforgate   # once published; for now: pip install -e packages/sdk-python
```

## Usage

```python
import os
from enforgate import EnforgateClient, EnforgateError

client = EnforgateClient(
    api_key=os.environ["ENFORGATE_API_KEY"],
    base_url=os.environ.get("ENFORGATE_GATEWAY_URL", "http://localhost:3000"),
)

# Advisory check — get a verdict, decide what to do.
verdict = client.check("demo", "send_email", {"to": "person@example.com"})
print(verdict.decision, verdict.reason)

# Or guard inline — raises EnforgateError unless the call is allowed.
try:
    client.guard("demo", "delete_file", {"path": "/etc/passwd"})
    do_the_thing()
except EnforgateError as err:
    print("blocked:", err)
```

`check()` returns a `CheckResult` with `decision` (`allow` / `deny` /
`require_approval`), `reason`, `policy_id`, `tool_call_id`, `latency_ms`, and a
convenience `.allowed` property.

> Arguments are evaluated at the gateway in memory only — they are never stored;
> the audit log keeps a hash. See the main docs for the enforcing MCP-proxy mode.
