Skip to content

agentscore/python-sdk

agentscore-py

PyPI version License: MIT

Python client for the AgentScore trust and reputation API.

Install

pip install agentscore-py

Quick Start

from 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

async with AgentScore(api_key="as_live_...") as client:
    rep = await client.aget_reputation("0x1234...")
    result = await client.aassess("0x1234...", policy={"min_grade": "B"})

Context Manager

with AgentScore(api_key="as_live_...") as client:
    rep = client.get_reputation("0x1234...")

Configuration

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)

Error Handling

from agentscore import AgentScore, AgentScoreError

try:
    rep = client.get_reputation("0xinvalid")
except AgentScoreError as e:
    print(e.code, e.status_code, str(e))

Documentation

License

MIT

About

Python client for the AgentScore trust and reputation API

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages