Metadata-Version: 2.4
Name: trigguard
Version: 0.1.1
Summary: TrigGuard Gateway Client
Home-page: https://github.com/TrigGuard-AI/TrigGuard
Author: TrigGuard AI
License: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Dynamic: author
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: requires-python
Dynamic: summary

# trigguard (PyPI)

Official **Python 3.9+** client for the TrigGuard **execution gateway** — `POST /execute` using only the **standard library** (`urllib`).

## Install (from PyPI)

```bash
pip install trigguard
```

## Editable (monorepo)

```bash
cd sdk/python && pip install -e .
```

## Usage

```python
import os
from trigguard import Client

client = Client(
    api_key=os.environ["TG_API_KEY"],
    base_url="http://127.0.0.1:8080",
)
r = client.execute(
    surface="spendCommit",
    signals={"riskScore": 0.9},
    context={"amount": 1000},
)
print(r["decision"], r.get("execution_id"))
```

## OpenAI function guard (tools)

```python
from trigguard import TrigGuardError
from trigguard.openai import authorize_tool, map_tool_call_to_surface

try:
    authorize_tool(
        surface="spendCommit",
        context={"amount": 1000},
        signals={"riskScore": 0.1},
    )
except TrigGuardError as e:
    print("blocked", e, e.body)
```

- **Auth:** `Authorization: Bearer <api_key>`
- **Errors:** `TrigGuardError` on non-2xx

## Build & publish (maintainers)

Run from the **repository root** (not from `sdk/node` — `scripts/` is at the root).

```bash
cd /path/to/TrigGuard
python3 -m pip install build twine
bash scripts/publish-pypi.sh
```

On macOS, if `pip` is not found, use **`python3 -m pip`** as above. Configure **twine** (`~/.pypirc` or env) before upload.

## See also

- [SDK quickstart (repo)](../../docs/SDK_QUICKSTART.md)
- [LangChain integration](../../docs/integrations/LANGCHAIN.md)
