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.6.0.tar.gz (21.1 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.6.0-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sensu_sdk-0.6.0.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for sensu_sdk-0.6.0.tar.gz
Algorithm Hash digest
SHA256 c24757263f69dc1e3b073e49b2501e4a77e5a4e8756da9ecc1214d7086964cd6
MD5 959a9cbf0b34a93ccc1ed71ed600434f
BLAKE2b-256 be34bba9a51c7012656951553d4fb11befd67089d53582103d780c40ba1799b5

See more details on using hashes here.

File details

Details for the file sensu_sdk-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: sensu_sdk-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for sensu_sdk-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 168f0d5caeeb1768556d1f32ef5572d21a631924c67dfe99864d2cc80f245e59
MD5 3aa36b2855dd1afe1fd49dd1caf412b0
BLAKE2b-256 c55bf6dd116940da1446f5744232e0fd63e09984776c6336ca6269974199af4d

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