Skip to main content

Agent Vault Protocol - Secure credential management for AI agents

Project description

AVP Shield

avp-py

Python implementation of Agent Vault Protocol
Standard conformance · Async support · Type hints

PyPI Python CI License


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.


Specification · Documentation · Issues

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

avp_sdk-0.1.0.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

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

avp_sdk-0.1.0-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: avp_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for avp_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 74f58e40af4e057048463562a4d29a2f1734a4bd222e3ac17fc3b4bfa86020ea
MD5 8b0c98103a4c91338ac972b3e58b2a7f
BLAKE2b-256 eda0526ca5c45614daa64376a0e4df6ba195621c73cea18e389a156a39c2cf16

See more details on using hashes here.

File details

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

File metadata

  • Download URL: avp_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for avp_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0d20a72eb4a00ba8b303dbb460c5f69325c4cc0860fafb0e02cd1ec992ad587
MD5 7cd5944e4127351d4bd9ae62733fc821
BLAKE2b-256 7f47aff904053b4cfc9ad8c30ef176ded081dd562780a559c02c6b236311b911

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