analyzer
analyzer
¶
TraceAnalyzer — read-only query layer over stored traces.
Provides aggregated statistics that the learning system uses to update routing policies, tool selection strategies, and memory configuration.
Classes¶
RouteStats
dataclass
¶
RouteStats(model: str, agent: str, count: int = 0, avg_latency: float = 0.0, avg_tokens: float = 0.0, success_rate: float = 0.0, avg_feedback: Optional[float] = None)
Aggregated statistics for a specific routing decision (model+agent).
ToolStats
dataclass
¶
Aggregated statistics for a specific tool.
StepTypeStats
dataclass
¶
StepTypeStats(count: int = 0, avg_duration: float = 0.0, median_duration: float = 0.0, min_duration: float = 0.0, max_duration: float = 0.0, std_duration: float = 0.0, total_energy: float = 0.0, avg_input_tokens: float = 0.0, median_input_tokens: float = 0.0, min_input_tokens: float = 0.0, max_input_tokens: float = 0.0, std_input_tokens: float = 0.0, avg_output_tokens: float = 0.0, median_output_tokens: float = 0.0, min_output_tokens: float = 0.0, max_output_tokens: float = 0.0, std_output_tokens: float = 0.0)
Aggregated statistics for a specific step type across traces.
TraceSummary
dataclass
¶
TraceSummary(total_traces: int = 0, total_steps: int = 0, avg_steps_per_trace: float = 0.0, avg_latency: float = 0.0, avg_tokens: float = 0.0, success_rate: float = 0.0, step_type_distribution: Dict[str, int] = dict(), total_energy_joules: float = 0.0, total_generate_energy_joules: float = 0.0, step_type_stats: Dict[str, StepTypeStats] = dict())
Overall summary statistics across all traces.
TraceAnalyzer
¶
TraceAnalyzer(store: TraceStore)
Read-only query layer over a :class:TraceStore.
Computes aggregated statistics from stored traces, providing the inputs that the learning system needs to update routing policies.
Source code in src/openjarvis/traces/analyzer.py
Functions¶
summary
¶
summary(*, since: Optional[float] = None, until: Optional[float] = None) -> TraceSummary
Compute an overall summary of all traces in the time range.
Source code in src/openjarvis/traces/analyzer.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
per_route_stats
¶
per_route_stats(*, since: Optional[float] = None, until: Optional[float] = None) -> List[RouteStats]
Compute stats grouped by (model, agent) routing decisions.
Source code in src/openjarvis/traces/analyzer.py
per_tool_stats
¶
per_tool_stats(*, since: Optional[float] = None, until: Optional[float] = None) -> List[ToolStats]
Compute stats grouped by tool name.
Source code in src/openjarvis/traces/analyzer.py
traces_for_query_type
¶
traces_for_query_type(*, has_code: bool = False, min_length: Optional[int] = None, max_length: Optional[int] = None, since: Optional[float] = None, until: Optional[float] = None) -> List[Trace]
Retrieve traces matching query characteristics.
Useful for the learning system to find traces similar to a new query and learn which routing decisions worked best.
Source code in src/openjarvis/traces/analyzer.py
export_traces
¶
export_traces(*, since: Optional[float] = None, until: Optional[float] = None, limit: int = 1000) -> List[Dict[str, Any]]
Export traces as plain dicts (for JSON serialization).