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.0.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.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for whyops-0.1.0.tar.gz
Algorithm Hash digest
SHA256 49c7c34f3216e841bb850be80ca1565e37e14da86d8a2bb76d5a3d4ed6c1e672
MD5 223a304eeb4ff291fef97c55800e4415
BLAKE2b-256 26b8e5f163134800c611a0a2a71e64b762bd2fc2802cc5af006719b6e6dc75b2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: whyops-0.1.0-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.9.6

File hashes

Hashes for whyops-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 af86f5a5584b595aed0868dd4936f4c8df34471d017029878dad94625b7d9ca4
MD5 7ae8cc33a26204ad74679ef21ecd680a
BLAKE2b-256 cae10d5de675d87a58c8f61a02169189e934c339b9f5fc5050a3e80fc51ad684

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