Skip to main content

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).

Metadata

Release files for useagentwatch 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for useagentwatch 0.1.0
File Size Uploaded
useagentwatch-0.1.0.tar.gz 11.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for useagentwatch 0.1.0
File Interpreter ABI Platform
useagentwatch-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.6 kB

Release files / useagentwatch-0.1.0.tar.gz

Download URL useagentwatch-0.1.0.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1b149e344d1979db6b0a0e535daf58b7edc037b332ed893229386b6b15ff0145
BLAKE2b-256 checksum
How to use checksums
6c7943f210e539ba8eda6628295b25c140c1cef7a4a90297fee853d52a509129
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / useagentwatch-0.1.0-py3-none-any.whl

Download URL useagentwatch-0.1.0-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4953cec3d9df82d2c48711e7908330cdda043616cf2161d1655828e3114e0fd8
BLAKE2b-256 checksum
How to use checksums
ce10f662f4d4bf6f04d1ee2b98e0b42a35589d60eab11e1e70e3c113218f7b1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page