Skip to main content

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.

Release files for agentwatch-py 0.2.0

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

Source distribution (sdist)

Source distribution for agentwatch-py 0.2.0
File Size Uploaded
agentwatch_py-0.2.0.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentwatch-py 0.2.0
File Interpreter ABI Platform
agentwatch_py-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.3 kB

Release files / agentwatch_py-0.2.0.tar.gz

Download URL agentwatch_py-0.2.0.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7876d3594c83d1ad452ddb31b5404f17c7eaf44f0e0cf07b4bd37ed8ee336de2
BLAKE2b-256 checksum
How to use checksums
d323bfd0c6bfb7f45462a9ae3b66a64b4fe5cb5603485104b2679cee074f88cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / agentwatch_py-0.2.0-py3-none-any.whl

Download URL agentwatch_py-0.2.0-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
89f4762eb027e2cca45e2ee9a18c3e69098d4609835501835cc96bee704ce824
BLAKE2b-256 checksum
How to use checksums
85242b199f3eb856959391165f56c842ff7157772eb6cf69dff2e01e32ba8eef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.2.0 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