AI Agent Session Analytics Platform
Track, Analyze, and Optimize Your AI Agent Sessions
AgentLens is a comprehensive analytics platform designed for AI coding agents and conversational AI tools. It helps developers track, analyze, and optimize their AI agent sessions with detailed insights into token usage, costs, and performance metrics.
Whether you're using Claude Code, Cursor, GitHub Copilot, or any other AI agent, AgentLens provides the visibility you need to understand and improve your AI-assisted development workflow.
- 📊 Real-time Dashboard - Beautiful web interface with live session statistics
- 💰 Cost Tracking - Automatic token counting and cost estimation
- 🤖 Multi-Agent Support - Works with Claude, Cursor, Codex, and more
- 📈 Analytics & Reports - Daily trends, agent comparisons, cost analysis
- 🖥️ CLI Tool - Command-line interface for quick session management
- 🔒 Local-First - Data stored locally, privacy guaranteed
- 🌐 REST API - Full-featured API for custom integrations
- 📱 Responsive UI - Works on desktop, tablet, and mobile
- Python 3.10+
- Node.js 18+ (for frontend development)
# Clone the repository
git clone https://github.com/gitstq/AgentLens.git
cd AgentLens
# Install Python dependencies
pip install -r requirements.txt
# Install frontend dependencies (optional, for development)
cd frontend
npm install# Start the API server
python -m src.main
# Or use the CLI
python -m src.cli.main serveThe web dashboard will be available at http://localhost:8000
# Start a new session
python -m src.cli.main start --agent claude --project my-project
# Log a command
python -m src.cli.main log <session-id> "git commit -m 'update'"
# End session with stats
python -m src.cli.main end <session-id> --input-tokens 1000 --output-tokens 500
# View analytics
python -m src.cli.main stats- Start a Session: Begin tracking when you start working with your AI agent
- Log Commands: Record each interaction for detailed analysis
- End Session: Finalize with token counts for cost calculation
- Dashboard: Overview of all sessions, costs, and trends
- Sessions: Detailed list with filtering and search
- Analytics: Charts and reports for deeper insights
- Settings: Configure pricing and preferences
| Endpoint | Method | Description |
|---|---|---|
/api/v1/sessions |
GET | List all sessions |
/api/v1/sessions |
POST | Create new session |
/api/v1/sessions/{id} |
GET | Get session details |
/api/v1/sessions/{id} |
PATCH | Update session |
/api/v1/commands |
POST | Log a command |
/api/v1/analytics/summary |
GET | Get analytics summary |
- Privacy First: All data stays on your machine
- Developer Friendly: Simple CLI, powerful API
- Extensible: Easy to add new agent types and metrics
- Lightweight: Minimal resource usage
- Export reports to PDF/CSV
- Team collaboration features
- Integration with popular IDEs
- Advanced cost optimization suggestions
- Multi-language support expansion
FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 8000
CMD ["python", "-m", "src.main"]cd frontend
npm run buildpytest tests/ -vWe welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'feat: Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ for the AI Developer Community