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.2.0.tar.gz (4.0 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.2.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agentwatch_py-0.2.0.tar.gz
  • Upload date:
  • Size: 4.0 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.2.0.tar.gz
Algorithm Hash digest
SHA256 7876d3594c83d1ad452ddb31b5404f17c7eaf44f0e0cf07b4bd37ed8ee336de2
MD5 c10548968862287a973fa3e759e6e95c
BLAKE2b-256 d323bfd0c6bfb7f45462a9ae3b66a64b4fe5cb5603485104b2679cee074f88cd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: agentwatch_py-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 89f4762eb027e2cca45e2ee9a18c3e69098d4609835501835cc96bee704ce824
MD5 dd1e3f2dca1afb15bf4956598919c11b
BLAKE2b-256 85242b199f3eb856959391165f56c842ff7157772eb6cf69dff2e01e32ba8eef

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