Skip to main content

anvaya-sdk — Python SDK

Standard library only. No requests, no pydantic, no transitive anything.

pip install anvaya-sdk

⚠️ Install anvaya-sdk, import anvaya. The bare name anvaya on PyPI belongs to an unrelated mathematics library by another author — pip install anvaya fetches that, not this. The import name is unchanged.

import anvaya

anvaya.init(api_key="anv_prod_...", endpoint="https://api.anvaya.dev")

with anvaya.span("llm.answer", kind="llm", provider="anthropic") as s:
    response = model.complete(prompt)
    s["outputTokens"] = response.usage.output_tokens

The handle yielded by span() is a plain dict; assigning to it before the block exits adds fields to the span. The block is timed automatically, and an exception raised inside it is recorded as status="error" with the exception's type name — and then re-raised. The SDK never swallows your exception.

Configuration

Argument Environment Default
api_key ANVAYA_API_KEY ""
endpoint ANVAYA_ENDPOINT http://localhost:4318
environment production
batch_size 256
flush_interval 5.0 s
queue_limit 10 000 spans

With no API key the client is inert: no thread, no timer, no network, no exception. A developer running your test suite without credentials gets silence rather than a stack trace or a hang.

What it will not do

Each of these has a test in tests/, and a matching test in the Node SDK.

  • Raise into your request path. The only exception this package raises is SpanError, and only for genuinely malformed instrumentation — at the line that wrote it, not from a background thread pointing somewhere else. Transport failures, 5xx responses, a dead endpoint and a full queue are all counters, readable via client.stats().
  • Send your prompts. content= is hashed to a sha256: reference. The payload goes only where you configure it to.
  • Hold your process open. The flush thread is a daemon and close() is registered with atexit.
  • Retry a 402, 401 or 403. A quota rejection means the fix is commercial; a bad credential does not fix itself. The client disables itself and says so once.
  • Requeue a failed batch. A queue that refills faster than it drains during an outage is how an SDK causes the memory exhaustion it was meant to observe.
  • Drop the newest span under pressure. It drops the oldest. During an incident the newest spans are the ones describing it.
  • Guess a timestamp. An unparseable startedAt raises rather than defaulting to now() — a span stamped with its arrival time looks correct and poisons every latency number derived from it.

Tests

No test dependencies either:

py -m unittest discover -s tests      # Windows
python3 -m unittest discover -s tests # everywhere else

tests/test_conformance.py reads ../conformance/corpus.json, the same file the Node SDK and the control plane are tested against. See ../README.md for why that file exists.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anvaya_sdk-0.1.0.tar.gz (24.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anvaya_sdk-0.1.0-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file anvaya_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: anvaya_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 24.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for anvaya_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 edcee721499ca10eb14113adab80e1f97bfd2f89ea2e8a3389651be7112acad9
MD5 9a33757d7d59cfd2f0e0b57d7714d629
BLAKE2b-256 17547ea0106272d05aa63a5c1a920cdfe85a4a4a46660cf281597d613f6f8b76

See more details on using hashes here.

Provenance

The following attestation bundles were made for anvaya_sdk-0.1.0.tar.gz:

Publisher: publish-python-sdk.yml on siddhashutosh/anvaya-platform

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file anvaya_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: anvaya_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for anvaya_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8ed5c487a22a8dd6fa9f1ba619b4ae354ed83df6374118a8ebdc714978ddbccd
MD5 ae6f5ea8673f63578ad30ce51bacb799
BLAKE2b-256 a4e20cc4047b63b09ed5a841fa3092154db7e83d359a7e266a4b8d657f705bbe

See more details on using hashes here.

Provenance

The following attestation bundles were made for anvaya_sdk-0.1.0-py3-none-any.whl:

Publisher: publish-python-sdk.yml on siddhashutosh/anvaya-platform

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

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