How tarunjit45/agentwatch works
AgentWatch is an AI-agent observability platform. Agent code reports lifecycle events, logs, resource metrics, token usage, errors, and heartbeats through a non-blocking SDK; the server persists telemetry, evaluates costs and alert conditions, and streams events to dashboards and notification plugins. The dashboard combines REST summaries with live WebSocket events. The README documents broader API, cost, alert, and plugin capabilities than the sampled handlers show, so those branches use supported enclosing paths and omit uncertain handler-level wiring.
Main entry points: api REST API · redis_pubsub.py Pub/Sub manager · tasks.py Task lifecycle · main.py FastAPI server
Components 20
Agent telemetry
- SDK client
agentwatch/sdk/client.py - System collector
agentwatch/sdk/collector.py
Telemetry backend
- REST API
agentwatch/server/api - FastAPI server
agentwatch/server/main.py - Task lifecycle
agentwatch/server/api/tasks.py - Cost engine
agentwatch/telemetry/cost.py - Alert engine
agentwatch/telemetry/alerts.py
Persistence and streaming
- Database sessions
agentwatch/database/connection.py - Telemetry records
agentwatch/database/models.py - SQLite / PostgreSQL
- Pub/Sub manager
agentwatch/websocket/redis_pubsub.py - WebSocket manager
agentwatch/websocket/manager.py
Observability views
- Textual dashboard
agentwatch/dashboard/app.py - Dashboard API client
agentwatch/dashboard/api_client.py
Alert delivery
- Plugin manager
agentwatch/plugins/base.py - Notification plugins
agentwatch/plugins
Other components
- AI agent code
- Redis event bus
- Dashboard user
- Notification services
Connections 24
- AI agent code → SDK client: instruments
- SDK client → System collector: collects metrics
- SDK client → REST API: posts telemetry
- FastAPI server → REST API: mounts routes
- REST API → Task lifecycle: dispatches tasks
- Task lifecycle → Database sessions: uses session
- REST API → Database sessions: persists telemetry
- Database sessions → Telemetry records: uses records
- Database sessions → SQLite / PostgreSQL: reads and writes
- REST API → Cost engine: calculates spend
- REST API → Alert engine: evaluates thresholds
- Task lifecycle → Alert engine: checks duration
- Task lifecycle → Pub/Sub manager: publishes events
- FastAPI server → Pub/Sub manager: initializes and closes
- Pub/Sub manager → Redis event bus: publishes events
- Pub/Sub manager → WebSocket manager: broadcasts events
- FastAPI server → WebSocket manager: accepts sockets
- Dashboard user → Textual dashboard: views telemetry
- Textual dashboard → Dashboard API client: requests and listens
- Dashboard API client → REST API: fetches summaries
- Dashboard API client → FastAPI server: opens WebSocket
- Pub/Sub manager → Plugin manager: dispatches events
- Plugin manager → Notification plugins: broadcasts events
- Notification plugins → Notification services: sends notifications