Skip to main content

Zero-config OpenAI usage tracking for AgentWatch — prompts never leave your server

Project description

agentwatch

Lightweight OpenAI usage tracking for AgentWatch. Token counts, model, and latency are sent to AgentWatch after each response — prompts and completions never leave your server.

Install

pip install agentwatch-py

Usage

from openai import OpenAI
from agentwatch import wrap

client = wrap(
    OpenAI(),
    api_key="aw_live_...",   # Your AgentWatch API key
    agent_id="...",          # Agent ID from your AgentWatch dashboard
)

# Use exactly as before — tracking happens automatically
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello"}],
)

# Streaming works too
for chunk in client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello"}],
    stream=True,
):
    pass  # process chunk as normal

What gets sent to AgentWatch

Only usage metadata — never your prompts or completions:

{
  "agent_id": "...",
  "model": "gpt-4o",
  "prompt_tokens": 12,
  "completion_tokens": 34,
  "latency_ms": 843,
  "success": true
}

Options

Argument Type Description
api_key str Your AgentWatch API key (aw_live_...)
agent_id str Agent ID from your dashboard
ingest_url str Override the ingest URL (optional)

Find your API key and agent IDs at getagentwatch.com/dashboard/integrations.

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

agentwatch_py-0.1.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

agentwatch_py-0.1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for agentwatch_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a3e473e5bcee69d0d96d39ca14e97b626815ac65ac423d9855cdf23a15af30f4
MD5 559fd5e76efe761e24d272d01faeddbd
BLAKE2b-256 c9558726afac04742889ff94520b4459139ed7a0d134acc915f1ecbac9589ce7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: agentwatch_py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for agentwatch_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c6f7bcb4f6dcf6c2290fbf4d0678a4abde6cd9adcb3f50c8c9d22782231aac2
MD5 f6f9d41b4b62612cd8f9131350402a62
BLAKE2b-256 5a277dc2793eb8fcc606639994965675a215b44ce40b3505f93e64d7d8758cc0

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