Python SDK for Zanii Connect — OAuth connections and tool execution for AI agents
Project description
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="...")
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=toexecute()to make retries safe for side-effecting actions. - Errors: non-2xx responses raise
ZaniiErrorwith.status_codeand.detail. - MCP: AI agents that speak MCP don't need this SDK — point them at
POST https://vault.zanii.agency/api/v1/mcpwith anX-API-Keyheader.
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 carriesreceipt_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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zanii_connect-0.2.0.tar.gz.
File metadata
- Download URL: zanii_connect-0.2.0.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe5dd281e17b2bdea49f6ade39a0f14ca78ec264f1b06fc0a2d593bb3ca0c8ca
|
|
| MD5 |
dfff3850df6d0e6d9d7e58b292044775
|
|
| BLAKE2b-256 |
b75d14d54a0e45d3f0af5ab8b7517f64e896bb83630c452911881fd7fb09ad81
|
File details
Details for the file zanii_connect-0.2.0-py3-none-any.whl.
File metadata
- Download URL: zanii_connect-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29e966d96850b2df2372c30be84458a9be18bddbd16be2bf38a0a89987b19326
|
|
| MD5 |
3bbc14bb12074cac33b5aae89d6fe3a3
|
|
| BLAKE2b-256 |
bd155e9200a6a4212c72587d6142e01c183a65722beb921b8da6bf60d1d91772
|