Skip to main content

zanii-campus

The firm SDK for Zanii Campus (Python). Your company declares its AI agents and where they run, counts outcomes on your own servers and sends DIFC one signed batch of counts per deployment every five minutes. Records are signed byte for byte like the TypeScript SDK (@zanii/campus-sdk).

What is sent

Counts only, signed with your company key:

  • Your agents: DID, a short product name, a kind (chatbot, voice, workflow, ...).
  • Your deployments: an id, the agent, a client pseudonym you choose (never a client name), sector, country, channel, start and end dates.
  • Outcome batches: per deployment and period, the number of sessions and queries, how many were resolved, escalated, failed or refused, and p50/p95 latency in milliseconds.

What is never sent

Prompts, answers, documents, customer names, phone numbers, IDs, emails or any other text from a conversation. Every record is a closed shape and sign_record refuses any unknown field before a request is made. The server rejects any content too, so even a modified client cannot send it.

Quickstart (10 minutes)

pip install zanii-campus
  1. Create your company key once and keep it in a secret store (vault, KMS, sealed file). It never leaves your company.
from zanii_campus import new_company_key
key, did = new_company_key()  # save key.hex() to your secret store
  1. Join with the invite DIFC sent you. The token is shown once: store it like a password.
import os
from zanii_campus import CampusClient
campus = CampusClient("https://campus.zanii.agency", company_key=os.environ["CAMPUS_KEY"], state_dir="./var/campus")
token = campus.join("inv_...", "7574")["token"]  # your DIFC registration number

Afterwards construct the client with token=os.environ["CAMPUS_TOKEN"].

  1. Register each agent and each deployment.
campus.register_agent("did:key:z6Mk...", "Support assistant", "chatbot")
campus.deploy("dep-ngo-01", "did:key:z6Mk...", {"ref": "client-7f3a", "sector": "ngo", "country": "AE"}, "whatsapp")
  1. Count outcomes around your agent calls (sync or async functions).
track = campus.tracker("dep-ngo-01")

@track.wrap
async def answer(question): ...            # resolved on return, failed on exception

answer2 = track.wrap(my_agent.answer, lambda result, error: "failed" if error else "resolved")
track.record("refused", new_session=True)  # or count by hand
campus.close()                              # on shutdown: sends the open period

API

  • CampusClient(base_url, token=None, *, company_key, opener=None, state_dir=None, auto_flush=True, max_queued=10000, on_reject=None, on_error=None)
  • join(invite, reg_no) returns {"company", "token"}; me(); register_agent(agent_did, name, kind); deploy(id, agent_did, client, channel, started=None, ended=None) (send again with ended to end it).
  • tracker(deployment_id, period_ms=300000) returns a tracker with record(outcome, latency_ms=None, new_session=False), wrap(fn, classify=None) and flush().
  • flush(), close(), pending, new_company_key(), CampusError (status, reasons, retry_after), and the contract checks (sign_record, verify_record, record_hash, check_*, ContractError).

Reliability

Counting is in memory; one batch per deployment per period; up to 100 batches per request. On 429, 503 or a network error the SDK backs off with exponential jitter (never sooner than Retry-After), keeps counting and resends the same signed batches later (same nonce, so a resend is a duplicate, never a double count). With state_dir, unsent batches are kept on disk (JSON lines, at most 10,000) and resent after a restart. A batch the server rejects is dropped and reported to on_reject. Empty periods are not sent. Standard library HTTP only; the one dependency is zanii.

Apache-2.0.

Metadata

Release files for zanii-campus 0.1.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 zanii-campus 0.1.0
File Size Uploaded Provenance Actions
zanii_campus-0.1.0.tar.gz 19.6 kB Without provenance Details for zanii_campus-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for zanii-campus 0.1.0
File Interpreter ABI Platform Actions
zanii_campus-0.1.0-py3-none-any.whl Python 3 none any Details for zanii_campus-0.1.0-py3-none-any.whl

Total release size: 35.9 kB

Release files / zanii_campus-0.1.0.tar.gz

Download URL zanii_campus-0.1.0.tar.gz
Size 19.6 kB
Tags Source
SHA-256 checksum
How to use checksums
dc2412676bd1d8abcaadc461038acbad43f624fb4ce68f812945d9368b9d5ed8
BLAKE2b-256 checksum
How to use checksums
91bc66fcc3c8cbebcd56aa2e8821bcd0e28a7c0974425bff0f87b688a2899351
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / zanii_campus-0.1.0-py3-none-any.whl

Download URL zanii_campus-0.1.0-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
99f3131b6bd45e2f4b56a7b992c829c7f8937e9155537ea1b410afe36858528a
BLAKE2b-256 checksum
How to use checksums
6d4ae4159df6feaf6327d733c9975e9a6832035c287d3eb98240c777a03a8813
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for zanii-campus 0.1.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.

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