Skip to content

Repository files navigation

🔍 AgentLens

AI Agent Session Analytics Platform

Python FastAPI React License Version

AgentLens Logo

Track, Analyze, and Optimize Your AI Agent Sessions

English | 简体中文 | 繁體中文


🎉 Project Introduction

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.

✨ Core Features

  • 📊 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

🚀 Quick Start

Prerequisites

  • Python 3.10+
  • Node.js 18+ (for frontend development)

Installation

# 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 Server

# Start the API server
python -m src.main

# Or use the CLI
python -m src.cli.main serve

The web dashboard will be available at http://localhost:8000

Using the CLI

# 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

📖 Detailed Usage Guide

Session Tracking

  1. Start a Session: Begin tracking when you start working with your AI agent
  2. Log Commands: Record each interaction for detailed analysis
  3. End Session: Finalize with token counts for cost calculation

Web Dashboard

  • 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

API Endpoints

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

💡 Design Philosophy & Roadmap

Design Principles

  • 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

Roadmap

  • Export reports to PDF/CSV
  • Team collaboration features
  • Integration with popular IDEs
  • Advanced cost optimization suggestions
  • Multi-language support expansion

📦 Packaging & Deployment

Docker Deployment

FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 8000
CMD ["python", "-m", "src.main"]

Build Frontend

cd frontend
npm run build

Run Tests

pytest tests/ -v

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'feat: Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


Made with ❤️ for the AI Developer Community

Report Bug · Request Feature

About

Lightweight AI Coding Agent Session Intelligence Analysis Engine | 轻量级AI编码代理会话智能分析引擎

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages