Predictive Analytics

Predictive Analytics

LeafMesh learns per-model performance from your live traffic and uses that knowledge to route requests to the model that has historically done best on similar work. Alongside this, it surfaces aggregated usage analytics for cost tracking, agent-level statistics, and custom dashboards.

Adaptive model selection

The platform tracks, for each model you use, how it has performed in the past: response time, quality, cost, success rate, and other runtime signals. When a new request comes in, it routes the request to the model whose track record on similar work looks best.

You don't categorise requests by hand — the platform does that automatically. Prediction accuracy improves as the history grows.

To enable adaptive selection on an agent, configure optimization_strategy in YAML:

agents: my_agent: name: "my_agent" model: "gpt-4o" # Default fallback model optimization_strategy: "performance" # Use adaptive selection

If the platform doesn't yet have enough history to confidently pick a model, the configured default is used.

Usage analytics

System-wide aggregated analytics are exposed through a single call:

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.

LLM cost tracking

Cost-related signals are aggregated separately so you can see cache effectiveness at a glance:

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.

Per-agent statistics

agent_stats = leafmesh.get_agent_stats() # Per agent: # { # "execution_count": 1247, # "error_rate": 0.015, # "avg_response_ms": 850, # "current_status": "healthy" # }

Building custom analytics

For pre-aggregated statistics in Python, use Studio's Dashboard. For richer dashboarding, point your monitoring stack at the standard metrics endpoints documented in the observability section.

Next Steps


LeafMesh — Performance prediction and analytics

Last updated: 11/10/2026