Skip to main content

zanii-connect — Python SDK

Python client for Zanii Connect: OAuth connections, encrypted token vault, and audited tool execution for AI agents.

Install

pip install zanii-connect

Requires Python 3.10+.

Quickstart

from zanii_connect import ZaniiClient

# Agents/services authenticate with a scoped API key:
nc = ZaniiClient(api_key="nsk_...")

# Or as a user (JWT):
nc = ZaniiClient(email="info@zanii.agency", password="...")

# Or with a bearer token you already hold — a vault session JWT, or a Zanii ID
# access token minted for the vault resource (aud = https://vault.zanii.agency/mcp):
nc = ZaniiClient(token="...")

print(nc.me()["organization"]["name"])

# Connect a provider (open the returned URL in a browser to complete OAuth):
url = nc.connect("gmail", redirect_url="https://vault.zanii.agency/api/v1/connect/oauth/callback")["url"]

# Discover tools and execute one:
conn = nc.connections()["connections"][0]
found = nc.execute("gmail.search", connection_id=conn["id"], parameters={"query": "invoice"})

# Actions that need human approval return an approval link instead of executing:
res = nc.execute("gmail.sendEmail", connection_id=conn["id"],
                 parameters={"to": "info@zanii.agency", "subject": "Hi", "body": "Hello"})
if res.get("requires_approval"):
    print("Ask a human to confirm:", res["approval_url"])

# Long-running work goes through the job queue:
job = nc.execute_async("browser.run", connection_id=conn["id"], parameters={...})
result = nc.wait_for_job(job["job_id"], timeout=300)

Async

from zanii_connect import AsyncZaniiClient

async with AsyncZaniiClient(api_key="nsk_...") as nc:
    tools = await nc.tools()

Same methods as the sync client; with email/password call await nc.login(email, password) once after construction.

Behavior

  • Retries: 429/502/503/504 are retried up to 3 times with exponential backoff.
  • Idempotency: pass idempotency_key= to execute() to make retries safe for side-effecting actions.
  • Errors: non-2xx responses raise ZaniiError with .status_code and .detail. A failed tool call's .detail is the provider's real message (e.g. provider 404: Requested entity was not found.), never empty.
  • MCP: AI agents that speak MCP don't need this SDK — point them at POST https://vault.zanii.agency/api/v1/mcp with an X-API-Key header.

Surface

Covers the full API:

  • Account: signup, login, me, update_profile, change_password, forgot_password, reset_password, email verification, MFA (mfa_enroll/mfa_enable/mfa_disable)
  • API keys: create_api_key (plaintext returned once), api_keys, delete_api_key
  • Org & team: org, usage, update_org, export_org, delete_org, users, invite_user, update_user, deactivate_user, roles (permissions, roles, upsert_role, delete_role), workspaces/projects/environments
  • Registry: providers, provider, provider_actions, actions, action, tools, tool, dynamic-registry admin (register_provider, register_action, unregister_action)
  • Connections: connect, connections, connections_health, delete_connection, share_connection
  • Execution: execute, execute_async, job, wait_for_job · approvals (approvals, approve)
  • Browser sandbox: create_browser_session, browser_session, browser_run, browser_run_async
  • Secrets / automation: secrets, set_secret, delete_secret, triggers, webhook subscriptions
  • Observability: executions (each row carries receipt_hash + proof_url), audit, audit_export_csv, health
  • Proof-of-action: receipts_bundle (offline-verifiable audit bundle), compliance_report (json/markdown)

License

MIT © Zanii Agency

Metadata

Release files for zanii-connect 0.2.1

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

Source distribution (sdist)

Source distribution for zanii-connect 0.2.1
File Size Uploaded Provenance Actions
zanii_connect-0.2.1.tar.gz 10.4 kB Without provenance Details for zanii_connect-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for zanii-connect 0.2.1
File Interpreter ABI Platform Actions
zanii_connect-0.2.1-py3-none-any.whl Python 3 none any Details for zanii_connect-0.2.1-py3-none-any.whl

Total release size: 19.7 kB

Release files / zanii_connect-0.2.1.tar.gz

Download URL zanii_connect-0.2.1.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
04b8e33501b3581f68b6e6593af8ec7b5608a62f4327d85910abc760ad9b41be
BLAKE2b-256 checksum
How to use checksums
8042071eab80b354a440693ef460df990921efd6af39ec74241e0e72d38da446
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / zanii_connect-0.2.1-py3-none-any.whl

Download URL zanii_connect-0.2.1-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3554fcb7293297b9b7785977e73fc4f40651ae913ba45dcca0f768a0894f8c93
BLAKE2b-256 checksum
How to use checksums
1d17e6d56993a61e8f183de4d376882b3c2a4bd4c9b9e3054420d65af81b2807
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for zanii-connect 0.2.1

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.

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