Skip to main content

Lightweight observability SDK for AI agents — wrap any agent framework, get anomaly detection, guardrails, and cost tracking.

Project description

agentwatch-observe

Lightweight observability for AI agents. Wrap any local or cloud model call, stream steps to AgentWatch, and get cost tracking, anomaly detection, and guardrails on the dashboard at agentwatch.in.

Privacy: Your model credentials (OpenAI, Gemini, Ollama, etc.) stay on your machine. AgentWatch only receives telemetry — tokens, cost estimates, tool names, timing, and step metadata — never your API keys or raw model weights.

Install

pip install agentwatch-observe

Optional LangChain integration:

pip install "agentwatch-observe[langchain]"

Quickstart (under 10 lines)

import agentwatch

agentwatch.init(
    api_key="YOUR_AGENTWATCH_API_KEY",
    base_url="https://api.agentwatch.in",  # or http://localhost:8000 for local dev
)

with agentwatch.run("my-agent") as run:
    run.log_llm(
        model="gpt-4o-mini",
        input_tokens=120,
        output_tokens=40,
        output="Hello from AgentWatch!",
    )

Open the AgentWatch dashboardRuns to see the trace.

Local model example (Ollama)

import requests
import agentwatch

agentwatch.init(api_key="YOUR_AGENTWATCH_API_KEY", base_url="http://localhost:8000")

def call_local_model(prompt: str) -> str:
    response = requests.post(
        "http://localhost:11434/api/generate",
        json={"model": "llama3", "prompt": prompt, "stream": False},
        timeout=60,
    )
    response.raise_for_status()
    return response.json()["response"]

with agentwatch.run("my-local-agent") as run:
    prompt = "Summarize observability in one sentence."
    reply = call_local_model(prompt)
    run.log_tool(
        "ollama:llama3",
        input_data={"prompt": prompt},
        output_data={"reply": reply},
    )

Framework-agnostic API

  • agentwatch.run(...) — context manager
  • run.log_llm(...) — LLM step with token/cost tracking
  • run.log_tool(...) — tool call step
  • agentwatch.track(...) — decorator
  • agentwatch.instrument_openai(client) — auto-log OpenAI calls

See the full docs at agentwatch.in.

Releasing a new version

PyPI never allows re-uploading the same version number.

  1. Bump version in pyproject.toml and agentwatch/__init__.py
  2. cd sdk && python -m build
  3. twine check dist/*
  4. Upload to TestPyPI first: twine upload --repository testpypi dist/*
  5. After verification, upload to PyPI: twine upload dist/*

See CONTRIBUTING.md for details.

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

agentwatch_observe-0.1.0.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

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

agentwatch_observe-0.1.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file agentwatch_observe-0.1.0.tar.gz.

File metadata

  • Download URL: agentwatch_observe-0.1.0.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for agentwatch_observe-0.1.0.tar.gz
Algorithm Hash digest
SHA256 abf1e47d882f46186e7d33c3bd8d4ba752f7cf97abddf20f4a15f9893388b9a7
MD5 8a3283e729bb11bdfc947e7496419acc
BLAKE2b-256 fb39f3969f9c7ffa7f6205417237f319558670965760988bab56b0f13fde0aea

See more details on using hashes here.

File details

Details for the file agentwatch_observe-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agentwatch_observe-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 092ad62c2ff5b876b28acd534f1744cb8d0b7ac183708781be73b431a3f11d38
MD5 c9b75eb460a4ca8d090e1272458c4a3c
BLAKE2b-256 a81cbbe6f2f24b34cd3af8d77f1eabe2908b2f28dccaff3991ae4d1837b840bb

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