Zero-knowledge verifiable agent actions — cryptographic proof without accessing your data
Project description
Authevo Python SDK
Official Python SDK for Authevo - Cryptographically verifiable agent actions with policy enforcement.
Features
- ✅ Cryptographic Signatures: Ed25519 signatures for every action
- ✅ Policy Enforcement: OPA integration for runtime policy evaluation
- ✅ Automatic Retries: Exponential backoff on transient failures
- ✅ Idempotency: Built-in idempotency key generation
- ✅ Framework Integrations: LangChain and CrewAI support
- ✅ Async/Await: Full async support for high performance
- ✅ Type Safe: Comprehensive type hints
Installation
pip install authevo
Optional Dependencies
# LangChain integration
pip install authevo[langchain]
# CrewAI integration
pip install authevo[crewai]
# All integrations
pip install authevo[all]
# Development dependencies
pip install authevo[dev]
Quick Start
import asyncio
from authevo import AuthevoAgent
async def main():
# Generate a new agent
async with AuthevoAgent.generate() as agent:
print(f"Agent DID: {agent.keypair.did}")
# Register with the API
await agent.register(name="My Agent")
# Execute a verifiable action
result = await agent.execute_action(
action="refund",
payload={"orderId": "123", "amount": 50}
)
print(f"Action submitted: {result['id']}")
print(f"Policy decision: {result['policyDecision']['decision']}")
asyncio.run(main())
Configuration
Configure the SDK via environment variables or code:
Environment Variables
export AUTHEVO_API_URL="https://api.authevo.com"
export AUTHEVO_API_KEY="authevo_..."
export AUTHEVO_TIMEOUT=30
export AUTHEVO_MAX_RETRIES=3
Programmatic Configuration
from authevo import AuthevoAgent, AuthevoConfig
config = AuthevoConfig(
api_url="https://api.authevo.com",
api_key="authevo_...",
timeout=30,
max_retries=3
)
agent = AuthevoAgent.generate(config=config)
Framework Integrations
LangChain
from authevo import AuthevoAgent
from authevo.langchain import VerifiableTool
from langchain.agents import initialize_agent
from langchain.llms import OpenAI
# Create Authevo agent
agent = AuthevoAgent.generate()
# Wrap as LangChain tool
refund_tool = VerifiableTool(
name="process_refund",
description="Process customer refund with policy enforcement",
authevo_agent=agent,
action="refund"
)
# Use with LangChain
llm = OpenAI(temperature=0)
langchain_agent = initialize_agent(
tools=[refund_tool],
llm=llm,
agent="zero-shot-react-description"
)
result = langchain_agent.run("Process a refund for order-123, amount $50")
CrewAI
from authevo import AuthevoAgent
from authevo.crewai import verifiable_task
agent = AuthevoAgent.generate()
@verifiable_task(agent=agent, action="refund")
def process_refund(order_id: str, amount: float):
# Your refund logic here
return {"status": "refunded", "amount": amount}
# Function automatically verifies before execution
result = process_refund("order-456", 75.0)
Error Handling
The SDK provides specific exceptions for different error scenarios:
from authevo import (
AuthevoAgent,
PolicyDeniedError,
AuthenticationError,
RateLimitError,
NetworkError
)
async with AuthevoAgent.generate() as agent:
try:
result = await agent.execute_action(
action="refund",
payload={"orderId": "123", "amount": 500}
)
except PolicyDeniedError as e:
print(f"Action denied by policy: {e.reason}")
print(f"Policy ID: {e.policy_id}")
except AuthenticationError:
print("Invalid API key")
except RateLimitError as e:
print(f"Rate limited. Retry after {e.retry_after}s")
except NetworkError as e:
print(f"Network error: {e}")
Automatic Retries
The SDK automatically retries on transient failures with exponential backoff:
# Default: 3 retries with 2s base delay
# Attempt 1: immediate
# Attempt 2: wait 2s
# Attempt 3: wait 4s
# Attempt 4: wait 8s
# Customize retry behavior
config = AuthevoConfig(
api_url="https://api.authevo.com",
max_retries=5 # Up to 5 retry attempts
)
Examples
See the examples/ directory for more:
basic_usage.py- Basic SDK usagelangchain_example.py- LangChain integrationcrewai_example.py- CrewAI integration
Documentation
Development
# Install in development mode
pip install -e .[dev]
# Run tests
pytest
# Format code
black authevo/ tests/
# Type checking
mypy authevo/
License
MIT - See LICENSE for details.
Support
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
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 authevo-1.1.0.tar.gz.
File metadata
- Download URL: authevo-1.1.0.tar.gz
- Upload date:
- Size: 26.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
169aa5aab98224a48784acb73eef80c862cbdedd382c8c388c79534f7ebefa41
|
|
| MD5 |
c9e9e907fabbf821aa05eb81c57434c1
|
|
| BLAKE2b-256 |
74de679c14877af69a4b89067e50f0424a8c309314cb3ab4000d15ded7fd6bc7
|
File details
Details for the file authevo-1.1.0-py3-none-any.whl.
File metadata
- Download URL: authevo-1.1.0-py3-none-any.whl
- Upload date:
- Size: 21.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7648bafd60e2030f0369aa27d51257d61c47059783153f3f3aec615bbf295ef3
|
|
| MD5 |
bad37678437ed97e2ea27682a2329b32
|
|
| BLAKE2b-256 |
7f7bb4cab4c10d3668974ae012a9ca7dc05d29bee7d62e11f0d70b94d11d5f0e
|