VAC Python Client
Simple Python client for the VAC (Verifiable Agentic Credential) Protocol.
Installation
# Copy vac_client.py to your project, or:
pip install httpx # Recommended for proper multi-header support
Quick Start
from vac_client import VACClient
# Create client
vac = VACClient(
sidecar_url="http://localhost:3000",
root_biscuit="<your-biscuit-token>"
)
# Make requests - receipts auto-accumulate
response = vac.get("/search", params={"q": "flights"})
print(f"Search: {response.status_code}")
response = vac.post("/charge", json={"amount": 100, "currency": "usd"})
print(f"Charge: {response.status_code}")
# Start new workflow (clears receipts, new correlation ID)
vac.clear_receipts()
Features
- Automatic receipt accumulation
- Correlation ID management
- Multiple
X-VAC-Receiptheader support (with httpx) - Error classification (policy violation, expired, etc.)
Error Handling
from vac_client import VACClient, VACError
vac = VACClient(root_biscuit="...")
try:
response = vac.post("/charge", json={"amount": 100})
response.raise_for_status()
except VACError as e:
if e.is_missing_receipt:
print("Need to complete prior steps first")
elif e.is_expired:
print("Receipt expired - restart workflow")
elif e.is_policy_violation:
print(f"Policy denied: {e.message}")
Multi-Step Workflows
import uuid
from vac_client import VACClient
# All requests in a workflow share a correlation ID
vac = VACClient(
root_biscuit="...",
correlation_id=str(uuid.uuid4()) # Or let it auto-generate
)
# Step 1: Search
vac.get("/search", params={"q": "flights to NYC"})
# Step 2: Select (policy may require search first)
vac.post("/select", json={"flight_id": "AA123"})
# Step 3: Charge (policy may require search + select)
vac.post("/charge", json={"amount": 35000})
# Receipts are automatically included in each request
print(f"Receipts collected: {len(vac.receipts)}")
Requirements
- Python 3.7+
httpx(recommended) orrequests
Observability: For OpenTelemetry tracing of VAC requests, install with pip install vac-client[opentelemetry] and use opentelemetry-instrumentation-httpx, or see docs/OBSERVABILITY.md in the repo.
Multi-step workflows (search → select → charge): The sidecar expects multiple X-VAC-Receipt headers, one per prior step. The requests library cannot send multiple headers with the same name, so multi-step workflows will fail with requests. Use httpx for any flow that accumulates more than one receipt.
License
MIT
Metadata
Release files for vac-client 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 | |
|---|---|---|---|
| vac_client-0.1.0.tar.gz | 6.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vac_client-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.0 kB
Release files / vac_client-0.1.0.tar.gz
| Download URL | vac_client-0.1.0.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8daa292c51e947bbd0ac2b1d4c56bca73bcd4a6986e86e574a6bfd48dd14cc7a
|
|
BLAKE2b-256 checksum How to use checksums |
0ee34dee95e0f6c14bfd3932ff829912c2acfefe26dd775126fe9947741179c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / vac_client-0.1.0-py3-none-any.whl
| Download URL | vac_client-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e774cb6334ca2cc21f02fa110d5bb64903b40b2bca7ed8f3919fb41ea95ad311
|
|
BLAKE2b-256 checksum How to use checksums |
9c0c17209eea039e3d91ca0605e546607788e0be3224dcccc11f6d4d22f435ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|