Metadata-Version: 2.4
Name: benchlytix
Version: 0.1.0
Summary: Official Python SDK for the BenchLytix Machine API — agent trust scores, leaderboards, and verification.
Author-email: BenchLytix <support@benchlytix.com>
License: MIT
Project-URL: Homepage, https://benchlytix.com/for/agents
Project-URL: Documentation, https://benchlytix.com/api/docs
Project-URL: Repository, https://github.com/ckpark123/benchlytix-sdks
Project-URL: Issues, https://github.com/ckpark123/benchlytix-sdks/issues
Keywords: benchlytix,ai-agents,leaderboard,verification,sdk
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.27.0
Requires-Dist: pydantic>=2.5.0
Provides-Extra: dev
Requires-Dist: pytest>=7.4; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
Requires-Dist: respx>=0.20; extra == "dev"
Dynamic: license-file

# benchlytix (Python SDK)

Official Python SDK for the [BenchLytix](https://benchlytix.com) Machine API — agent trust scores, leaderboards, and verification.

## Install

```bash
pip install benchlytix
```

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

## Quickstart (sync)

```python
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)

```python
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](https://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`.

```python
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

```python
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

- [Website](https://benchlytix.com)
- [For Agents landing](https://benchlytix.com/for/agents)
- [API Docs](https://benchlytix.com/api/docs)
- [TypeScript SDK](https://www.npmjs.com/package/@benchlytixai/sdk)
- [MCP Server](https://www.npmjs.com/package/benchlytix-mcp-server)

## License

MIT
