Skip to main content

whyops

Type-safe Python SDK for WhyOps AI agent observability.

Install

pip install whyops

Quick start

from whyops import WhyOps

sdk = WhyOps(
    api_key="YOUR_WHYOPS_API_KEY",
    agent_name="support-agent",
    agent_metadata={
        "systemPrompt": "You are a helpful support agent.",
        "tools": [],
    },
)

trace = sdk.trace("session-123")

trace.user_message_sync([
    {"role": "user", "content": "Reset my password."}
])

trace.llm_response_sync(
    "openai/gpt-4o-mini",
    "openai",
    "I can help with that.",
    usage={"promptTokens": 42, "completionTokens": 16, "totalTokens": 58},
    latency_ms=420,
    finish_reason="stop",
)

Proxy mode

from openai import OpenAI
from whyops import WhyOps

sdk = WhyOps(
    api_key="YOUR_WHYOPS_API_KEY",
    agent_name="support-agent",
    agent_metadata={"systemPrompt": "You are a helpful support agent.", "tools": []},
)

client = sdk.openai(OpenAI(api_key="YOUR_OPENAI_API_KEY"))

If proxy_base_url or analyse_base_url are omitted, the SDK uses WhyOps hosted defaults.

Build and publish

python3 -m build
python3 -m twine upload dist/*

Metadata

Release files for whyops 0.1.1

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

Source distribution (sdist)

Source distribution for whyops 0.1.1
File Size Uploaded
whyops-0.1.1.tar.gz 9.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for whyops 0.1.1
File Interpreter ABI Platform
whyops-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 20.5 kB

Release files / whyops-0.1.1.tar.gz

Download URL whyops-0.1.1.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ae9e6ae160d249ca4f0c456dae8c5237ee3674d5ba3210a8afbad858618c1c31
BLAKE2b-256 checksum
How to use checksums
ea0da82c88541e8c7de13e258a24f4da125b3c1fa9955e1d01391f07f6333c80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / whyops-0.1.1-py3-none-any.whl

Download URL whyops-0.1.1-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
610cff841d31281af0e1d2c03367e47f59fbfa25f5a1167ab793107d0ef643a0
BLAKE2b-256 checksum
How to use checksums
73190a83dcd19ba56e89dfbf46664b01234814fbd146fb1585fa0f432d4c423c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

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