Metadata-Version: 2.4
Name: agentpass-sdk
Version: 0.1.0
Summary: The credit check for AI agents -- trust scoring, signed payments, AML sanctions screening
Author-email: Raza Sharif <contact@agentsign.dev>
License-Expression: MIT
Project-URL: Homepage, https://agentpass.co.uk
Project-URL: Documentation, https://agentpass.co.uk/docs
Project-URL: Repository, https://github.com/razashariff/agentpass-python
Keywords: ai,agents,payments,trust,sanctions,mcp,agentpass
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
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
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.24.0
Dynamic: license-file

# AgentPass Python SDK

The credit check for AI agents -- trust scoring, signed payments, AML sanctions screening.

## Installation

```bash
pip install agentpass
```

## Quick Start

```python
from agentpass import AgentPassClient, register

# Register a new account
result = register("dev@example.com", "Your Name", "password", company="Acme Inc")
api_key = result["apiKey"]

# Create a client
client = AgentPassClient(api_key=api_key)

# Create an agent
agent = client.create_agent("payment-bot", scope=["payments"])
agent_id = agent["id"]

# Check trust score
trust = client.get_trust(agent_id)
print(f"Trust score: {trust['score']}")

# Make a payment
tx = client.pay(agent_id, to="store.example.com", amount=1000, currency="usd")
print(f"Transaction: {tx['transactionId']}")

# Screen against sanctions lists
check = client.screen_sanctions("ACME Corp", country="GB")
print(f"Sanctioned: {check['matched']}")

# Check balance
bal = client.balance()
print(f"Balance: {bal['balance']} cents")
```

## Async Usage

```python
import asyncio
from agentpass import AsyncAgentPassClient

async def main():
    async with AsyncAgentPassClient(api_key="apt_live_xxx") as client:
        agents = await client.list_agents()
        trust = await client.get_trust("agt_123")
        tx = await client.pay("agt_123", "store.example.com", 500)

asyncio.run(main())
```

## Identity Verification (Challenge-Response)

Prove an agent's identity using ECDSA P-256 challenge-response:

```python
# Requires: pip install cryptography
result = client.prove_identity(agent_id, private_key_pem)
print(f"Verified: {result['verified']}")
```

Or step-by-step:

```python
challenge = client.get_challenge(agent_id)
signature = client.sign_challenge(challenge["challenge"], private_key_pem)
result = client.verify_identity(agent_id, challenge["challenge"], signature)
```

## Agent-to-Agent Payments

```python
tx = client.agent_pay(
    from_agent_id="agt_sender",
    to_agent_id="agt_receiver",
    amount=500,
    currency="usd",
    description="Service fee"
)
```

## All Methods

| Method | Description |
|--------|-------------|
| `register()` | Register a new developer account (standalone function) |
| `create_agent(name, scope)` | Create a new agent |
| `list_agents()` | List all agents |
| `get_agent(agent_id)` | Get agent details |
| `revoke_agent(agent_id)` | Revoke an agent |
| `get_passport(agent_id)` | Get agent passport |
| `balance()` | Get wallet balance |
| `topup(amount)` | Top up wallet (cents) |
| `pay(agent_id, to, amount, ...)` | Make a payment |
| `agent_pay(from_id, to_id, amount, ...)` | Agent-to-agent payment |
| `list_transactions()` | List transactions |
| `get_transaction(tx_id)` | Get transaction by ID |
| `get_trust(agent_id)` | Get trust score |
| `trust_report(agent_id)` | Get full trust report |
| `trust_events(agent_id)` | Trust event history |
| `get_challenge(agent_id)` | Get identity challenge |
| `verify_identity(agent_id, challenge, sig)` | Verify signed challenge |
| `sign_challenge(challenge, pem)` | Sign challenge locally |
| `prove_identity(agent_id, pem)` | Full identity flow |
| `screen_sanctions(name, country)` | AML sanctions screening |
| `sanctions_stats()` | Sanctions DB stats |
| `account()` | Get account info |
| `change_password(current, new)` | Change password |
| `regenerate_key()` | Regenerate API key |
| `simulate_webhook(event_type, tx_id)` | Simulate Stripe webhook |
| `demo_purchase(agent_id, product)` | Demo store purchase |

## Error Handling

```python
from agentpass import (
    AgentPassError,
    AuthenticationError,
    InsufficientFundsError,
    TrustLimitError,
    NotFoundError,
    ReplayError,
)

try:
    client.pay(agent_id, "store", 5000)
except InsufficientFundsError:
    print("Top up your wallet first")
except TrustLimitError:
    print("Agent trust score too low")
except AuthenticationError:
    print("Invalid API key")
except AgentPassError as e:
    print(f"Error {e.status}: {e}")
```

## Links

- Website: https://agentpass.co.uk
- Documentation: https://agentpass.co.uk/docs

## License

MIT -- (c) 2026 CyberSecAI Ltd.
