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.7.0.tar.gz (24.0 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.7.0-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sensu_sdk-0.7.0.tar.gz
  • Upload date:
  • Size: 24.0 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.7.0.tar.gz
Algorithm Hash digest
SHA256 fbdfe6149e0fb13b68bf86aaffa3e30a89519f398e2daf572f661141d6078ebb
MD5 2651ca30bc6aff3c3766ed3a8c3836e5
BLAKE2b-256 8c7163945b85fa6db8ab4fb1343364447e389505027a1052d037d29ea6ce26fa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sensu_sdk-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 21.5 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.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d7beb11db0d4acd63a7762c2f2c6e59b4238f334ccc64efa8f689ab716284b39
MD5 9c1c51e542102ab2a20552f6acafc1d7
BLAKE2b-256 0ca830e5047b18944b577c6caa5c67a6ce3e3beda2342c6a119b4e6862d9ac94

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