Skip to main content

OSSP Python SDK (Reference)

CloudEvents-first client for emitting OSSP events.

Install

pip install ossp-sdk

Quick Start

from ossp_sdk.client import OSSPClient

client = OSSPClient(
    source_uri="urn:example:app:chatbot-prod",
    collector_endpoint=None  # If None, events are logged locally
)

event = client.emit(
    event_type="ai.safety.guardrail.interaction",
    resource={"model_id": "gpt-4o", "environment": "production"},
    data={"action_taken": "block", "reason": "PII detected", "severity": "high"},
    subject="urn:model:gpt-4o"
)
print(event)

CLI Example

You can emit the sample event directly from the repository:

python sdk-python/examples/send_event.py --print

Use --collector-endpoint (and optional --auth-token) to forward the CloudEvent to a collector, and --log-level to adjust verbosity.

Validation (optional)

pip install "ossp-sdk[validate]"

Set the OSSP_VALIDATE environment variable and point OSSP_SCHEMA_DIR to the spec repository path schema/v1.0.0 to validate payloads locally.

If offline, pre-load draft 2020-12 metaschema or vendor the metas under specification/schema/meta/2020-12/.

Metadata

Release files for ossp-sdk 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ossp-sdk 0.1.0
File Size Uploaded
ossp_sdk-0.1.0.tar.gz 14.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ossp-sdk 0.1.0
File Interpreter ABI Platform
ossp_sdk-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.2 kB

Release files / ossp_sdk-0.1.0.tar.gz

Download URL ossp_sdk-0.1.0.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
bbc5a79442b70bba286807a06aa529e4f4e2a9f388a5c76f69f6f6748dbe6086
BLAKE2b-256 checksum
How to use checksums
2148459bd96ab36c16ed582a9780d3f2d8853c347ddc99669caec68fb60eb406
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release files / ossp_sdk-0.1.0-py3-none-any.whl

Download URL ossp_sdk-0.1.0-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f84df1fff38a3478e2ba4afedb6d7963a6cd9ebb0849912da7071825bf220547
BLAKE2b-256 checksum
How to use checksums
92cb021f42c522ebf348fd81f459412a07833d59068aa02c2b7cb04eec52e0cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page