Python client for the AgentScore trust and reputation API.
pip install agentscore-pyfrom agentscore import AgentScore
client = AgentScore(api_key="as_live_...")
# Look up cached reputation (free)
rep = client.get_reputation("0x1234...")
print(rep["score"]["value"], rep["score"]["grade"])
# Filter to a specific chain
base_rep = client.get_reputation("0x1234...", chain="base")
# On-the-fly assessment with policy (paid)
result = client.assess("0x1234...", policy={"min_grade": "B", "min_score": 35})
print(result["decision"], result["decision_reasons"])
# Browse agents
agents = client.get_agents(chain="base", limit=10)
print(len(agents["items"]), agents["count"])
# Ecosystem stats
stats = client.get_stats()
print(stats["erc8004"]["known_agents"])async with AgentScore(api_key="as_live_...") as client:
rep = await client.aget_reputation("0x1234...")
result = await client.aassess("0x1234...", policy={"min_grade": "B"})with AgentScore(api_key="as_live_...") as client:
rep = client.get_reputation("0x1234...")| Parameter | Default | Description |
|---|---|---|
api_key |
None |
API key from agentscore.sh |
base_url |
https://api.agentscore.sh |
API base URL |
timeout |
10.0 |
Request timeout (seconds) |
from agentscore import AgentScore, AgentScoreError
try:
rep = client.get_reputation("0xinvalid")
except AgentScoreError as e:
print(e.code, e.status_code, str(e))