avp-py
Python implementation of Agent Vault Protocol
Standard conformance · Async support · Type hints
Overview
avp-py is the official Python implementation of the Agent Vault Protocol (AVP). It provides a simple, Pythonic interface for secure credential management in AI agent systems.
Features
- Standard AVP Conformance — All 7 core operations
- Multiple Backends — File, Keychain, Remote (Hardware via USB bridge)
- Async Support — Both sync and async APIs
- Type Hints — Full typing for IDE support
- Framework Integrations — LangChain, CrewAI, AutoGen ready
Installation
pip install avp-sdk
With optional backends:
pip install avp-sdk[keychain] # OS keychain support
pip install avp-sdk[remote] # Remote vault support (requests)
pip install avp-sdk[all] # All optional dependencies
Quick Start
import avp
# Create vault instance
vault = avp.Vault("avp.toml")
# Authenticate
vault.authenticate()
# Store a secret
vault.store("anthropic_api_key", "sk-ant-...")
# Retrieve a secret
api_key = vault.retrieve("anthropic_api_key")
# Use with context manager (auto-cleanup)
with avp.Vault("avp.toml") as vault:
api_key = vault.retrieve("anthropic_api_key")
Async API
import asyncio
import avp
async def main():
async with avp.AsyncVault("avp.toml") as vault:
await vault.authenticate()
api_key = await vault.retrieve("anthropic_api_key")
print(f"Retrieved key: {api_key[:10]}...")
asyncio.run(main())
Backend Selection
import avp
# File backend (encrypted)
vault = avp.Vault(backend=avp.FileBackend(
path="~/.avp/secrets.enc",
cipher="chacha20-poly1305"
))
# OS Keychain
vault = avp.Vault(backend=avp.KeychainBackend())
# Remote vault
vault = avp.Vault(backend=avp.RemoteBackend(
url="https://vault.company.com",
token="hvs.xxx"
))
Migration
import avp
# Migrate from file to keychain
avp.migrate(
source=avp.FileBackend(path="~/.avp/secrets.enc"),
target=avp.KeychainBackend()
)
Framework Integration
LangChain
from langchain_avp import AVPSecretManager
# Use AVP as LangChain's secret manager
secret_manager = AVPSecretManager("avp.toml")
llm = ChatAnthropic(api_key=secret_manager.get("anthropic_api_key"))
CrewAI
from crewai_avp import AVPCredentialStore
# Use AVP as CrewAI's credential store
credentials = AVPCredentialStore("avp.toml")
agent = Agent(credentials=credentials)
Environment Variable Replacement
Replace insecure .env files:
import avp
# Before: insecure .env file
# ANTHROPIC_API_KEY=sk-ant-...
# After: secure AVP vault
vault = avp.Vault("avp.toml")
os.environ["ANTHROPIC_API_KEY"] = vault.retrieve("anthropic_api_key")
Or use the AVP environment loader:
import avp
# Load all secrets into environment
avp.load_env("avp.toml", [
"anthropic_api_key",
"openai_api_key",
"github_token"
])
API Reference
Vault
| Method | Description |
|---|---|
discover() |
Query vault capabilities |
authenticate(**kwargs) |
Establish session |
store(name, value, **kwargs) |
Store a secret |
retrieve(name) |
Retrieve a secret |
delete(name) |
Delete a secret |
list(**filters) |
List secrets |
rotate(name, strategy) |
Rotate a secret |
Conformance
| Level | Status |
|---|---|
| AVP Core | ✅ Complete |
| AVP Full | ✅ Complete |
| AVP Hardware | ⚠️ Via USB bridge |
Contributing
See CONTRIBUTING.md for development setup.
License
Apache 2.0 — see LICENSE.
Release files for avp-sdk 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| avp_sdk-0.1.0.tar.gz | 17.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| avp_sdk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.3 kB
Release files / avp_sdk-0.1.0.tar.gz
| Download URL | avp_sdk-0.1.0.tar.gz |
|---|---|
| Size | 17.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74f58e40af4e057048463562a4d29a2f1734a4bd222e3ac17fc3b4bfa86020ea
|
|
BLAKE2b-256 checksum How to use checksums |
eda0526ca5c45614daa64376a0e4df6ba195621c73cea18e389a156a39c2cf16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / avp_sdk-0.1.0-py3-none-any.whl
| Download URL | avp_sdk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b0d20a72eb4a00ba8b303dbb460c5f69325c4cc0860fafb0e02cd1ec992ad587
|
|
BLAKE2b-256 checksum How to use checksums |
7f47aff904053b4cfc9ad8c30ef176ded081dd562780a559c02c6b236311b911
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|