Metadata-Version: 2.4
Name: agr-sdk
Version: 0.1.0
Summary: AGR Python SDK — governance layer for AI agents
Author: Shreeja AI
License: MIT
Project-URL: Homepage, https://bitbucket.org/rndaxtria/agent-run-governance
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.25.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
Requires-Dist: httpx>=0.25.0; extra == "dev"
Dynamic: license-file

# agr-sdk

Python SDK for [AGR (Agentic Governance Runtime)](https://bitbucket.org/rndaxtria/agent-run-governance) — a drop-in governance layer for AI agent tool calls. Every action your agent takes is evaluated against your org's policies before it runs.

## Install

```bash
pip install agr-sdk
```

## Quickstart — zero-touch guard

```python
import agr

agr.configure(
    base_url="https://api.agr.dev",   # or your self-hosted AGR instance
    api_key="agr_sk_xxx",
    agent_id="my-agent",
)

@agr.guard(action="execute_sql", resource="prod_db")
def run_query(sql: str) -> str:
    ...
```

Calling `run_query(...)` now evaluates the action against your AGR policies first. If policy denies it, `AGRDeniedError` is raised instead of the query running. If policy requires human approval, the call blocks (or raises `AGRApprovalTimeoutError`) until a human decides.

## Quickstart — wrap existing tools

```python
import agr

agr.configure(base_url="https://api.agr.dev", api_key="agr_sk_xxx", agent_id="my-agent")
tools = agr.wrap_tools(my_langchain_tools)  # LangChain BaseTool instances, plain callables, or async callables
```

## Quickstart — raw client

```python
from agr import AGRClient

client = AGRClient(api_key="agr_sk_xxx", base_url="https://api.agr.dev")
result = client.evaluate(agent="my-agent", action="deploy", resource="production")

if result.allowed:
    ...
elif result.denied:
    ...
elif result.requires_approval:
    ...
```

An `AsyncAGRClient` with the same shape is available for async code.

## Framework integrations

- LangChain — `agr.wrap_tools()` auto-detects `BaseTool` instances.
- CrewAI / LangGraph — see `agr.plugins.crewai` / `agr.plugins.langgraph`.

## License

MIT
