|
| 1 | +# agentscore-py |
| 2 | + |
| 3 | +[](https://pypi.org/project/agentscore-py/) |
| 4 | +[](LICENSE) |
| 5 | + |
| 6 | +Python client for the [AgentScore](https://agentscore.sh) trust and reputation API. Score, verify, and assess AI agent wallets in the [x402](https://github.com/coinbase/x402) payment ecosystem and [ERC-8004](https://eips.ethereum.org/EIPS/eip-8004) agent registry. |
| 7 | + |
| 8 | +## Install |
| 9 | + |
| 10 | +```bash |
| 11 | +pip install agentscore-py |
| 12 | +``` |
| 13 | + |
| 14 | +## Quick Start |
| 15 | + |
| 16 | +```python |
| 17 | +from agentscore import AgentScore |
| 18 | + |
| 19 | +client = AgentScore(api_key="ask_...") |
| 20 | + |
| 21 | +# Free reputation lookup |
| 22 | +rep = client.get_reputation("0x1234...") |
| 23 | +print(rep["grade"], rep["score"]) |
| 24 | + |
| 25 | +# Trust decision with policy |
| 26 | +decision = client.get_decision("0x1234...", min_grade="C", min_transactions=5) |
| 27 | +print(decision["decision"]["allow"]) |
| 28 | +``` |
| 29 | + |
| 30 | +### Async |
| 31 | + |
| 32 | +```python |
| 33 | +async with AgentScore(api_key="ask_...") as client: |
| 34 | + rep = await client.aget_reputation("0x1234...") |
| 35 | + print(rep["grade"]) |
| 36 | +``` |
| 37 | + |
| 38 | +### Context Manager |
| 39 | + |
| 40 | +```python |
| 41 | +with AgentScore(api_key="ask_...") as client: |
| 42 | + rep = client.get_reputation("0x1234...") |
| 43 | +``` |
| 44 | + |
| 45 | +## Configuration |
| 46 | + |
| 47 | +| Parameter | Default | Description | |
| 48 | +|------------|----------------------------|--------------------------| |
| 49 | +| `api_key` | `None` | API key from [agentscore.sh](https://agentscore.sh) | |
| 50 | +| `base_url` | `https://api.agentscore.sh` | API base URL | |
| 51 | +| `timeout` | `10.0` | Request timeout (seconds)| |
| 52 | + |
| 53 | +## Error Handling |
| 54 | + |
| 55 | +```python |
| 56 | +from agentscore import AgentScore, AgentScoreError |
| 57 | + |
| 58 | +try: |
| 59 | + rep = client.get_reputation("0xinvalid") |
| 60 | +except AgentScoreError as e: |
| 61 | + print(e.code, e.status_code, str(e)) |
| 62 | +``` |
| 63 | + |
| 64 | +## Documentation |
| 65 | + |
| 66 | +- [API Reference](https://docs.agentscore.sh) |
| 67 | +- [ERC-8004 Standard](https://eips.ethereum.org/EIPS/eip-8004) |
| 68 | +- [x402 Protocol](https://github.com/coinbase/x402) |
| 69 | + |
| 70 | +## License |
| 71 | + |
| 72 | +[MIT](LICENSE) |
0 commit comments