Skip to main content

WhyOps SDK — AI agent observability

Project description

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/*

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

whyops-0.1.1.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

whyops-0.1.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file whyops-0.1.1.tar.gz.

File metadata

  • Download URL: whyops-0.1.1.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for whyops-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ae9e6ae160d249ca4f0c456dae8c5237ee3674d5ba3210a8afbad858618c1c31
MD5 b021413377db4241d6e5a2fe6f65c3ac
BLAKE2b-256 ea0da82c88541e8c7de13e258a24f4da125b3c1fa9955e1d01391f07f6333c80

See more details on using hashes here.

File details

Details for the file whyops-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: whyops-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for whyops-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 610cff841d31281af0e1d2c03367e47f59fbfa25f5a1167ab793107d0ef643a0
MD5 8a4493298b62ed1a402d4c6bf72f15ba
BLAKE2b-256 73190a83dcd19ba56e89dfbf46664b01234814fbd146fb1585fa0f432d4c423c

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