Metadata-Version: 2.4
Name: agentwatch-observe
Version: 0.1.0
Summary: Lightweight observability SDK for AI agents — wrap any agent framework, get anomaly detection, guardrails, and cost tracking.
Author-email: AgentWatch <hello@agentwatch.in>
License-Expression: MIT
Project-URL: Homepage, https://www.agentwatch.in
Project-URL: Documentation, https://www.agentwatch.in
Keywords: ai,agents,observability,llm,monitoring,guardrails
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.28
Requires-Dist: httpx>=0.27
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.2; extra == "langchain"
Dynamic: license-file

# 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](https://www.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

```bash
pip install agentwatch-observe
```

Optional LangChain integration:

```bash
pip install "agentwatch-observe[langchain]"
```

## Quickstart (under 10 lines)

```python
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 dashboard](https://www.agentwatch.in) → **Runs** to see the trace.

## Local model example (Ollama)

```python
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](https://www.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.
