Performance Metrics

Performance Metrics

Metrics available in LeafMesh for monitoring system health and performance.

Built-in Metrics

Agent Health Metrics

LeafMesh tracks per-agent metrics automatically and surfaces them in the dashboard:

MetricDescription
response_time_msAverage response time
error_rateError ratio
success_rateSuccess ratio
active_sessionsCurrent sessions
consecutive_failuresFailures without success
uptime_secondsTime since last start
quality_scoreOutput quality

LLM Cost Metrics

Every LLM call contributes cost data — model, prompt/completion tokens, estimated cost, response time, cache hit/miss — which is aggregated in the dashboard and accessible via:

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.

Event Processing Metrics

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
total_eventsTotal events processed
events_by_typeBreakdown by event type
processing_ratesEvents/second

Performance Baselines

Typical performance characteristics:

OperationExpected Latency
Request routing10-50ms
Condition evaluation~1ms
LLM call (fast model)300-1000ms
LLM call (capable model)500-5000ms
Tool executionVaries
Mesh call overhead5-20ms

The LLM call dominates request latency; framework overhead is small.

Custom Metrics

Build custom metrics using the public APIs:

async def collect_custom_metrics(): analytics = Studio's Dashboard (HTTP) agent_stats = leafmesh.get_agent_stats() cache_stats = Studio's Dashboard (HTTP) return { "total_events": analytics.get("total_events", 0), "error_rate": analytics.get("error_rate", 0), "agents": agent_stats, "cache_hit_rate": cache_stats.get("hit_rate", 0), "estimated_savings": cache_stats.get("estimated_savings", 0) }

Adaptive Model Selection Metrics

When adaptive model selection is enabled, LeafMesh tracks per-model history (response time, output quality, cost per request, success rate, throughput) and uses it to inform future routing decisions.

Next Steps


LeafMesh — Performance metrics reference

Last updated: 11/10/2026