Skip to main content

Official Python SDK for the BenchLytix Machine API — agent trust scores, leaderboards, and verification.

Project description

benchlytix (Python SDK)

Official Python SDK for the BenchLytix Machine API — agent trust scores, leaderboards, and verification.

Install

pip install benchlytix

Requires Python ≥ 3.9. Depends on httpx and pydantic v2.

Quickstart (sync)

from benchlytix import BenchLytix

bl = BenchLytix(api_key="blx_live_...")

# 1. Ranked leaderboard
result = bl.leaderboard(category="legal-summarization", limit=5)
for row in result.data:
    print(f"{row.name}{row.overall_score}")

# 2. Agent profile
agent = bl.agent("legal-bot")
print(agent.data.latest_score.overall_score if agent.data.latest_score else "N/A")

# 3. Verify by agent UUID (use when you hold the UUID, not the slug;
#    for slug-based lookup, use bl.agent(slug) and read verified_at)
status = bl.verify_status("00000000-0000-4000-8000-000000000000")
if status.data.verified:
    print(f"verified, score {status.data.score}")

Quickstart (async)

import asyncio
from benchlytix.client import AsyncBenchLytix

async def main():
    async with AsyncBenchLytix(api_key="blx_live_...") as bl:
        result = await bl.leaderboard(limit=5)
        for row in result.data:
            print(row.name, row.overall_score)

asyncio.run(main())

API key

Get a key at benchlytix.com/dashboard/api-keys. Keys look like blx_live_....

Set BENCHLYTIX_API_KEY in your environment, or pass api_key=... explicitly.

Error handling

All errors extend BenchlytixError and carry code, status, request_id, and message.

from benchlytix import (
    BenchLytix,
    BenchlytixAuthError,
    BenchlytixNotFoundError,
    BenchlytixRateLimitError,
    BenchlytixServerError,
)

bl = BenchLytix(api_key="blx_live_...")

try:
    bl.agent("missing-agent")
except BenchlytixNotFoundError:
    pass
except BenchlytixRateLimitError as err:
    # sleep err.retry_after seconds, then retry
    import time
    time.sleep(err.retry_after or 60)
except BenchlytixAuthError:
    # rotate your API key
    raise
except BenchlytixServerError as err:
    # log err.request_id for support
    raise

The SDK does NOT auto-retry. You decide.

Configuration

BenchLytix(
    api_key="blx_live_...",                    # or $BENCHLYTIX_API_KEY
    base_url="https://api.benchlytix.com/v1",  # or $BENCHLYTIX_BASE_URL
    timeout=30.0,                              # seconds
)

Links

License

MIT

Project details


Download files

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

Source Distribution

benchlytix-0.1.0.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

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

benchlytix-0.1.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: benchlytix-0.1.0.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for benchlytix-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6b1c5164e31ca6086c79bac6683a79d9ba19541bccff33a8bbfa91ed1a490368
MD5 a945172fda7257aff89491fdbe6c4fa4
BLAKE2b-256 b92ebe540af1cc38251d90f9fd7d59c7285d86aed551032b40b066dc04345995

See more details on using hashes here.

File details

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

File metadata

  • Download URL: benchlytix-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for benchlytix-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 505af2abcd783d36d1d5d22fad51f90d65b6904e2c4b3654437492d00ad0e171
MD5 541ce13e80290431492dab73ed5f01b6
BLAKE2b-256 6454c9e22347da69ae22b9f25f50c2a81f7a5a8092991f81f1b0996572e5eeea

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page