AgentLens
AgentLens
How We HelpDocsPricing

Getting Started

Installation

SDK Reference

API Reference

Guides

Documentation

Everything you need to set up and use AgentLens.

What is AgentLens

AgentLens is an audit trail for AI agents. It captures every tool call your agent makes and explains it in plain English in real time.

Works with Claude Desktop, Claude Code, Cursor, Cline, and any MCP-compatible agent. See every file read, every command run, every file written — as it happens.

Quick Start

1

Sign up at agentlens.dev

2

Copy your API key from Settings

3

Run the setup command:

bash
npx agentlens-cli setup-all --api-key YOUR_KEY --app-id YOUR_ID
4

Restart your agents

5

Done — check your dashboard

How it works

AgentLens sits between your AI agent and its tools. When your agent calls a tool (read a file, run a command, write code), AgentLens captures the call, sends it to the dashboard, and an AI explainer generates a plain-English summary with a severity rating.

Agent calls tool
AgentLens captures it
AI explains it
You see it live

Claude Desktop Setup

bash
npx agentlens-cli setup \
  --api-key YOUR_KEY \
  --app-id YOUR_APP_ID

This automatically edits your claude_desktop_config.json file. Restart Claude Desktop after running.

Config file locations

Mac: ~/Library/Application Support/Claude/

Windows: %APPDATA%\Claude\

Linux: ~/.config/Claude/

Claude Code Setup

bash
npx agentlens-cli setup-hooks \
  --api-key YOUR_KEY \
  --app-id YOUR_APP_ID \
  --agent claude-code

Installs a PostToolUse hook that logs every tool call. Restart Claude Code after running.

Any Agent (Direct API)

POST directly to the AgentLens API from any language or framework. No SDK installation needed.

bash
POST https://agentlens.vercel.app/api/ingest
Header: x-api-key: YOUR_KEY

Request body (JSON)

json
{
  "tool_name": "write_file",
  "arguments": { "path": "/src/app.js" },
  "result": { "success": true },
  "session_id": "your-session-uuid",
  "app_id": "your-app-uuid",
  "ai_model": "gpt-4",
  "llm_reasoning": "optional context"
}

Response

json
{ "success": true, "event_id": "uuid" }

JavaScript example

javascript
await fetch(
  'https://agentlens.vercel.app/api/ingest',
  {
    method: 'POST',
    headers: {
      'x-api-key': 'YOUR_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      tool_name: 'write_file',
      arguments: { path: '/src/app.js' },
      result: { success: true },
      session_id: crypto.randomUUID(),
      app_id: 'YOUR_APP_ID',
      ai_model: 'gpt-4'
    })
  }
)

Python example

python
import requests, uuid

requests.post(
    'https://agentlens.vercel.app/api/ingest',
    headers={'x-api-key': 'YOUR_KEY'},
    json={
        'tool_name': 'write_file',
        'arguments': {'path': '/src/app.js'},
        'result': {'success': True},
        'session_id': str(uuid.uuid4()),
        'app_id': 'YOUR_APP_ID',
        'ai_model': 'gpt-4'
    }
)

CLI Commands

Quick Start (one-liner)

bash
npx agentlens-cli setup-all --api-key YOUR_KEY --app-id YOUR_ID

Auto-detects and configures all AI agents on your machine. Supports Claude Desktop, Claude Code, Cursor, Cline, Windsurf, Antigravity.

List Connected Agents

bash
npx agentlens-cli list

Shows which agents are connected to AgentLens with configured hooks or MCP entries, along with masked API key previews.

Detection

bash
npx agentlens-cli detect

Scans your machine for installed AI agents and shows what's found.

Individual Setup (advanced)

bash
npx agentlens-cli setup --api-key KEY --app-id ID

Configure Claude Desktop only (MCP interceptor).

bash
npx agentlens-cli setup-hooks --api-key KEY --app-id ID --agent claude-code

Configure a specific agent's hooks manually.

Background Watchdog

bash
npx agentlens-cli daemon start

Start background watchdog. Auto-heals config, flushes offline queue every 5 minutes.

bash
npx agentlens-cli daemon stop

Stop the background watchdog.

bash
npx agentlens-cli daemon status

Check watchdog health, configured agents, and queue status.

Offline Queue

bash
npx agentlens-cli queue status

See how many events are queued while offline.

bash
npx agentlens-cli queue flush --api-key KEY --app-id ID

Manually send all queued events to the dashboard.

bash
npx agentlens-cli queue clear

Delete all queued events without sending.

Verify

bash
npx agentlens-cli verify

Check all config files and test API key connectivity. Useful for debugging setup issues.

Uninstall

bash
npx agentlens-cli uninstall

Remove AgentLens from all agents, stop daemon, clean up local files.

Configuration

AgentLens is configured through CLI flags at setup time. There is no separate config file to manage.

Required parameters

--api-key Your AgentLens API key (from Settings page)

--app-id Your app UUID (from Settings page)

Optional parameters

--agent Target agent (claude-code, cursor, cline) — only for setup-hooks

Environment variables

You can also set credentials via environment variables instead of CLI flags:

bash
export AGENTLENS_API_KEY=your-key
export AGENTLENS_APP_ID=your-app-id

Event Format

json
{
  "tool_name": "string",       // tool that ran
  "arguments": {},             // tool input
  "result": {},                // tool output
  "before_snapshot": {},       // file state before
  "session_id": "string",     // groups events
  "app_id": "string",         // your app UUID
  "ai_model": "string",       // which AI ran this
  "seq": 0,                   // event order
  "llm_reasoning": "string"   // optional context
}

POST /api/ingest

The main endpoint for sending events to AgentLens.

Endpoint

POST https://agentlens.vercel.app/api/ingest

Required Header

x-api-key: YOUR_KEY

Body Fields

tool_name — required, string

arguments — tool input, object

result — tool output, object

session_id — groups events (auto-generated if missing)

app_id — your app UUID

ai_model — e.g. gpt-4, claude-code, gemini

Authentication

All API requests require an x-api-key header. Get your API key from the Settings page after creating an app.

API keys are tied to a specific app. Each app has its own key. You can regenerate a key at any time — the old key is immediately revoked.

Rate Limits

LimitValue
Requests per minute100 per API key
Rate limit response429
Retry after60 seconds

Severity Levels

Safe

Read operations, information gathering — list_directory, read_file, search

Risky

Write operations, new file creation — create_file, write_file (new file), move_file, install_package

Destructive

Overwrites, deletions, irreversible changes — write_file (overwrite existing), delete_file, run_command with rm/drop/truncate

Unknown

Explanation failed or timed out. You can retry from the event card.

Reading the Dashboard

The Sessions page shows all captured agent sessions. Each session is a group of tool calls from a single agent run.

Click a session to see the event timeline — a chronological list of every tool call with plain-English explanations, severity badges, and expandable before/after diffs.

Use the filter bar to search by keyword, severity level, or date range. The stats bar shows total sessions, events today, destructive events, and active apps at a glance.

Sharing Sessions

Every session has a unique URL. Click the "Share session" button on any session detail page to copy the link.

Session URLs use unguessable UUIDs, so they act as share tokens. Anyone with the link can view the session — no login required.

Plan Limits

FeatureFreePro ($29/mo)Enterprise ($99/mo)
Apps15Unlimited
Events / month500UnlimitedUnlimited
History7 days90 days365 days
Email alertsNoYesYes