Skip to main content

Official Python SDK for asertu optimizer AI observability.

Project description

asertu Optimizer Python SDK

SDK oficial de Python para asertu Optimizer, el producto de observabilidad, coste y optimizacion del uso de IA de la plataforma general asertu.

Version actual estable: 1.0.2

Este repositorio contiene exclusivamente el SDK Python oficial del producto asertu Optimizer. La API del SDK esta pensada para integrarse de forma natural en aplicaciones que ya usan LLMs y necesitan registrar eventos, consultar analitica e incorporar historial e insights sin tratar asertu como un cliente REST generico.

Estado actual

La base del SDK ya incluye:

  • cliente oficial AsertuOptimizerClient
  • auth por tenant_api_key, bearer_token y tenant_id
  • eventos de observabilidad LLM
  • tenants
  • paginacion de tenants con limit, cursor e iteracion completa
  • analytics
  • history
  • billing
  • settings
  • paginacion adicional en settings.members, settings.access_requests y settings.invitations
  • insights y recommendations
  • helpers para OpenAI, Anthropic y Bedrock
  • constructor AsertuOptimizerClient.from_env()
  • cliente async AsyncAsertuOptimizerClient
  • telemetria opcional del SDK
  • tests, ejemplo ejecutable y documentacion del repo

Documentacion

La documentacion funcional y de producto se referencia desde optimizer.asertu.ai.

Tambien puedes navegar el material tecnico directamente en el repositorio oficial:

En esta release publica inicial, el SDK se centra en:

  • ingesta de eventos de observabilidad de IA
  • discovery de tenants para usuarios autenticados
  • analytics, insights, recommendations e history tenant-scoped
  • billing y settings de workspace
  • helpers para OpenAI, Anthropic y Bedrock
  • soporte sync y async

Instalacion

pip install asertu-optimizer

Para desarrollo local:

python3 -m pip install -e ".[dev]"

Uso rapido

from asertu_optimizer import AsertuOptimizerClient

client = AsertuOptimizerClient.from_env()

client.events.track_openai_call(
    model="gpt-4.1-mini",
    feature="support_chat",
    input_tokens=1200,
    output_tokens=800,
    status="success",
)

Para consultas tenant-scoped:

client = AsertuOptimizerClient(
    base_url="https://api.optimizer.asertu.ai",
    bearer_token="jwt-token",
    tenant_id="tenant-123",
)

summary = client.analytics.dashboard_summary(preset="today")

Uso async:

from asertu_optimizer import AsyncAsertuOptimizerClient

async_client = AsyncAsertuOptimizerClient.from_env()
summary = await async_client.analytics.dashboard_summary(preset="today")
await async_client.aclose()

Contrato actual

El SDK toma como fuente de verdad el Swagger publicado del producto en optimizer.asertu.ai. Revalidado hoy, 7 de abril de 2026, el contrato publicado sube a version: 1.24.11 y cubre events, tenants, analytics, insights, recommendations, history, billing y settings.

Para eventos de ingesta, el contrato publico actual documenta ai.request.completed como valor por defecto recomendado para event_type, y el SDK queda alineado con ese comportamiento.

Los endpoints paginables publicados hoy son:

  • GET /v1/tenants
  • GET /v1/settings/members
  • GET /v1/settings/access-requests
  • GET /v1/settings/invitations

El SDK cubre esos flujos con limit, cursor e iteradores completos iter_all_*() tanto en sync como en async. En settings.invitations tambien expone resolve_invitation(token=...) para el flujo publico por token.

El SDK expone unicamente metodos respaldados por el Swagger/OpenAPI publicado. No incluye administracion global de plataforma ni placeholders para endpoints fuera del contrato.

Compatibilidad de proveedores

La compatibilidad documental de los helpers de instrumentacion esta verificada a fecha 2026-03-27 y se apoya en la documentacion oficial de cada proveedor.

En este momento:

  • OpenAI: compatible con respuestas tipo Responses API y modelos como gpt-4.1-mini
  • Anthropic: compatible con Messages API y modelos documentados como claude-sonnet-4-20250514
  • Bedrock: compatible con respuestas tipo Converse y modelos como anthropic.claude-sonnet-4-20250514-v1:0

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

asertu_optimizer-1.0.2.tar.gz (34.1 kB view details)

Uploaded Source

Built Distribution

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

asertu_optimizer-1.0.2-py3-none-any.whl (34.7 kB view details)

Uploaded Python 3

File details

Details for the file asertu_optimizer-1.0.2.tar.gz.

File metadata

  • Download URL: asertu_optimizer-1.0.2.tar.gz
  • Upload date:
  • Size: 34.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for asertu_optimizer-1.0.2.tar.gz
Algorithm Hash digest
SHA256 f0501211e87007953a04b3782a32587e1973dd37f2516095aea20b14914cf58f
MD5 e4f63ea6414851ee125f9cc4b8902b23
BLAKE2b-256 c277974514afdc1675a6d30b2528b8e589ae586e42203b3d82a5a34ddd328c8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for asertu_optimizer-1.0.2.tar.gz:

Publisher: publish.yml on asertuplatform/asertu-optimizer-python

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

File details

Details for the file asertu_optimizer-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for asertu_optimizer-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ef07f649ed3c07d13aa1ece2f672c6fb4b70131ba05d3b5f442ce837c73d1048
MD5 d323d79451bcd71b8c8b6b5e4317fb7b
BLAKE2b-256 e23a40cfd9e3b1aff794aa1878148773af644b321e94995e51a93bf3ec10337c

See more details on using hashes here.

Provenance

The following attestation bundles were made for asertu_optimizer-1.0.2-py3-none-any.whl:

Publisher: publish.yml on asertuplatform/asertu-optimizer-python

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

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