Metadata-Version: 2.4
Name: agentguard-auth
Version: 0.1.0
Summary: Python SDK for the AgentGuard AI Agent Authorization API
Author: Shubham
License-Expression: MIT
Project-URL: Homepage, https://github.com/SKTVDY/AgentGuard
Project-URL: Repository, https://github.com/SKTVDY/AgentGuard
Project-URL: Issues, https://github.com/SKTVDY/AgentGuard/issues
Keywords: ai-agents,authorization,security,policy,agent-security
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.27.0
Dynamic: license-file

# AgentGuard Python SDK

Python SDK for the AgentGuard AI Agent Authorization API.

AgentGuard provides an authorization and policy layer between AI agents and the tools or resources they interact with. It evaluates requested actions and returns one of three decisions:

* `ALLOW`
* `BLOCK`
* `REQUIRE_APPROVAL`

## Installation

```bash
pip install agentguard
```

## Quick Start

```python
from agentguard import AgentGuard

client = AgentGuard(api_key="ag_live_your_api_key")

result = client.authorize(
    agent_id="sales-agent",
    action="send_email",
    resource="customer_123",
    parameters={
        "recipient": "customer@example.com"
    }
)

print(result.decision)
print(result.risk_score)
print(result.reason)
```

## Decision Helpers

The returned `EvaluationResult` provides convenient properties:

```python
if result.allowed:
    print("Action is allowed")

if result.blocked:
    print("Action is blocked")

if result.requires_approval:
    print("Human approval is required")
```

## Approval Status

For actions requiring approval:

```python
if result.requires_approval:
    approval = client.get_approval_status(result.approval_id)
    print(approval)
```

## Custom API URL

The SDK defaults to the hosted AgentGuard API, but a custom API URL can be supplied:

```python
client = AgentGuard(
    api_key="ag_live_your_api_key",
    base_url="https://your-agentguard-instance.example.com"
)
```

## Security

Keep your AgentGuard API key secret. Do not commit API keys to source control or expose them in client-side applications.

Use environment variables or a secret manager in production.

## License

AgentGuard is licensed under the MIT License. See the `LICENSE` file for details.
