Metadata-Version: 2.4
Name: rends-agent-sdk
Version: 1.0.0
Summary: Runtime interception SDK for AI agent governance
Author-email: Rends AI <hello@rends.ai>
License: MIT
Project-URL: Homepage, https://agentcompliant.ai/docs/sdk
Project-URL: Repository, https://github.com/eishops23/agentcompliant
Keywords: ai,agent,governance,compliance,langchain,crewai,autogen
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.25.0
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.2.0; extra == "langchain"
Provides-Extra: crewai
Requires-Dist: crewai>=0.28.0; extra == "crewai"
Provides-Extra: autogen
Requires-Dist: pyautogen>=0.2.0; extra == "autogen"
Provides-Extra: all
Requires-Dist: langchain-core>=0.2.0; extra == "all"
Requires-Dist: crewai>=0.28.0; extra == "all"
Requires-Dist: pyautogen>=0.2.0; extra == "all"
Dynamic: license-file

# rends-agent-sdk

Runtime interception SDK for AI agent governance. Wraps agent tool calls with synchronous policy enforcement via the AgentCompliant/Rends platform.

## Install

```bash
pip install rends-agent-sdk

# With framework adapters
pip install "rends-agent-sdk[langchain]"
pip install "rends-agent-sdk[crewai]"
pip install "rends-agent-sdk[autogen]"
pip install "rends-agent-sdk[all]"
```

## Quick Start

```python
from rends_sdk import RendsClient, RendsClientConfig, ActionContext

async with RendsClient(RendsClientConfig(
    api_key="ac_live_...",
    org_id="your-org-uuid",
    agent_id="your-agent-uuid",
    mode="enforce",  # "enforce" | "monitor" | "dry-run"
)) as client:
    result = await client.govern(
        ActionContext(
            action_type="database_query",
            action_name="select_users",
            resource_type="customer_records",
            input_summary="SELECT * FROM users WHERE region = us-east-1",
        ),
        tool_fn=lambda params: db.query("SELECT * FROM users"),
    )
    # result.allowed, result.status, result.result, result.check.violations
```

## LangChain Integration

```python
from rends_sdk.adapters import govern_langchain_tool

governed = govern_langchain_tool(client, search_tool, resource_type="web_search")
agent = create_react_agent(llm, tools=[governed])
```

## CrewAI Integration

```python
from rends_sdk.adapters import govern_crewai_tool

search = SerperDevTool()
governed = govern_crewai_tool(client, search, resource_type="web_search")
agent = Agent(tools=[governed], ...)
```

## AutoGen Integration

```python
from rends_sdk.adapters import govern_autogen_tool

def search_web(query: str) -> str:
    return tavily.search(query)

governed = govern_autogen_tool(client, search_web, "search_web", resource_type="web_search")
agent.register_function(function_map={"search_web": governed})
```

## Enforcement Modes

| Mode | Behavior |
|------|----------|
| `enforce` | BLOCK → raises `GovernanceBlockError`, PASS/WARN → executes |
| `monitor` | All decisions logged but never block execution |
| `dry-run` | Policy checked, nothing executed, nothing logged |

## Pre-flight Check

```python
check = await client.check_policy(ActionContext(
    action_type="data_export",
    action_name="export_pii",
    resource_type="user_data",
    input_summary="Export all PII to CSV",
))
# check.allowed, check.status, check.violations
```

## Pipeline Stages

The SDK runs a 5-stage pipeline on every `govern()` call:

1. **beforeAction** — validates action shape, computes input hash
2. **policyCheck** — calls `POST /v1/compliance/check-action` synchronously
3. **decisionReturn** — parses `{ allowed, status, violations, warnings }`
4. **executionGate** — executes tool if allowed, raises if blocked (in enforce mode)
5. **telemetryEmit** — logs to `POST /v1/telemetry/ingest` (hash-chained audit trail)

## Configuration

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `api_key` | str | required | API key (`ac_live_...`) |
| `org_id` | str | required | Organization UUID |
| `agent_id` | str | required | Agent UUID |
| `endpoint` | str | `https://agentcompliant.ai/api` | API base URL |
| `mode` | str | `enforce` | Enforcement mode |
| `timeout_ms` | int | `10000` | Policy check timeout |
| `retries` | int | `2` | Retry count for transient failures |
| `fail_open` | bool | `False` | Allow action if policy check fails |

## License

MIT
