Skip to main content

AgentWatch — Python SDK

Predict when production AI agents are degrading — before they visibly fail.

AgentWatch watches your agent's traces and runs statistical change-point detection (CUSUM/EWMA), an LLM-judge correctness gate, and semantic-drift scoring server-side to catch quality collapse before your error rate moves. This SDK just captures traces and ships them — it has zero required dependencies and never adds latency to or raises errors in your agent's request path.

Install

pip install agentwatch-dev
# optional, only for instrument_openai():
pip install "agentwatch-dev[openai]"

The distribution is named agentwatch-dev (after agentwatch.dev); the import name is just agentwatch.

Configure

import agentwatch
agentwatch.configure(api_key="aw_live_...", agent_id="<agent-uuid>")

Self-hosting? Pass endpoint="https://your-host" to configure(...).

Option A — auto-instrument (one line)

Works for any OpenAI-compatible client — OpenAI, Groq, Cerebras, Together, vLLM — because they all use the openai client with a different base_url.

from openai import OpenAI

client = OpenAI(base_url="https://api.groq.com/openai/v1", api_key=GROQ_API_KEY)
agentwatch.instrument_openai(client)

# Every chat completion from here on is traced automatically:
client.chat.completions.create(
    model="llama-3.3-70b-versatile",
    messages=[{"role": "user", "content": "Refund order #47829"}],
)

Option B — wrap your agent function

@agentwatch.watch()
def run_agent(query: str) -> str:
    ...
    return answer

# async is supported too:
@agentwatch.watch()
async def run_agent_async(query: str): ...

watch() captures the first argument as the input and the return value as the output. If the return value is an OpenAI-shaped response, it also extracts the model, token counts, and tool names automatically.

Option C — manual trace

client = agentwatch.AgentWatchClient(api_key="aw_live_...", agent_id="<uuid>")
client.trace(
    input="Refund order #47829",
    output="I've issued the refund…",
    model="llama-3.3-70b-versatile",
    latency_ms=812,
    prompt_tokens=220, completion_tokens=180, total_tokens=400,
    tools_used=["search_kb", "issue_refund"],
)

Notes

  • Fire-and-forget: traces are POSTed on a daemon thread; delivery failures are swallowed so monitoring can never break your agent.
  • Metadata: attach tags via configure(..., metadata={"env": "prod"}) or per-call @agentwatch.watch(metadata={"version": "2.1"}).
  • Streaming (stream=True) responses aren't fully captured yet — the trace is still recorded, but token/output extraction may be partial.

MIT licensed.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentwatch_dev-0.1.1.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

agentwatch_dev-0.1.1-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file agentwatch_dev-0.1.1.tar.gz.

File metadata

  • Download URL: agentwatch_dev-0.1.1.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.0

File hashes

Hashes for agentwatch_dev-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8748362b934c33f1b98253f601078a5801855789601446995bbf2b09036c3a51
MD5 2b6072cc642b17d4ef9f06568a004898
BLAKE2b-256 89889777ca18cdbfebdd568afeb6c71a55b233b3f3450954b98d3c859c3aa863

See more details on using hashes here.

File details

Details for the file agentwatch_dev-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: agentwatch_dev-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.0

File hashes

Hashes for agentwatch_dev-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 efbd0cac1fd4789edd1cbe118577c52720ea31a41f990642c35b0a54a8fa8e66
MD5 dac2aecb313f8b70c73ae0147ded99e5
BLAKE2b-256 ed438d791901c1abe6abf922bab1371c99e2f27031e2a7ec2cffb3455e4cbfad

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 Sentry Error logging StatusPage Status page