System Monitoring

System Monitoring

Built-in monitoring capabilities in LeafMesh.

Built-in Analytics

Usage Analytics

Aggregated analytics, cache metrics, and per-session event streams are available in Studio's Dashboard and session inspector — operator UI, not part of the customer Python or HTTP surface.

Returns aggregated statistics:

MetricDescription
total_eventsTotal events processed
events_by_typeEvent counts grouped by type
processing_ratesEvents per second
error_rateRatio of error events to total events

LLM Cache Statistics

Aggregated analytics, cache metrics, and per-session event streams are available in Studio's Dashboard and session inspector — operator UI, not part of the customer Python or HTTP surface.

MetricDescription
hit_rateCache hit ratio
total_requestsTotal LLM requests
cache_hitsRequests served from cache
estimated_savingsEstimated cost savings from caching

Agent Statistics

agent_stats = leafmesh.get_agent_stats()

Per-agent metrics:

MetricDescription
execution_countTotal executions
error_countTotal errors
error_rateError ratio
avg_response_msAverage response time
current_statusCurrent health status

Health Check Endpoint

The API server provides a liveness endpoint with overall agent health:

GET http://localhost:18820/health
{ "status": "healthy", "agents": { "total_registered": 8, "healthy": 7, "degraded": 1, "failed": 0 } }

Periodic Monitoring Script

async def monitor_system(leafmesh): """Run as a scheduled agent or external script""" analytics = Studio's Dashboard (HTTP) agent_stats = leafmesh.get_agent_stats() # Check error rates for agent, stats in agent_stats.items(): if stats.get("error_rate", 0) > 0.1: print(f"WARNING: {agent} error rate: {stats['error_rate']}")

Next Steps


LeafMesh — Built-in system monitoring

Last updated: 11/10/2026