Skip to main content

Python SDK for the Sensu AI observability platform

Project description

sensu-sdk

Python SDK for the Sensu AI observability platform.

Migrating from senzu-sdk? The package was renamed; install sensu-sdk and replace from senzu import SenzuClient with from sensu import SensuClient. The legacy senzu-sdk v0.5.x package will continue to work but receives no further updates.

Installation

pip install sensu-sdk                    # core
pip install "sensu-sdk[anthropic]"       # + Anthropic auto-tracking
pip install "sensu-sdk[openai]"          # + OpenAI auto-tracking
pip install "sensu-sdk[langchain]"       # + LangChain callback handler
pip install "sensu-sdk[all]"             # everything

Quick start

import sensu

client = sensu.SensuClient({
    "api_key": "your-api-key",
    "agent_id": "your-agent-id",
    "org_id": "your-org-id",
})

# High-level API with automatic context propagation
async def handle_request():
    async with client.run({"session_id": "abc"}) as run:
        step = run.start_step({"name": "fetch", "step_type": "tool"})
        result = await step.track_tool({"tool_name": "search", "fn": search})
        await step.end()

# Anthropic auto-tracking
from anthropic import AsyncAnthropic
from sensu.integrations.anthropic import WrapAnthropicOptions, wrap_anthropic

anthropic = wrap_anthropic(
    AsyncAnthropic(),
    WrapAnthropicOptions(client=client),
)

async def chat():
    async with client.run({}) as run:
        # messages.create() is tracked automatically
        return await anthropic.messages.create(
            model="claude-sonnet-4-6",
            max_tokens=1024,
            messages=[{"role": "user", "content": "Hello"}],
        )

Environment variables

Variable Description
SENSU_API_KEY API key
SENSU_BASE_URL API base URL (default: http://localhost:3001)
SENSU_AGENT_ID Agent ID
SENSU_ORG_ID Organisation ID

The legacy SENZU_* names are still read as a fallback and emit a deprecation warning. They will be removed in a future release.

Use from_env=True to load from environment:

client = sensu.SensuClient({"from_env": True})

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

sensu_sdk-0.8.0.tar.gz (28.7 kB view details)

Uploaded Source

Built Distribution

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

sensu_sdk-0.8.0-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file sensu_sdk-0.8.0.tar.gz.

File metadata

  • Download URL: sensu_sdk-0.8.0.tar.gz
  • Upload date:
  • Size: 28.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sensu_sdk-0.8.0.tar.gz
Algorithm Hash digest
SHA256 bbf6a27de522b66e826c176dd1e5e43946426b71e2cae4b05accd21183d78f75
MD5 db32e12de85c5e07e13fe3130dafa86a
BLAKE2b-256 77e22fa337e89fbb0c8c8731ebfaf67ab0a270f687a870a647dd9ffff39e88b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for sensu_sdk-0.8.0.tar.gz:

Publisher: publish.yml on sensu-inc/sdk-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 sensu_sdk-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: sensu_sdk-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 23.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sensu_sdk-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1392acd2025108b9bef5edd0cf0dfce3d16387765bded80866fb7c4a37c6977c
MD5 d34d285e5133ae5618672002db671c45
BLAKE2b-256 d9046b46cd91e95dbcdf7579c25497a1e630e3708b3add9568980001e9ac66d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for sensu_sdk-0.8.0-py3-none-any.whl:

Publisher: publish.yml on sensu-inc/sdk-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