agentlens_reflect
Analyze agent session data to identify recurring errors, common tool sequences, cost drivers, and performance trends. Returns structured insights with confidence scores.
Instructions
Analyze behavioral patterns from agent sessions — error patterns, tool sequences, cost analysis, and performance trends.
When to use: To identify recurring errors and their root causes (error_patterns), to understand cost drivers and optimize model usage (cost_analysis), to discover common tool usage chains and their success rates (tool_sequences), or to track performance over time (performance_trends).
What it returns: A list of structured insights with type, summary, data, and confidence score, plus metadata about how many sessions/events were analyzed. Each analysis type returns different data shapes.
Example: agentlens_reflect({ analysis: "error_patterns", agentId: "my-agent", from: "2026-01-01" }) → returns recurring error patterns with counts, first/last seen, and affected sessions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| analysis | Yes | Type of analysis to run: error_patterns (recurring errors), tool_sequences (common tool usage patterns), cost_analysis (cost breakdown and trends), performance_trends (success rate and duration trends) | |
| agentId | No | Filter analysis to a specific agent | |
| from | No | Start of time range (ISO 8601) | |
| to | No | End of time range (ISO 8601) | |
| params | No | Additional parameters (e.g., { model: "gpt-4o" } for cost_analysis) | |
| limit | No | Maximum number of results to return (default: 20) |