Session Analytics
Session Analytics provides comprehensive tracking and reporting for Radium agent sessions, enabling users to monitor costs, analyze performance, and optimize their workflows.
Overviewβ
Session Analytics automatically tracks every agent session, collecting detailed metrics about:
- Token usage and costs per model
- Tool execution and success rates
- Performance metrics (wall time, agent active time, API time)
- Code changes (lines added/removed)
- Cache effectiveness
All session data is stored locally in .radium/_internals/sessions/ as JSON files, providing a complete history of your agent interactions.
Key Featuresβ
Session Trackingβ
Every agent session is automatically assigned a unique session ID and tracked from start to finish. Session data includes:
- Start and end timestamps
- Total duration (wall time)
- Agent active time (time agents were actually running)
- Breakdown of API time vs tool execution time
Cost Transparencyβ
Track token usage and estimated costs per model:
- Input and output tokens per model
- Cached token usage (showing cache savings)
- Estimated cost calculations
- Aggregated costs across all sessions
Performance Metricsβ
Understand where time is spent:
- Wall time (total session duration)
- Agent active time (time agents were running)
- API time (time spent in API calls)
- Tool time (time spent executing tools)
- Success rate for tool calls
Code Change Trackingβ
Automatically tracks code changes via git diff:
- Lines added
- Lines removed
- Files changed
Requires a git repository in the workspace.
Cache Optimization Metricsβ
Monitor cache effectiveness:
- Cache hit rate
- Total cached tokens
- Cache creation vs read tokens
- Cost savings from cache usage
Storage Locationβ
Session reports are stored in:
.radium/_internals/sessions/<session-id>.json
Each session is saved as a JSON file containing complete metrics. By default, reports are stored in pretty-printed format for readability. You can enable compact JSON format using the RADIUM_COMPACT_SESSION_JSON environment variable:
export RADIUM_COMPACT_SESSION_JSON=true
CLI Commandsβ
View Current Sessionβ
Show statistics for the current or most recent session:
rad stats session
rad stats session --session-id <session-id>
rad stats session --json # Output as JSON
Example Output:
Interaction Summary
Session ID: 3c6ddcd3-85b6-48f1-88e1-f428ca458337
Tool Calls: 231 ( β 214 x 17 )
Success Rate: 92.6%
Code Changes: +505 -208
Performance
Wall Time: 4h 9m 54s
Agent Active: 2h 53m 17s
Β» API Time: 1h 9m 42s (40.2%)
Β» Tool Time: 1h 43m 35s (59.8%)
Model Usage Reqs Input Tokens Output Tokens
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
gemini-2.5-flash-lite 28 60,389 2,422
gemini-3-pro-preview 168 31,056,954 44,268
Model Usage Breakdownβ
View detailed model usage statistics:
rad stats model # Aggregated across all sessions
rad stats model --session-id <id> # For specific session
rad stats model --json # JSON output
Example Output:
Aggregated Model Usage (All Sessions)
Model Requests Input Tokens Output Tokens Cached Tokens Cost
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
gemini-3-pro-preview 168 31,056,954 44,268 12,000 $0.1250
gemini-2.5-flash-lite 28 60,389 2,422 5,000 $0.0025
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
TOTAL 196 31,117,343 46,690 17,000 $0.1275
Engine Usage Breakdownβ
View engine-specific performance metrics:
rad stats engine --session-id <id>
rad stats engine --json
Session Historyβ
View historical session summaries:
rad stats history # Last 10 sessions (default)
rad stats history --limit 20 # Last 20 sessions (max 100)
rad stats history --json # JSON output
Example Output:
Recent Session Summaries
Session ID Duration Tool Calls Success Rate Cost
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
3c6ddcd3-85b6-48f1-88e1... 4h 9m 231 92.6% $0.1250
a1b2c3d4-e5f6-7890-abcd... 2h 15m 145 95.2% $0.0850
Compare Sessionsβ
Compare two sessions to identify improvements or regressions:
rad stats compare <session-id-1> <session-id-2>
rad stats compare <session-id-1> <session-id-2> --json
Example Output:
Session Comparison
βββββββββββββββββββ
Session A: 3c6ddcd3-85b6-48f1-88e1-f428ca458337
Session B: a1b2c3d4-e5f6-7890-abcd-ef1234567890
Token Usage
βββββββββββ
Session A: 50000 input, 2000 output (total: 52000)
Session B: 45000 input, 1800 output (total: 46800)
Delta: -5200 (-10.0%)
Cost
ββββ
Session A: $0.1250
Session B: $0.1100
Delta: -0.0150 (-12.0%)
Performance
βββββββββββ
Wall Time: -1h 54m (-46.2%)
Agent Active: -1h 20m (-44.4%)
Tool Calls
ββββββββββ
Session A: 231
Session B: 145
Delta: -86 (-37.2%)
Success Rate: 92.6% β 95.2% (+2.6%)
Code Changes
ββββββββββββ
Session A: +505 -208
Session B: +320 -150
Delta: -185 / -58
Export Analyticsβ
Export session data to JSON:
rad stats export # Export all sessions to stdout
rad stats export --output data.json # Export to file
rad stats export --session-id <id> # Export specific session
Troubleshootingβ
No Sessions Foundβ
If you see "No session history found" or "No sessions found":
- Ensure you're in a Radium workspace (run
rad initif needed) - Verify that agent sessions have been executed
- Check that
.radium/_internals/sessions/directory exists
Corrupted Session Filesβ
If session files are corrupted:
- Check the logs for warnings about corrupted files
- Corrupted files are automatically skipped during listing
- You can manually delete corrupted
.jsonfiles from the sessions directory - The system will continue to function with remaining valid sessions
Missing Code Change Trackingβ
If code changes show as 0:
- Ensure your workspace is a git repository
- Run
git initif needed - Code changes are calculated using
git diff, so uncommitted changes are tracked
Performance Issues with Large Historyβ
If rad stats history is slow:
- Use the
--limitflag to limit results (default: 10, max: 100) - The system uses pagination to efficiently load only requested sessions
- For very large histories (1000+ sessions), consider using
rad stats exportand filtering externally
Related Documentationβ
- Optimizing Costs - Strategies for reducing session costs
- Monitoring & Telemetry - Underlying telemetry system