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.

Metadata

Release files for anvaya-sdk 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 anvaya-sdk 0.1.0
File Size Uploaded Provenance Actions
anvaya_sdk-0.1.0.tar.gz 24.6 kB With provenance Details for anvaya_sdk-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for anvaya-sdk 0.1.0
File Interpreter ABI Platform Actions
anvaya_sdk-0.1.0-py3-none-any.whl Python 3 none any Details for anvaya_sdk-0.1.0-py3-none-any.whl

Total release size: 43.7 kB

Release files / anvaya_sdk-0.1.0.tar.gz

Download URL anvaya_sdk-0.1.0.tar.gz
Size 24.6 kB
Tags Source
SHA-256 checksum
How to use checksums
edcee721499ca10eb14113adab80e1f97bfd2f89ea2e8a3389651be7112acad9
BLAKE2b-256 checksum
How to use checksums
17547ea0106272d05aa63a5c1a920cdfe85a4a4a46660cf281597d613f6f8b76
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 Aug 7, 2026.

Transparency log

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

Download URL anvaya_sdk-0.1.0-py3-none-any.whl
Size 19.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ed5c487a22a8dd6fa9f1ba619b4ae354ed83df6374118a8ebdc714978ddbccd
BLAKE2b-256 checksum
How to use checksums
a4e20cc4047b63b09ed5a841fa3092154db7e83d359a7e266a4b8d657f705bbe
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 Aug 7, 2026.

Transparency log

Security for anvaya-sdk 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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for anvaya_sdk-0.1.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 Aug 7, 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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