Python SDK
Official Python SDK for the soft.house API.
Installation
pip install soft-house
Requirements: Python 3.9+
Quick Start
from soft_house import SoftHouse
soft = SoftHouse(api_key="sk_test_...")
# Create a wish
wish = soft.wishes.create(
query="Find me a laptop under $1500",
budget={"max": 1500, "currency": "USD"},
)
print(wish.id, wish.status)
Configuration
soft = SoftHouse(
api_key="sk_test_...",
base_url="https://api.soft.house", # default
timeout=30.0, # seconds
max_retries=3, # auto-retry on 5xx
)
Resources
Wishes
# Create
wish = soft.wishes.create(query="Find me headphones", budget={"max": 200})
# List
wishes = soft.wishes.list(status="active", limit=10)
# Get
wish = soft.wishes.get("wish_abc123")
# Update
wish = soft.wishes.update("wish_abc123", status="cancelled")
# Delete
soft.wishes.delete("wish_abc123")
Mandates
# Create AP2 mandate
mandate = soft.mandates.create(
type="intent",
protocol_type="ap2",
max_amount=1500,
)
# List mandates
mandates = soft.mandates.list(protocol_type="ap2")
Payments
payment = soft.payments.create(
mandate_id="mnd_abc123",
amount=119999,
idempotency_key="pay_unique_456",
)
Async Support
import asyncio
from soft_house import AsyncSoftHouse
async def main():
soft = AsyncSoftHouse(api_key="sk_test_...")
wish = await soft.wishes.create(
query="Find me a laptop",
budget={"max": 1500},
)
print(wish.id)
asyncio.run(main())
Error Handling
from soft_house import SoftHouseError
try:
wish = soft.wishes.create(query="...")
except SoftHouseError as e:
print(e.code) # 'validation_error'
print(e.message) # Human-readable
print(e.status_code) # HTTP status
print(e.request_id) # For support
The Python SDK is under active development. Some features shown here represent the target API design.