Skip to main content

Python client for the AgentScore trust and reputation API

Project description

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")

# Identity gate with policy (paid)
gated = client.assess("0x1234...", policy={
    "require_kyc": True,
    "require_sanctions_clear": True,
    "min_age": 21,
})

if gated["decision"] == "deny":
    print(gated["decision_reasons"])  # ["kyc_required"]
    print(gated.get("verify_url"))    # URL for operator verification

# Check verification level
rep = client.get_reputation("0x1234...")
print(rep.get("verification_level"))  # "none" | "wallet_claimed" | "kyc_verified"

Credential-Based Identity

Agents without wallets can use operator credentials for identity:

result = client.assess(operator_token="opc_...")
print(result["decision"])  # "allow" | "deny"

Verification Sessions

Bootstrap identity for first-time agents:

session = client.create_session()
print(session["verify_url"], session["poll_secret"])

status = client.poll_session(session["session_id"], session["poll_secret"])
if status["status"] == "verified":
    print(status["operator_token"])  # "opc_..." — use for future requests

Credential Management

cred = client.create_credential(label="my-agent", ttl_days=7)
print(cred["credential"])  # shown once

credentials = client.list_credentials()
client.revoke_credential(cred["id"])

Async

All methods have async variants prefixed with a:

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

    # Identity model methods
    session = await client.acreate_session()
    status = await client.apoll_session(session["session_id"], session["poll_secret"])
    cred = await client.acreate_credential(label="my-agent")
    await client.alist_credentials()
    await client.arevoke_credential(cred["id"])

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentscore_py-1.5.0.tar.gz (51.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentscore_py-1.5.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file agentscore_py-1.5.0.tar.gz.

File metadata

  • Download URL: agentscore_py-1.5.0.tar.gz
  • Upload date:
  • Size: 51.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agentscore_py-1.5.0.tar.gz
Algorithm Hash digest
SHA256 bc63ca12894ca02641429e7636d873e6028e4091854f3b272c614d7841d954a9
MD5 72ffa9f43f667ddcd32c1717174fdbee
BLAKE2b-256 3964c6348c995a0691b7a29adcf8dbb9b6f705268332059861f2e02a71385d4c

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentscore_py-1.5.0.tar.gz:

Publisher: publish.yml on agentscore/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agentscore_py-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: agentscore_py-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agentscore_py-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0903f08bfd0f14f8e30199a158c62096e6d61066291196ef711b02fb71fecc44
MD5 3800f11a4bcc51d57c31f502d410b6fd
BLAKE2b-256 a5fa4739d24d3f92e04b482caeb162eeafad82724abc7a08afbd5f3e85cb83fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentscore_py-1.5.0-py3-none-any.whl:

Publisher: publish.yml on agentscore/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page