amitpaz1/agentlens: Open-source observability and audit trail platform for AI agents. MCP-native, tamper-evident event logging, real-time dashboard.


Open-source observability & audit trail for AI agents

npm server
npm mcp
License: MIT
Build Status


AgentLens is a flight recorder for AI agents. It captures every tool call, approval decision, data exchange, and error β€” then presents it through a queryable API and real-time web dashboard.

MCP-native. Add one config block β†’ every tool call is captured automatically. Zero code changes.

  • πŸ”Œ MCP-Native β€” Ships as an MCP server. Agents connect to it like any other tool. Works with Claude Desktop, Cursor, and any MCP client.
  • πŸ“Š Real-Time Dashboard β€” Session timelines, event explorer, cost analytics, and alerting in a beautiful web UI.
  • πŸ”’ Tamper-Evident Audit Trail β€” Append-only event storage with SHA-256 hash chains per session. Cryptographically linked and verifiable.
  • πŸ’° Cost Tracking β€” Track token usage and estimated costs per session, per agent, over time. Alert on cost spikes.
  • 🚨 Alerting β€” Configurable rules for error rate, cost threshold, latency anomalies, and inactivity.
  • πŸ”— AgentKit Ecosystem β€” First-class integrations with AgentGate (approval flows) and FormBridge (data collection).
  • 🏠 Self-Hosted β€” SQLite by default, no external dependencies. MIT licensed. Your data stays on your infrastructure.
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  AI Agents (Claude Desktop, Cursor, GPT-4, Custom)          β”‚
β”‚                        β”‚                                    β”‚
β”‚                        β”‚ MCP Protocol (stdio)               β”‚
β”‚                        β–Ό                                    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                   β”‚
β”‚  β”‚       @agentlensai/mcp                 β”‚                   β”‚
β”‚  β”‚  Tools: session_start Β· log_event    β”‚                   β”‚
β”‚  β”‚         session_end Β· query_events   β”‚                   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                   β”‚
β”‚                 β”‚ HTTP (batched events)                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              @agentlensai/server                               β”‚
β”‚                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”               β”‚
β”‚  β”‚  Ingest    β”‚ β”‚   Query    β”‚ β”‚   Alert    β”‚               β”‚
β”‚  β”‚  Engine    β”‚ β”‚   Engine   β”‚ β”‚   Engine   β”‚               β”‚
β”‚  β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜               β”‚
β”‚        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                     β”‚
β”‚               β”‚                                              β”‚
β”‚        β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”               β”‚
β”‚        β”‚   SQLite    β”‚         β”‚  Dashboard  β”‚               β”‚
β”‚        β”‚  (append    β”‚         β”‚  React SPA  β”‚               β”‚
β”‚        β”‚   only)     β”‚         β”‚  (served    β”‚               β”‚
β”‚        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚   at /)     β”‚               β”‚
β”‚                                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

  Integrations:  AgentGate ──┐
                 FormBridge ────► POST /api/events/ingest
                 Generic β”€β”€β”€β”€β”˜     (HMAC-SHA256 verified)

Opens on http://localhost:3400 with SQLite β€” zero config.

curl -X POST http://localhost:3400/api/keys \
  -H "Content-Type: application/json" \
  -d '{"name": "my-agent"}'

Save the als_... key from the response β€” it’s shown only once.

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "agentlens": {
      "command": "npx",
      "args": ["@agentlensai/mcp"],
      "env": {
        "AGENTLENS_API_URL": "http://localhost:3400",
        "AGENTLENS_API_KEY": "als_your_key_here"
      }
    }
  }
}

Cursor (.cursor/mcp.json):

{
  "mcpServers": {
    "agentlens": {
      "command": "npx",
      "args": ["@agentlensai/mcp"],
      "env": {
        "AGENTLENS_API_URL": "http://localhost:3400",
        "AGENTLENS_API_KEY": "als_your_key_here"
      }
    }
  }
}

Navigate to http://localhost:3400 β€” see sessions, timelines, analytics, and alerts in real time.

Endpoint Description
POST /api/events Ingest events (batch)
GET /api/events Query events with filters
GET /api/sessions List sessions
GET /api/sessions/:id/timeline Session timeline with hash chain verification
GET /api/analytics Bucketed metrics over time
GET /api/analytics/costs Cost breakdown by agent
POST /api/alerts/rules Create alert rules
POST /api/events/ingest Webhook ingestion (AgentGate/FormBridge)
POST /api/keys Create API keys

Full API Reference β†’

πŸ”— Part of the AgentKit Suite

AgentLens works alongside two companion projects for unified agent lifecycle management:

Together: data collection β†’ approvals β†’ observability.

Approval events from AgentGate and form submissions from FormBridge appear directly in AgentLens session timelines, giving you a single view of the complete agent lifecycle.

# Clone and install
git clone https://github.com/amitpaz/agentlens.git
cd agentlens
pnpm install

# Run all checks
pnpm typecheck
pnpm test
pnpm lint

# Start dev server
pnpm dev
  • Node.js β‰₯ 20.0.0
  • pnpm β‰₯ 10.0.0

MIT Β© Amit Paz



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *