Skip to main content

AgentWatch Python SDK

Production monitoring for AI agents: rule-based checks on every trace, optional LLM judge analysis when a step is flagged, plus async delivery to your AgentWatch API.

Install

pip install agentwatch-io

From a clone of this repo (editable / dev):

pip install -e ./agentwatch-sdk

Import name is always agentwatch after either install.

Quick start

import agentwatch
import openai

agentwatch.init(
    api_key="aw_...",                 # Dashboard → API Keys
    server_url="http://localhost:8000",
    agent_name="my-agent",
)

client = agentwatch.watch(openai.OpenAI())

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hello"}],
)

init alone does not trace calls — you must use watch(client) (or a patched default client) so requests go through the wrapper.

LLM analysis (optional judge)

When rule checks flag a trace, the server can call your OpenAI, Anthropic, or Groq API with a judge prompt. Enable in init:

import os

agentwatch.init(
    api_key="aw_...",
    server_url="https://your-api.example.com",
    agent_name="my-agent",
    deep_analysis=True,
    llm_provider="openai",
    llm_api_key=os.environ["OPENAI_API_KEY"],
    llm_model="gpt-4o-mini",
)

Your LLM key is sent only to your provider from the API process; AgentWatch does not log or store it.

Parameters

Parameter Description
api_key AgentWatch key (aw_...).
server_url FastAPI base URL.
agent_name Shown in dashboard.
deep_analysis Enable LLM judge on flagged traces.
llm_provider "openai", "anthropic", or "groq".
llm_api_key Provider key for judge (including Groq).
groq_api_key Optional; same as putting the Groq key in llm_api_key.
llm_model Optional model override.
content_mode If True, server runs extra content-creation checks (repetition, length, injection phrases, off-topic heuristic).
redact_fields Field names to redact in trace text.
silent Suppress stdout from init.

Anthropic

import anthropic

agentwatch.init(api_key="aw_...", server_url="...", agent_name="bot")
client = agentwatch.watch(anthropic.Anthropic())
client.messages.create(model="claude-3-5-haiku-20241022", max_tokens=256, messages=[...])

Groq

Install Groq’s Python SDK (pip install groq). The client is OpenAI-compatible for chat.completions:

import os
import agentwatch
from groq import Groq

agentwatch.init(
    api_key="aw_...",
    server_url="http://localhost:8000",
    agent_name="content-generator",
    deep_analysis=True,
    llm_provider="groq",
    llm_api_key=os.environ["GROQ_API_KEY"],
    llm_model="llama-3.3-70b-versatile",
)

client = agentwatch.watch(Groq())
client.chat.completions.create(
    model="llama-3.3-70b-versatile",
    messages=[{"role": "user", "content": "Write a short paragraph about Python."}],
)

Full documentation

See the Documentation page in the AgentWatch dashboard (/docs) for architecture, runs, alerts, and dashboard setup.

Release files for agentwatch-io 0.1.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-io 0.1.0
File Size Uploaded
agentwatch_io-0.1.0.tar.gz 6.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentwatch-io 0.1.0
File Interpreter ABI Platform
agentwatch_io-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.2 kB

Release files / agentwatch_io-0.1.0.tar.gz

Download URL agentwatch_io-0.1.0.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8b9a321b03670235490ed9c774cd4afab6519c7a48d71e2093d4e178a36ba045
BLAKE2b-256 checksum
How to use checksums
ae470fae744745c3266677973d76816130640219ec5851cb0bd037eed478f413
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 6, 2026.

Transparency log

Release files / agentwatch_io-0.1.0-py3-none-any.whl

Download URL agentwatch_io-0.1.0-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8bec3bb7be9996ba4d875098e65b590306ba6bc786b8b0f9d9b21d973be8fb2f
BLAKE2b-256 checksum
How to use checksums
1bfb93f241187679c23ab1d6cf7954e00170313eacad1df10866a97e246bf9c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 6, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

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