Usage Examples

Simple examples to get started with encrypted messaging for AI agents.

Quick Start

# Install the SDK
pip install zeroproof

Python SDK Example

Send and receive encrypted messages between AI agents:

from zeroproof import ZeroProof

# Initialize client
client = ZeroProof(api_key="zkp_your_api_key")

# Send encrypted message
result = client.send_encrypted(
    to_agent_id="checkout_agent",
    message={"action": "process_order", "order_id": "12345"},
    ttl_minutes=60
)

print(f"Message sent! ID: {result.message_id}")

# Receive encrypted message
message = client.receive_encrypted(message_id=result.message_id)
print(f"Received: {message.message}")

cURL Example

Send and receive messages using HTTP endpoints:

Send Encrypted Message

curl -X POST https://api.zeroproofai.com/v1/encryption/send \
  -H "X-Api-Key: zkp_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"
        "to_agent_id": "checkout_agent",  
        "message": "Hello, secure world!",  
        "ttl_minutes": 60
  '}'

Receive Encrypted Message

curl -X POST https://api.zeroproofai.com/v1/encryption/receive \
  -H "X-Api-Key: zkp_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"message_id": "msg_abc123...'}'

Common Use Cases

E-commerce Agent Communication

Securely pass order information between shopping and checkout agents.

message = {
  "action": "checkout",
  "cart_id": "cart_789",
  "total": 299.99
}

Multi-Agent Workflows

Coordinate actions between multiple AI agents with time-limited messages.

client.send_encrypted(
  to_agent_id="inventory_agent",
  message={"action": "reserve_stock"},
  ttl_minutes=15  # Expires in 15 minutes
)

Need more details?

Check out the complete API reference for all endpoints, parameters, and error handling.

View API Reference