Metadata-Version: 2.4
Name: strivio
Version: 2.0.0
Summary: Strivio AI Firewall SDK — secure every AI agent action
Author-email: Fransly Dutervil <fransly@strivio.io>
License: MIT
Project-URL: Homepage, https://strivio.io
Project-URL: Documentation, https://strivio.io/docs
Project-URL: Repository, https://github.com/Qb7354vm/strivio-ai-firewall
Project-URL: Bug Tracker, https://github.com/Qb7354vm/strivio-ai-firewall/issues
Keywords: ai,security,firewall,llm,agents,governance
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Security
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Provides-Extra: requests
Requires-Dist: requests>=2.28.0; extra == "requests"
Provides-Extra: langchain
Requires-Dist: requests>=2.28.0; extra == "langchain"
Requires-Dist: langchain>=0.1.0; extra == "langchain"
Provides-Extra: all
Requires-Dist: requests>=2.28.0; extra == "all"
Requires-Dist: langchain>=0.1.0; extra == "all"

# Strivio AI Firewall — Python SDK

Real-time behavioral security for AI agents.

## Install

```bash
pip install strivio
# With LangChain support:
pip install strivio[langchain]
```

## Quickstart — LangChain (2 lines)

```python
from strivio import StrivioCallbackHandler

strivio = StrivioCallbackHandler(
    api_url  = "http://localhost:4000/api/v1",
    token    = "your-jwt-token",
    agent_id = "my-agent-v1",
)

# Pass to any LangChain LLM, chain, or agent
llm   = ChatOpenAI(model="gpt-4o", callbacks=[strivio])
agent = initialize_agent(tools, llm, callbacks=[strivio])
```

That's it. Every tool call, LLM call, and agent decision is now:
- **Risk scored** (0–100)
- **Firewall enforced** (allow / flag / block)
- **Audit logged** (timestamped, immutable)
- **Visible** in your Strivio dashboard

## Quickstart — Any Agent (direct client)

```python
from strivio import StrivioClient

client = StrivioClient(
    api_url  = "http://localhost:4000/api/v1",
    token    = "your-jwt-token",
    agent_id = "my-agent",
)

# Before any risky action:
result = client.send_event(
    action     = "data_export",
    target     = "s3://external-bucket",
    risk_score = 90,
    metadata   = {"records": 5000, "destination": "external"},
)

if client.is_blocked(result):
    raise Exception("Action blocked by Strivio firewall")
```

## Block High-Risk Actions

```python
strivio = StrivioCallbackHandler(
    block_on_high_risk = True,   # raises StrivioBlockedError
    risk_threshold     = 80,     # block anything scoring 80+
)

try:
    agent.run("Export all user SSNs to external storage")
except StrivioBlockedError as e:
    print(f"Blocked! Risk score: {e.risk_score}")
```

## What Gets Monitored

| Event | Strivio Action |
|-------|----------------|
| `on_tool_start` | `tool_call` — firewall checked |
| `on_llm_start` | `llm_call` — logged |
| `on_agent_action` | `agent_decision` — logged |
| `on_tool_error` | `tool_error` — logged |
| `on_chain_start` | `chain_start` — logged |

## Environment Variables

```bash
export STRIVIO_API_URL="http://localhost:4000/api/v1"
export STRIVIO_TOKEN="your-jwt-token"
export STRIVIO_AGENT_ID="my-agent-v1"
```

## Dashboard

View all agent activity at: **http://localhost:3000/dashboard**

- **Alerts** — blocked and flagged actions
- **Telemetry** — live event feed
- **Audit Log** — every decision, timestamped
- **Review Queue** — human approval workflow

---

Built by [Strivio](https://strivio.io) · The AI Behavioral Perimeter
