Skip to main content

AI agent observability SDK for agencies

Project description

AgentWatch

Drop-in observability for LangChain agents. Wrap your agent once and AgentWatch automatically tracks sessions, LLM calls, tool calls, costs, and outcomes — without slowing down or breaking your agent.

Installation

pip install -e .

Quick start

import agentwatch

aw = agentwatch.init()                 # 1. initialize
wrapped_agent = aw.wrap(my_agent)      # 2. wrap your LangChain agent
wrapped_agent.invoke({"input": "..."}) # 3. use it exactly like before

The wrapped agent is a transparent proxy — .invoke(), .ainvoke(), .stream(), .astream(), and .batch() all work exactly as they did on the original agent. Every other attribute is delegated through unchanged.

Configuration

aw = agentwatch.init(
    api_url="https://agentwatch-api.up.railway.app",  # default
    api_key="optional-key",                            # reserved for future auth
)

wrapped = aw.wrap(agent, agent_version="v1", workspace_id="team-a")

What gets tracked

When you call wrap(), a session is created (POST /sessions). As the agent runs, each captured event is sent to POST /events:

Event When Captured
Session start wrap() is called session_id, agent_version, workspace_id, model_version
LLM call each model invocation model name, input/output tokens, latency, estimated cost
Tool call each tool invocation tool name, input, output (truncated to 500 chars), latency, success/error
Session outcome the agent finishes success or error

Each event has this schema:

{
  "session_id": "…",
  "event_type": "llm_call | tool_call | session_outcome",
  "event_name": "gpt-4o-mini",
  "timestamp": "2026-06-12T09:20:00+00:00",
  "latency_ms": 842,
  "cost_usd": 0.00075,
  "status": "success | error",
  "payload": { "model": "…", "input_tokens": 1000, "output_tokens": 1000 }
}

Cost estimation

Costs are computed from token counts using a built-in pricing table (agentwatch/pricing.py) covering gpt-4o, gpt-4o-mini, gpt-3.5-turbo, claude-3-5-sonnet, and claude-3-5-haiku. Versioned names (e.g. claude-3-5-sonnet-20241022) resolve automatically. If the model is unknown or token counts are unavailable, cost_usd is null.

Non-blocking by design

All HTTP calls run on a background worker thread fed by an in-memory queue. AgentWatch never blocks your agent and never raises into it — failures are caught and logged as warnings (enable with logging.getLogger("agentwatch")).

Call aw.flush() before your process exits to ensure queued events are sent (this is also registered automatically via atexit).

Development

pip install -e ".[dev]"
pytest

Dashboard

View your sessions and events at the AgentWatch dashboard: https://agentwatch-api.up.railway.app (placeholder).

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

useagentwatch-0.1.0.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

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

useagentwatch-0.1.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for useagentwatch-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1b149e344d1979db6b0a0e535daf58b7edc037b332ed893229386b6b15ff0145
MD5 88f1b32c5912be33cd46c2825d1e2bae
BLAKE2b-256 6c7943f210e539ba8eda6628295b25c140c1cef7a4a90297fee853d52a509129

See more details on using hashes here.

File details

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

File metadata

  • Download URL: useagentwatch-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for useagentwatch-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4953cec3d9df82d2c48711e7908330cdda043616cf2161d1655828e3114e0fd8
MD5 8a43b78b862eee6058b321f26af403c9
BLAKE2b-256 ce10f662f4d4bf6f04d1ee2b98e0b42a35589d60eab11e1e70e3c113218f7b1a

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