Metadata-Version: 2.4
Name: agentwatch-py
Version: 0.2.0
Summary: Zero-config OpenAI usage tracking for AgentWatch — prompts never leave your server
License-Expression: MIT
Project-URL: Homepage, https://getagentwatch.com
Project-URL: Repository, https://github.com/sbaruwal/agentwatch
Keywords: openai,llm,cost-tracking,observability,agentwatch
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Provides-Extra: dev
Requires-Dist: openai>=1.0.0; extra == "dev"

# agentwatch

Lightweight OpenAI usage tracking for [AgentWatch](https://getagentwatch.com). Token counts, model, and latency are sent to AgentWatch after each response — **prompts and completions never leave your server.**

## Install

```bash
pip install agentwatch-py
```

## Usage

```python
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:

```json
{
  "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](https://getagentwatch.com/dashboard/integrations).
