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 (any agent, any model)
Add to your project .env:
AGENTWATCH_API_KEY=your_key_here
AGENTWATCH_BASE_URL=https://api.agentwatch.in # optional
Two lines in your agent code — works with Gemini, OpenAI, Ollama, LangChain, or custom logic:
import agentwatch
agentwatch.bootstrap() # reads AGENTWATCH_API_KEY from env
@agentwatch.track(agent_name="my-agent")
def handle_message(message: str):
return your_existing_agent_logic(message)
Open the AgentWatch dashboard → Runs to see the trace.
Optional: auto-capture provider SDK calls
If you call a provider SDK directly, wrap it once and every LLM call is logged:
from google import genai
client = agentwatch.instrument_google_genai_client(genai.Client(api_key="..."))
# client.models.generate_content(...) is now auto-logged inside an active run
# Also: instrument_openai(OpenAI()), instrument_anthropic(Anthropic())
Manual step logging (advanced)
with agentwatch.run("my-agent") as run:
run.log_llm(model="gpt-4o-mini", input_tokens=120, output_tokens=40, output="Hello!")
run.log_tool("search", input_data={"q": "hello"}, output_data={"results": []})
Framework-agnostic API
agentwatch.run(...)— context managerrun.log_llm(...)— LLM step with token/cost trackingrun.log_tool(...)— tool call stepagentwatch.track(...)— decoratoragentwatch.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.
- Bump
versioninpyproject.tomlandagentwatch/__init__.py cd sdk && python -m buildtwine check dist/*- Upload to TestPyPI first:
twine upload --repository testpypi dist/* - After verification, upload to PyPI:
twine upload dist/*
See CONTRIBUTING.md for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentwatch_observe-0.1.1.tar.gz.
File metadata
- Download URL: agentwatch_observe-0.1.1.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73ea955a70bdf5146bb7ad15e33146e7201518b8e3dcda5ab8cf06411dda45b8
|
|
| MD5 |
0aef4d478b5f612be9ba377e08e12310
|
|
| BLAKE2b-256 |
eb8bd0d1a2f88389148ce94d69d40ef668b28ca70dba270cd7016161552a981e
|
File details
Details for the file agentwatch_observe-0.1.1-py3-none-any.whl.
File metadata
- Download URL: agentwatch_observe-0.1.1-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4347d4273c77377b763ffda572bc74ee2996d48fc2b22f6cc752cd542baa93b6
|
|
| MD5 |
b2911d42cc95fdd199eaa1215f74555d
|
|
| BLAKE2b-256 |
c1e8d1d90417893a0083ff144ad672ca759cfb842eabc000a77c5e71739c3f84
|