Python SDK for verifying AI agent credentials issued by AgentID
Project description
AgentID Python SDK
Python SDK for verifying AI agent credentials issued by AgentID.
Installation
pip install agentid
Quick Start
from agentid import AgentIDClient
# Create client
client = AgentIDClient()
# Verify a credential by ID
result = await client.verify(credential_id="your-credential-uuid")
if result.valid:
print(f"Agent: {result.credential.agent_name}")
print(f"Permissions: {result.credential.permissions}")
else:
print(f"Invalid: {result.error.code} - {result.error.message}")
Features
- Online Verification: Verify credentials against the AgentID API
- Batch Verification: Verify multiple credentials in one request
- Offline Verification: Verify credentials locally using Ed25519 signatures
- Reputation Queries: Get trust scores for agents and issuers
- Type Safety: Full type hints with Pydantic models
Usage
Client Configuration
from agentid import AgentIDClient
# Default configuration
client = AgentIDClient()
# Custom configuration
client = AgentIDClient(
base_url="https://agentid-dashboard.vercel.app",
timeout=10.0,
)
Online Verification
# Verify by credential ID
result = await client.verify(credential_id="uuid")
# Verify a full credential payload
result = await client.verify(credential=credential_payload)
Batch Verification
result = await client.verify_batch(
credentials=[
{"credential_id": "uuid1"},
{"credential_id": "uuid2"},
{"credential": full_payload},
],
fail_fast=False,
include_details=True,
)
print(f"Valid: {result.summary.valid}/{result.summary.total}")
for item in result.results:
if item.valid:
print(f" [{item.index}] Valid: {item.credential.agent_name}")
else:
print(f" [{item.index}] Invalid: {item.error.code}")
Offline Verification
from agentid import verify_credential_offline
result = verify_credential_offline(
credential=credential_payload,
issuer_public_key="base64-encoded-public-key",
)
Reputation
# Get agent reputation
reputation = await client.get_reputation(credential_id="uuid")
print(f"Trust score: {reputation.trust_score}")
# Get leaderboard
leaderboard = await client.get_leaderboard(limit=10)
for entry in leaderboard:
print(f"{entry.rank}. {entry.agent_name} ({entry.trust_score})")
Context Manager
async with AgentIDClient() as client:
result = await client.verify(credential_id="uuid")
Error Handling
from agentid import AgentIDError, CredentialNotFoundError
try:
result = await client.verify(credential_id="invalid-uuid")
except CredentialNotFoundError:
print("Credential does not exist")
except AgentIDError as e:
print(f"Verification error: {e.code} - {e.message}")
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
agentid-1.0.0.tar.gz
(10.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentid-1.0.0.tar.gz.
File metadata
- Download URL: agentid-1.0.0.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b631ea683ce18cd9f64f7b405ffc54d10118e08a8a30519ef031341646df20ae
|
|
| MD5 |
c272918ea79657c63f97b7cbd83e3e66
|
|
| BLAKE2b-256 |
c4a6d8549717d844f80595c20acdadccbdd724d306871c458be6f73ed52d5755
|
File details
Details for the file agentid-1.0.0-py3-none-any.whl.
File metadata
- Download URL: agentid-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4209397b8b40648c39be92e13d411ec607313b4678ed019b4d8ee64d75278255
|
|
| MD5 |
329ca4800830d7a7408f7af0127bf659
|
|
| BLAKE2b-256 |
36a6cd58fa4146eff4935fdeb6e112052b5230d5052f7e188c99b999ab18517c
|