Skip to main content

Wirebox Python SDK

Official Python SDK for Wirebox — The real-world identity, communication, and context execution layer for AI agents.

Equips autonomous agents with dedicated email inboxes, network tunnels, and webhooks with first-class synchronous and asynchronous support.

PyPI Python Version License: MIT


Key Features

  • Dual Engine: High-performance synchronous Wirebox and native asynchronous AsyncWirebox clients.
  • Identity & Mailbox Hub: Provision autonomous agent personas with atomic dedicated email inboxes (@wireboxmail.com).
  • Zero-Config Network Tunnels: Expose local agent servers or containers to the public internet (https://<handle>.tunnel.wirebox.sh) over secure WebSockets — no ngrok required.
  • Cryptographic Webhook Verification: Constant-time HMAC-SHA256 signature verification (verify_webhook) with anti-replay timestamp validation.
  • Zero Heavy C Dependencies: Built cleanly on httpx and websockets — installs instantly across Linux, macOS, and Windows.
  • Modern Pythonic Design: Full Python 3.11+ type hints (PEP 561 py.typed), immutable dataclasses, and rich exception hierarchy.

Installation

pip install wirebox

Or using modern package managers:

# With uv
uv add wirebox

# With poetry
poetry add wirebox

Quickstart

import asyncio
from wirebox import AsyncWirebox


async def main():
    async with AsyncWirebox(api_key="wb_live_xxxxxxxx") as client:
        # 1. Provision an autonomous agent identity
        agent = await client.create_identity("sales-bot", display_name="Sales Assistant")
        print(f"Created agent @{agent.agent_handle} with inbox {agent.mailbox.email_address}")

        # 2. Dispatch an outbound email
        result = await agent.send_email(
            to="client@example.com",
            subject="Welcome to Wirebox",
            text="Hello! This message was dispatched autonomously by an AI agent.",
        )
        print(f"Email sent with status: {result.status}")

        # 3. Retrieve and iterate over inbox messages
        async for msg in agent.iter_messages():
            print(f"[{msg.direction}] {msg.from_address}: {msg.subject}")


asyncio.run(main())

2. Synchronous Client (For Scripts, REPL & CLI tools)

from wirebox import Wirebox

client = Wirebox(api_key="wb_live_xxxxxxxx")

# Provision or fetch existing identity
agent = client.get_identity("sales-bot")

# Send email
agent.send_email(
    to="support@example.com",
    subject="Agent status update",
    text="All background jobs running normally.",
)

# Whoami identity check
me = client.whoami()
print(f"Authenticated as org: {me.organization.slug} ({me.api_key.role})")

Webhooks & Cryptographic Signature Verification

Wirebox signs every webhook payload with an HMAC-SHA256 signature to guarantee authenticity and prevent tampering or replay attacks.

Use verify_webhook directly in any web framework:

FastAPI / Starlette Example:

from fastapi import FastAPI, Request, HTTPException
from wirebox import verify_webhook

app = FastAPI()
WEBHOOK_SECRET = "whsec_your_signing_secret"


@app.post("/webhook")
async def webhook_endpoint(request: Request):
    raw_body = await request.body()

    # Validates signature and checks timestamp within 300-second window
    if not verify_webhook(payload=raw_body, headers=request.headers, secret=WEBHOOK_SECRET):
        raise HTTPException(status_code=403, detail="Invalid signature")

    payload = await request.json()
    event_type = payload.get("event_type")
    print(f"Received verified event: {event_type}")

    return {"status": "ok"}

Network Tunnels (Local Port Forwarding)

Connect local ports or container services to your agent's public tunnel URL without opening firewall ports or buying static IPs:

import asyncio
from wirebox import AsyncWirebox


async def main():
    async with AsyncWirebox(api_key="wb_live_...") as client:
        agent = await client.get_identity("sales-bot")

        # Reverse-proxy inbound HTTPS traffic from tunnel to local port 3456
        tunnel = await agent.connect_tunnel(forward_to=3456)
        print(f"Public tunnel URL: {tunnel.public_url}")

        # Keep proxying until closed
        await tunnel.wait_closed()


asyncio.run(main())

Exception Hierarchy

All SDK exceptions inherit from WireboxError:

WireboxError
├── WireboxConnectionError         # Network, connection drop, or timeout failures
├── ValidationError                # Client-side parameter validation failure
└── WireboxAPIError                # Non-2xx responses from Wirebox API
    ├── AuthenticationError        # HTTP 401 / 403 (invalid API key or lack of permissions)
    ├── NotFoundError              # HTTP 404 (identity, mailbox, message, or webhook not found)
    ├── RateLimitError             # HTTP 429 (rate limits exceeded)
    ├── HandleAlreadyTakenError    # HTTP 409 (agent_handle already registered)
    └── FreeTierLimitExceededError # HTTP 403/429 (free tier quota limit reached)

Example handling:

from wirebox import Wirebox, HandleAlreadyTakenError, WireboxAPIError

client = Wirebox(api_key="wb_live_...")

try:
    agent = client.create_identity("sales-bot")
except HandleAlreadyTakenError:
    print("Handle is already claimed. Fetching existing identity instead...")
    agent = client.get_identity("sales-bot")
except WireboxAPIError as e:
    print(f"API failed with [{e.status} {e.code}]: {e.message} (request_id: {e.request_id})")

License

MIT © Wirebox

Metadata

Release files for wirebox 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wirebox 0.6.0
File Size Uploaded Provenance
wirebox-0.6.0.tar.gz 120.4 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for wirebox 0.6.0
File Interpreter ABI Platform
wirebox-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 174.6 kB

Release files / wirebox-0.6.0.tar.gz

Download URL wirebox-0.6.0.tar.gz
Size 120.4 kB
Tags Source
SHA-256 checksum
How to use checksums
44916474c6aa6148efaee313dfe0bce46a3cce01f4bc0c7e43debd18e8dc2ec2
BLAKE2b-256 checksum
How to use checksums
97db41ac46fb7daafebc0f5ff31cfdb1e4b89bd7ad5624aa63483d311829f14d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Release files / wirebox-0.6.0-py3-none-any.whl

Download URL wirebox-0.6.0-py3-none-any.whl
Size 54.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2566fadaf176e0177e6f906f3af6c36aa6607ac66e6d202e59e88c7cbb93d97d
BLAKE2b-256 checksum
How to use checksums
b72bff280ef64af1521debec1d3a16bd0f9c075279fadd629357624c2ce69c03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Security for wirebox 0.6.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for wirebox-0.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page