Skip to content

Commit f837a6b

Browse files
vvillait88claude
andcommitted
Initial commit: agentscore-py v2.0.0
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 parents  commit f837a6b

20 files changed

Lines changed: 1494 additions & 0 deletions

.claude/CLAUDE.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# agentscore-py
2+
3+
Python client for the AgentScore trust and reputation API.
4+
5+
## Architecture
6+
7+
Single-package Python library published to PyPI.
8+
9+
| File | Purpose |
10+
|------|---------|
11+
| `agentscore/` | Source code |
12+
| `tests/` | pytest tests |
13+
14+
## Tooling
15+
16+
- **uv** — package manager. Use `uv sync`, `uv run`.
17+
- **ruff** — linting + formatting. `uv run ruff check .` and `uv run ruff format --check .`.
18+
- **vulture** — dead code detection.
19+
- **pytest** — tests. `uv run pytest tests/`.
20+
- **Lefthook** — git hooks. Pre-commit: ruff. Pre-push: vulture.
21+
22+
## Key Commands
23+
24+
```bash
25+
uv sync --all-extras
26+
uv run ruff check .
27+
uv run ruff format .
28+
uv run pytest tests/
29+
```
30+
31+
## Workflow
32+
33+
1. Create a branch
34+
2. Make changes
35+
3. Lefthook runs ruff on commit, vulture on push
36+
4. Open a PR — CI runs automatically
37+
5. Merge (squash)
38+
39+
## Rules
40+
41+
- **No silent refactors**
42+
- **Never commit .env files or secrets**
43+
- **Use PRs** — never push directly to main

.github/dependabot.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "uv"
4+
directory: "/"
5+
labels: ["dependencies", "python"]
6+
schedule:
7+
interval: "weekly"
8+
day: "monday"
9+
time: "06:00"
10+
timezone: "America/New_York"
11+
12+
- package-ecosystem: "github-actions"
13+
directory: "/"
14+
labels: ["dependencies", "ci"]
15+
schedule:
16+
interval: "weekly"
17+
day: "monday"
18+
time: "06:00"
19+
timezone: "America/New_York"
20+

.github/workflows/ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
ci:
11+
runs-on: blacksmith-2vcpu-ubuntu-2404
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: astral-sh/setup-uv@v7
15+
- run: uv sync --frozen --all-extras
16+
- run: uv run ruff check .
17+
- run: uv run ruff format --check .
18+
- run: uv run vulture . vulture_whitelist.py --min-confidence 80 --exclude .venv
19+
- run: uv run pytest tests/

.github/workflows/publish.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: blacksmith-2vcpu-ubuntu-2404
10+
permissions:
11+
contents: read
12+
id-token: write
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: astral-sh/setup-uv@v7
16+
- run: uv build
17+
- run: uv publish
18+
env:
19+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}

.github/workflows/security.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Security
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
osv-scan:
15+
name: Dependency Scan
16+
runs-on: blacksmith-2vcpu-ubuntu-2404
17+
timeout-minutes: 5
18+
steps:
19+
- uses: actions/checkout@v6
20+
21+
- name: Install osv-scanner
22+
run: |
23+
curl -fsSL https://github.com/google/osv-scanner/releases/download/v2.3.2/osv-scanner_linux_amd64 -o osv-scanner
24+
chmod +x osv-scanner
25+
26+
- name: Scan dependencies
27+
run: ./osv-scanner --lockfile=uv.lock --format=table || true
28+
29+
pip-audit:
30+
name: Python Audit
31+
runs-on: blacksmith-2vcpu-ubuntu-2404
32+
timeout-minutes: 5
33+
steps:
34+
- uses: actions/checkout@v6
35+
- uses: astral-sh/setup-uv@v7
36+
- uses: actions/setup-python@v6
37+
with:
38+
python-version: "3.13"
39+
40+
- name: Install pip-audit
41+
run: pip install pip-audit
42+
43+
- name: Audit dependencies
44+
run: |
45+
uv export --format requirements-txt --no-hashes > requirements.txt
46+
pip-audit -r requirements.txt --disable-pip --no-deps || true
47+

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
__pycache__/
2+
*.pyc
3+
.venv/
4+
dist/
5+
*.egg-info/
6+
.pytest_cache/
7+
.ruff_cache/
8+
.env
9+
coverage/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 AgentScore
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# agentscore-py
2+
3+
[![PyPI version](https://img.shields.io/pypi/v/agentscore-py.svg)](https://pypi.org/project/agentscore-py/)
4+
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](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)

agentscore/__init__.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from agentscore.client import AgentScore
2+
from agentscore.errors import AgentScoreError
3+
from agentscore.types import (
4+
AgentRecord,
5+
AgentsListResponse,
6+
AssessResponse,
7+
DecisionPolicy,
8+
EntityType,
9+
Grade,
10+
ReputationResponse,
11+
ReputationStatus,
12+
StatsERC8004,
13+
StatsPayments,
14+
StatsReputation,
15+
StatsResponse,
16+
)
17+
18+
__all__ = [
19+
"AgentRecord",
20+
"AgentScore",
21+
"AgentScoreError",
22+
"AgentsListResponse",
23+
"AssessResponse",
24+
"DecisionPolicy",
25+
"EntityType",
26+
"Grade",
27+
"ReputationResponse",
28+
"ReputationStatus",
29+
"StatsERC8004",
30+
"StatsPayments",
31+
"StatsReputation",
32+
"StatsResponse",
33+
]
34+
35+
__version__ = "2.0.0"

0 commit comments

Comments
 (0)