Skip to main content

AI agent observability and control — AgentWatch SDK

Project description

ai-watcher

Python SDK for AgentWatch — AI agent observability and control.

Install

pip install ai-watcher

Quickstart

export AGENTWATCH_API_KEY=aw_live_...

One-liner wrapper (Lambda / serverless)

from agentwatch import track_llm

result = track_llm(
    'classify-document',
    lambda: openai.chat.completions.create(...),
    {
        'human_id': customer_id,
        'agent_name': 'doc-classifier',
        'model': 'gpt-4o',
        'framework': 'aws-lambda',
        'session_name': 'Classify: invoice',
        'input': {'doc_type': 'invoice', 'pages': 3},
    }
)

Chained model calls (multi-step pipeline)

from agentwatch import track_chain

results = track_chain(
    steps=[
        {
            'action': 'extract',
            'model': 'gpt-4o',
            'fn': lambda: openai.chat.completions.create(...),
            'input': {'pages': 3},
        },
        {
            'action': 'classify',
            'model': 'claude-sonnet-4-20250514',
            'fn': lambda: anthropic.messages.create(...),
            'input': {'text': '...'},
        },
    ],
    opts={
        'human_id': customer_id,
        'agent_name': 'shipping-pipeline',
        'session_name': 'Process Shipping Document',
    }
)

Both wrappers are zero-dependency and never break your app — if AgentWatch is unreachable, the underlying function still runs.

Session context manager (full control)

from agentwatch import Session, tool

with Session(human_id="you@example.com") as session:

    @tool(session)
    def search_web(query: str) -> str:
        return "results..."

    result = search_web("AI agent security")

Full Session config

from agentwatch import Session, tool

with Session(
    api_key="aw_live_...",
    human_id="sarah@acme.com",
    agent_name="billing-agent",
    agent_version="2.0.0",
    model="claude-sonnet-4-20250514",
    system_prompt="You are a billing assistant.",
    tools=["send_invoice", "fetch_invoice"],
    framework="langchain",
) as session:

    @tool(session, action_class="send", data_scope="financial")
    def send_invoice(recipient: str, amount: float) -> dict:
        return {"sent": True}

    send_invoice("client@acme.com", 1200.00)

API reference

track_llm(action, fn, opts)

Field Type Description
action str Name of the operation (e.g. "classify-document")
fn Callable Zero-argument callable that makes the model call
opts dict Session options (see below)

track_chain(steps, opts)

Each step: {'action': str, 'fn': callable, 'model': str, 'input': dict}

Common opts fields

Key Default Description
human_id "anonymous" User or customer identifier
agent_name "agent" Name of the agent/pipeline
model "unknown" Default model (overridden per step in track_chain)
framework "python" Runtime (e.g. "aws-lambda", "langchain")
session_name action name Human-readable session title in the dashboard
input None Input metadata to log with the event

Exceptions

Exception When raised
ExecutionBlockedException Policy blocked the tool call
HitlDeniedException Human reviewer denied the action
AgentwatchAPIError Non-2xx response from the API
AgentwatchConnectionError Network error after retries

Environment variables

Variable Default Description
AGENTWATCH_API_KEY Required. Your aw_live_... key.
AGENTWATCH_API_URL https://agentwatch.vercel.app Override for self-hosted.

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

ai_watcher-0.2.1.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

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

ai_watcher-0.2.1-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file ai_watcher-0.2.1.tar.gz.

File metadata

  • Download URL: ai_watcher-0.2.1.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for ai_watcher-0.2.1.tar.gz
Algorithm Hash digest
SHA256 1945274e0d6c0708a545f51159da0f42e8dfaed68e85ce3e675e524d341c2fdc
MD5 5217d951a819f4721141f4c1f31e34d6
BLAKE2b-256 c517a278e3e65a8409d978e099c3fe03f13c004c8f4bd6f4f5b517af3b0679e1

See more details on using hashes here.

File details

Details for the file ai_watcher-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: ai_watcher-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for ai_watcher-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ef8795c1c82e62b8d71a5c1eb19780afd143f94b3d25c29c82c5c4737c82a9b5
MD5 40ea75226ebac3b24731c803804afa5f
BLAKE2b-256 68c90074b0ec10e70e94c248de2a22ecd912a1a589bf9db7911f761d4dd774df

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