xbind - Python Bindings
Identity-based M2M authentication for Python.
Python bindings for @private.me/xbind - Authenticated agent-to-agent messaging with cryptographic identity.
Requirements
- Python 3.8+
- Node.js 18+ (required for cryptographic operations)
- @private.me/xbind npm package (installed via
npm install -g @private.me/xbind)
Installation
pip install private-me-xbind
Note: This package requires Node.js and the npm package to be installed:
npm install -g @private.me/xbind
Quick Start
Simple Call API
from private_me.xbind import call
# Call a remote service with xbind authentication
result = call('stripe:createCharge', {
'amount': 100,
'currency': 'usd',
'description': 'AI agent purchase'
})
if result['ok']:
print(f"Charge created: {result['value']['id']}")
else:
print(f"Error: {result['error']['message']}")
Multi-Agent Coordination
from private_me.xbind import connect
# Alice (coordinator)
alice = connect({'role': 'orchestrator'})
# Bob (worker)
bob = connect({'role': 'processor'})
# Alice sends task to Bob
alice['agent'].send({
'to': bob['did'],
'type': 'task',
'data': {
'batch_id': 'batch_2026_05_06_001',
'items': encrypted_payload
}
})
# Bob receives task
message = bob['agent'].receive(timeout=5000)
if message:
print(f"Received task from {message['from_']}")
# Bob processes and responds
bob['agent'].send({
'to': alice['did'],
'type': 'task-complete',
'result': {'processed': 1250, 'status': 'success'}
})
Agent Creation
from private_me.xbind import Agent
# Create agent with auto-generated identity
agent = Agent.create()
print(f"Agent DID: {agent.identity['did']}")
# Send message
agent.send({
'to': 'did:key:z6Mk...',
'type': 'notification',
'data': {'event': 'task-complete'}
})
# Receive messages
message = agent.receive(timeout=10000)
Identity Operations
from private_me.xbind import generate_identity, sign, verify
# Generate Ed25519 identity
identity = generate_identity()
print(f"DID: {identity['did']}")
# Sign message
message = b"Hello, world!"
signature = sign(message, identity['secretKey'])
# Verify signature
is_valid = verify(message, signature, identity['publicKey'])
print(f"Signature valid: {is_valid}")
Batch Calls
from private_me.xbind import batch_call
# Execute multiple calls in parallel
results = batch_call([
('stripe:createCharge', {'amount': 100, 'currency': 'usd'}),
('stripe:createCharge', {'amount': 200, 'currency': 'usd'}),
('stripe:listCharges', {'limit': 10})
])
for result in results:
if result['ok']:
print(f"Success: {result['value']}")
else:
print(f"Error: {result['error']}")
API Reference
call(tool_name, params, options)
Call a remote tool/service with xbind authentication.
Parameters:
tool_name(str): Tool identifier (e.g., 'stripe:createCharge')params(dict, optional): Call parametersoptions(dict, optional): Call options (timeout, retries, constraints)
Returns: CallResult dict with ok flag and value or error
batch_call(calls, options)
Execute multiple calls in parallel.
Parameters:
calls(list): List of (tool_name, params) tuplesoptions(dict, optional): Call options applied to all calls
Returns: List of CallResult dicts
connect(options)
Create a new agent connection.
Parameters:
options(dict, optional): Connection options (did, role, privateKey)
Returns: Connection dict with did and agent
Agent.create(options)
Create a new agent with generated or provided identity.
Parameters:
options(dict, optional): Agent configuration
Returns: Agent instance
Agent Methods
send(options)- Send message to another agentreceive(timeout)- Receive message (blocking)
Identity Functions
generate_identity()- Generate Ed25519 identitysign(message, secret_key)- Sign messageverify(message, signature, public_key)- Verify signaturepublic_key_to_did(public_key)- Convert public key to DID
Type Hints
All functions include comprehensive type hints (PEP 484):
from private_me.xbind import call, CallResult
from typing import Dict, Any
def my_function(params: Dict[str, Any]) -> CallResult:
result: CallResult = call('tool:name', params)
return result
Error Handling
from private_me.xbind import call, XBindAgentError
try:
result = call('stripe:createCharge', {'amount': 100})
if not result['ok']:
print(f"Call failed: {result['error']['message']}")
except XBindAgentError as e:
print(f"Setup error: {e.message} (code: {e.code})")
Architecture
This Python package wraps the Node.js @private.me/xbind library via subprocess:
- Python function calls serialize parameters to JSON
- Node.js subprocess executes xbind operations
- Results are deserialized and returned to Python
Performance: Subprocess overhead is ~10-50ms per call. For high-throughput workloads, use the Node.js API directly.
Requirements
- Python 3.8+
- Node.js 18+ with @private.me/xbind npm package
- typing-extensions (installed automatically)
Development
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest -v
# Type checking
mypy src/
# Format code
black src/ tests/
License
Copyright © 2025 Standard Clouds, Inc. All rights reserved.
This software is proprietary and confidential. For licensing inquiries: contact@private.me
Export Control
This software contains encryption technology that may be subject to U.S. export control laws (EAR 15 CFR 730-774). Export to embargoed countries is prohibited.
Links
Metadata
Release files for private-me-xbind 0.2.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 | Provenance | Actions |
|---|---|---|---|---|
| private_me_xbind-0.2.0.tar.gz | 15.8 kB | Without provenance | Details for private_me_xbind-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| private_me_xbind-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for private_me_xbind-0.2.0-py3-none-any.whl |
Total release size: 30.4 kB
Release files / private_me_xbind-0.2.0.tar.gz
| Download URL | private_me_xbind-0.2.0.tar.gz |
|---|---|
| Size | 15.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6648a79a021a242ec0c62ee5b954ea6ef072fe1dac7e655530f61b83c2120999
|
|
BLAKE2b-256 checksum How to use checksums |
9c2be2c9ed3d67fc1cf692db446f679dd71fe75a8c0b16126a5dba9192f1d021
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / private_me_xbind-0.2.0-py3-none-any.whl
| Download URL | private_me_xbind-0.2.0-py3-none-any.whl |
|---|---|
| Size | 14.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
238b56aa94cb79d0fcd28cbb236340b766d41b579cd87d156b8d24611273ae8d
|
|
BLAKE2b-256 checksum How to use checksums |
b58328a15443fcab0ba5389d8abaedb3dc15f8758d974eb4b7a63453b215191a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for private-me-xbind 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.