π¦ ClawHub
Agent Metrics
by @nantes
Monitor AI agent calls, errors, latency, and resource usage with a terminal dashboard and JSON export for observability and metrics tracking.
TERMINAL
clawhub install agent-metrics-osirisπ About This Skill
name: agent-metrics version: 1.0.3 description: Observability and metrics for AI agents - track calls, errors, latency metadata: {"openclaw": {"emoji": "π", "category": "utility", "requires": {"bins": ["python"], "pip": ["psutil"]}, "homepage": "https://github.com"}
Agent Metrics Skill
Track and monitor your AI agent's behavior with built-in observability.
Files included:
metrics.py - Python CLI (cross-platform)agent-metrics.ps1 - PowerShell wrapper (Windows)What it does
Installation
# Install Python dependency
pip install psutil
Usage
Option 1: PowerShell (recommended on Windows)
.\agent-metrics.ps1 -Action record -MetricType call -Label "api_openai"
Option 2: Python CLI (cross-platform)
python metrics.py record --type call --label "api_openai"
Record an Error
.\agent-metrics.ps1 -Action record -MetricType error -Label "api_error" -Details "Rate limit exceeded"
Record Latency
.\agent-metrics.ps1 -Action record -MetricType latency -Label "task_process" -Value 1500
View Dashboard
.\agent-metrics.ps1 -Action dashboard
View Resource Usage (CPU, Memory, Disk)
.\agent-metrics.ps1 -Action resources
Export Metrics
.\agent-metrics.ps1 -Action export -Format json -Output metrics.json
Get Summary
.\agent-metrics.ps1 -Action summary
Metrics Types
| Type | Description | Fields | |------|-------------|--------| | call | API call made | label, timestamp | | error | Error occurred | label, details, timestamp | | latency | Response time (ms) | label, value, timestamp | | custom | Custom metric | label, value |
Dashboard Example
βββββββββββββββββββββββββββββββββββββββββββββββββ
β AGENT METRICS DASHBOARD β
β ββββββββββββββββββββββββββββββββββββββββββββββββ£
β Total Calls: 1,247 β
β Total Errors: 23 β
β Error Rate: 1.84% β
β Avg Latency: 234ms β
β Uptime: 4h 32m β
β ββββββββββββββββββββββββββββββββββββββββββββββββ£
β Top Labels: β
β api_openai 892 (71.5%) β
β api_claude 234 (18.8%) β
β task_process 121 (9.7%) β
βββββββββββββββββββββββββββββββββββββββββββββββββ
Requirements
License
MIT
π‘ Examples
Option 1: PowerShell (recommended on Windows)
.\agent-metrics.ps1 -Action record -MetricType call -Label "api_openai"
Option 2: Python CLI (cross-platform)
python metrics.py record --type call --label "api_openai"
Record an Error
.\agent-metrics.ps1 -Action record -MetricType error -Label "api_error" -Details "Rate limit exceeded"
Record Latency
.\agent-metrics.ps1 -Action record -MetricType latency -Label "task_process" -Value 1500
View Dashboard
.\agent-metrics.ps1 -Action dashboard
View Resource Usage (CPU, Memory, Disk)
.\agent-metrics.ps1 -Action resources
Export Metrics
.\agent-metrics.ps1 -Action export -Format json -Output metrics.json
Get Summary
.\agent-metrics.ps1 -Action summary