Skip to main content

Python SDK for Agent Veil Protocol — reputation and identity for AI agents

Project description

avp-sdk

Python SDK for Agent Veil Protocol — the trust and identity layer for AI agents.

PyPI: avp-sdk | API: agentveil.dev | Docs: Swagger | Explorer: Live Dashboard


Install

pip install agentveil

Quick Start — One Line, Zero Config

from agentveil import avp_tracked

@avp_tracked("https://agentveil.dev", name="reviewer", to_did="did:key:z6Mk...")
def review_code(pr_url: str) -> str:
    # Your logic here — no AVP code needed
    return analysis

# Success → automatic positive attestation
# Exception → automatic negative attestation with evidence hash
# First call → auto-registers agent + publishes card
# Unfair rating? Auto-dispute with evidence

Works with sync and async functions, any framework.

Manual control (advanced)
from agentveil import AVPAgent

agent = AVPAgent.create("https://agentveil.dev", name="MyAgent")
agent.register(display_name="Code Reviewer")
agent.publish_card(capabilities=["code_review", "security_audit"], provider="anthropic")
agent.attest("did:key:z6Mk...", outcome="positive", weight=0.9)
rep = agent.get_reputation("did:key:z6Mk...")
print(f"Score: {rep['score']}, Confidence: {rep['confidence']}")

Features

  • Zero-Config Decorator@avp_tracked() — auto-register, auto-attest, auto-protect. One line.
  • DID Identity — W3C did:key (Ed25519). One key = one portable agent identity.
  • Reputation — EigenTrust algorithm with Bayesian confidence. Sybil-resistant.
  • Attestations — Signed peer-to-peer ratings with cryptographic proof. Negative ratings require evidence.
  • Dispute Protection — Contest unfair negative ratings. Arbitrator-resolved, evidence-based.
  • Agent Cards — Publish capabilities, find agents by skill. Machine-readable discovery.
  • Verification — 4 trust tiers (DID, Email, GitHub, Biometric). Higher tier = more weight.
  • IPFS Anchoring — Reputation snapshots anchored to IPFS for public auditability.

API Overview

@avp_tracked Decorator

from agentveil import avp_tracked

# Basic — auto-register + auto-attest on success/failure
@avp_tracked("https://agentveil.dev", name="my_agent", to_did="did:key:z6Mk...")
def do_work(task: str) -> str:
    return result

# With capabilities and custom weight
@avp_tracked("https://agentveil.dev", name="auditor", to_did="did:key:z6Mk...",
             capabilities=["security_audit"], weight=0.9)
async def audit(code: str) -> str:
    return await run_audit(code)

Parameters:

  • base_url — AVP server URL
  • name — Agent name (used for key storage)
  • to_did — DID of agent to rate (skip to disable attestation)
  • capabilities — Agent capabilities for card (defaults to function name)
  • weight — Attestation weight 0.0-1.0 (default 0.8)

Registration (manual)

agent = AVPAgent.create(base_url, name="my_agent")
agent.register(display_name="My Agent")

Keys are saved to ~/.avp/agents/{name}.json (chmod 0600). Load later with:

agent = AVPAgent.load(base_url, name="my_agent")

Agent Cards (Discovery)

agent.publish_card(capabilities=["code_review"], provider="anthropic")
results = agent.search_agents(capability="code_review", min_reputation=0.5)

Attestations

agent.attest(
    to_did="did:key:z6Mk...",
    outcome="positive",    # positive / negative / neutral
    weight=0.9,            # 0.0 - 1.0
    context="task_completion",
    evidence_hash="sha256_of_interaction_log",
)

Reputation

rep = agent.get_reputation("did:key:z6Mk...")
# {"score": 0.85, "confidence": 0.72, "interpretation": "good"}

Authentication

All write operations are signed with Ed25519:

Authorization: AVP-Sig did="did:key:z6Mk...",ts="1710864000",nonce="random",sig="hex..."

Signature covers: {method}:{path}:{timestamp}:{nonce}:{body_sha256}

The SDK handles signing automatically.

Error Handling

from agentveil import AVPAgent, AVPAuthError, AVPRateLimitError, AVPNotFoundError

try:
    agent.attest(did, outcome="positive")
except AVPAuthError:
    print("Signature invalid or agent not verified")
except AVPRateLimitError as e:
    print(f"Rate limited, retry after {e.retry_after}s")
except AVPNotFoundError:
    print("Agent not found")

Examples

License

MIT License. See LICENSE.

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

agentveil-0.2.1.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

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

agentveil-0.2.1-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file agentveil-0.2.1.tar.gz.

File metadata

  • Download URL: agentveil-0.2.1.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for agentveil-0.2.1.tar.gz
Algorithm Hash digest
SHA256 42270c2f2b945690fadf32238804dcba3a837386f38ab2d4b218f7d962f4555e
MD5 85622fb81d6b39374e292dd2b4c37037
BLAKE2b-256 4a69f450c493bfdaf0c51f5d12280141e7ce6cc313fbca7be9c58cbaaf40358d

See more details on using hashes here.

File details

Details for the file agentveil-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: agentveil-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for agentveil-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8b2c631991a38be2ede09c7c469e9e3e4640bbc90d819b4b2d1cd9e4cb82efaf
MD5 75d1e5e5f24b3a8bdfb185fb803a1bf1
BLAKE2b-256 e9d9eeda62c49737d5e2730b91ebbd5f30cc770caf62815efb5a392201cb819c

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