Skip to main content

Python SDK for DJD Agent Score — trust scoring for AI agent wallets on Base

Project description

agentscore

Python SDK for the DJD Agent Score API — trust scoring for AI agent wallets on Base.

Listed in the Coinbase x402 Ecosystem PyPI version

Install

pip install agentscore

With framework integrations

pip install agentscore[langchain]   # LangChain tools
pip install agentscore[crewai]      # CrewAI tools
pip install agentscore[all]         # Everything

Quick Start

from agentscore import AgentScoreClient

client = AgentScoreClient()
result = client.basic_score("0xABC...")

print(result.score)           # 72
print(result.tier)            # "Trusted"
print(result.recommendation)  # "proceed"

Async

from agentscore import AsyncAgentScoreClient

async with AsyncAgentScoreClient() as client:
    result = await client.basic_score("0xABC...")

Trust Gate Decorator

Guard any function with a trust check:

from agentscore import trust_gate

@trust_gate(min_score=50)
def send_payment(wallet: str, amount: float):
    # Only runs if wallet scores >= 50
    ...

LangChain

from agentscore.langchain import AgentScoreTool, TrustGatedTool

# Add trust checking as a tool
tools = [AgentScoreTool(), ...other_tools]

# Wrap an existing tool with trust gating
safe_transfer = TrustGatedTool(
    tool=transfer_tool,
    min_score=50,
    wallet_param="recipient",
)

CrewAI

from agentscore.crewai import check_agent_trust

agent = Agent(
    role="Transaction Validator",
    tools=[check_agent_trust],
)

API Methods

Method Description Tier
basic_score(wallet) Basic reputation score Free
full_score(wallet) Full score with dimensions Paid (x402)
refresh_score(wallet) Force refresh from chain Paid (x402)
should_transact(wallet) Quick yes/no check Free
gate_transaction(wallet) Full gating decision Free
report_fraud(wallet, reason) Submit fraud report Free
check_blacklist(wallet) Check fraud reports Paid (x402)
get_badge(wallet) SVG trust badge Free
get_leaderboard(limit) Top scored agents Free
register_agent(wallet, ...) Register agent wallet Free
health_check() API health status Free

Error Handling

from agentscore import PaymentRequiredError, NetworkError

try:
    result = client.full_score("0xABC...")
except PaymentRequiredError as e:
    print(f"Payment needed: {e.accepts[0].max_amount_required} {e.accepts[0].asset}")
    print(f"Pay to: {e.accepts[0].pay_to}")
except NetworkError as e:
    print(f"API error: {e} (status: {e.status_code})")

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-0.1.0.tar.gz (12.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-0.1.0-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file agentscore-0.1.0.tar.gz.

File metadata

  • Download URL: agentscore-0.1.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for agentscore-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8193db919b00ab11c4eb5f9db7a7621c54694c307b261a766726d4db59fe659b
MD5 2c08712e821816399f9447748747a9d2
BLAKE2b-256 30c21643e60c4ea1fa135fce44ddca7e41f4f65f2a79ce80f462894cd510109c

See more details on using hashes here.

File details

Details for the file agentscore-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: agentscore-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for agentscore-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d34da9e7a5e98a3d16a5552ea7e4171801a0a7b376bc224574378f5736a2411
MD5 cd15d578989dbab23f5eb15fdf68f51c
BLAKE2b-256 44e2b0079929f93a39d1828173809eb6cdcf3e98a6384021dc7fe7e455d2bac4

See more details on using hashes here.

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