The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the Agentlens listing page.
Open-source observability for AI agents — with a tamper-evident audit trail
Every event SHA-256 hash-chained & cryptographically verifiable — built for EU AI Act Article 12 record-keeping
📖 Documentation · Quick Start · Dashboard · ☁️ Cloud
AgentLens is a flight recorder for AI agents. It captures every LLM call, tool invocation, approval decision, and error — then presents it through a queryable API and real-time web dashboard.
What sets AgentLens apart from other observability tools: every event is SHA-256 hash-chained to the one before it, the same way git commits and blockchains are linked. The audit log is append-only and cryptographically verifiable — alter, delete, or reorder a single record after the fact and verification fails, pointing at the exact event that broke. Purpose-built for the record-keeping obligations of EU AI Act Article 12 and the emerging IETF Agent Audit Trail work.
See it for yourself in 30 seconds (needs Docker):
The demo ingests a real trace, verifies the chain (passes), edits one record directly in the database behind the audit log's back, then re-verifies (fails). Auditors get a signed, verifiable JSON snapshot from GET /api/audit/verify/export.
Five ways to integrate — pick what fits your stack:
| Integration | Language | Effort | Capture |
|---|---|---|---|
| 🔭 OpenTelemetry | Any | Point your OTLP exporter | Any gen_ai.*-instrumented agent — no AgentLens SDK |
| 🤖 OpenClaw Plugin | OpenClaw | Copy & enable | Every Anthropic call — prompts, tokens, cost, tools — zero code |
| 🐍 Python Auto-Instrumentation | Python | 1 line | Every OpenAI / Anthropic / LangChain call — deterministic |
| 🔌 MCP Server | Any (MCP) | Config block | Tool calls, sessions, events from Claude Desktop / Cursor |
| 📦 SDK | Python, TypeScript | Code | Full control — log events, query analytics, build integrations |
One command — server + dashboard on SQLite, zero config:
Or without Docker:
AUTH_DISABLED=trueis for a quick local trial (JWT_SECRETis still required by the hardened image). For anything shared, dropAUTH_DISABLED, set a realJWT_SECRET, and create an API key (below).
Full stack (Postgres + Redis, auth, TLS) — runs from source:
Save the als_... key from the response — it's shown only once. Then head to the Integration Guides to instrument your agent.
If your agent is already instrumented with the OpenTelemetry GenAI semantic conventions — via OpenLLMetry, OpenInference, or the official OTel instrumentations — just point its OTLP exporter at AgentLens. No AgentLens SDK required.
AgentLens maps gen_ai.* spans into its model and into the tamper-evident audit log:
OTel GenAI span (gen_ai.operation.name) | Becomes |
|---|---|
chat / text_completion / generate_content | a paired llm_call + llm_response (model, provider, messages, usage.input_tokens/output_tokens, finish reason, latency, cost) |
execute_tool | tool_call (gen_ai.tool.name, gen_ai.tool.call.id, arguments) |
embeddings | embedding event with token usage |
invoke_agent / create_agent | agent-invocation event |
Each OTel trace maps to a session (or gen_ai.conversation.id if present), and every event is hash-chained like any other — so traces from any GenAI framework get the same verifiable audit trail. Set OTLP_AUTH_TOKEN to require a bearer token on the OTLP endpoints in production.
Cost with no SDK: OTel GenAI instrumentation reports tokens but rarely cost. AgentLens reconstructs
costUsdfrom the model's per-1M-token pricing (fuzzy-matched on the model id), so OTel-only agents get the same cost analytics as SDK-instrumented ones — no per-call cost attribute required.
If you're running OpenClaw, the AgentLens plugin captures every Anthropic API call automatically — prompts, completions, token usage, costs, latency, and tool calls.
Set AGENTLENS_URL if your AgentLens instance isn't on localhost:3400. See the plugin README for details.
One line — every LLM call captured automatically across 9 providers (OpenAI, Anthropic, LiteLLM, AWS Bedrock, Google Vertex AI, Google Gemini, Mistral AI, Cohere, Ollama):
Key guarantees: ✅ Deterministic · ✅ Fail-safe · ✅ Non-blocking · ✅ Privacy (init(redact=True))
For Claude Desktop, Cursor, or any MCP client — add to your config:
AgentLens ships 22 MCP tools — covering core observability, intelligence & analytics, and operations. Full MCP tool reference →
Python:
TypeScript:
agentlensai.init() captures every LLM call across 9 providers automatically. Deterministic — no reliance on LLM behavior.gen_ai.* OTLP traces from any OTel-instrumented agent (OpenLLMetry, OpenInference, official OTel) — no AgentLens SDK required.AgentLens ships with a real-time web dashboard for monitoring your agents.

The overview page shows live metrics — sessions, events, errors, and active agents — with a 24-hour event timeline chart, recent sessions with status badges, and a recent errors feed.

Every agent session with sortable columns: agent name, status, start time, duration, event count, error count, and total cost.

Full event timeline with tamper-evident hash chain verification. Filter by event type, view cost breakdown.

Searchable, filterable view of every event across all sessions.

Total LLM calls, cost, latency, and token usage across all agents with model comparison.

LLM calls in session timeline with model, tokens, cost, and latency.

Full prompt and completion in a chat-bubble style viewer with metadata panel.

5-dimension health score for every agent with trend tracking.

Analyzes LLM call patterns and recommends cheaper model alternatives with confidence levels.

Step through any past session event by event with full context reconstruction.

Create and manage A/B experiments with statistical significance testing.

Create and manage automated safety rules with trigger history and activity feed.
Don't want to self-host? AgentLens Cloud is a fully managed SaaS — same SDK, zero infrastructure:
url= to cloud=True📖 Cloud Setup Guide · Migration Guide · Troubleshooting
| Package | Description | PyPI |
|---|---|---|
agentlensai | Python SDK + auto-instrumentation for 9 LLM providers |
| Package | Description | npm |
|---|---|---|
@agentkitai/agentlens-server | Hono API server + dashboard serving | |
@agentkitai/agentlens-mcp | MCP server for agent instrumentation | |
@agentkitai/agentlens-sdk | Programmatic TypeScript client | |
@agentkitai/agentlens-core | Shared types, schemas, hash chain utilities | |
@agentkitai/agentlens-cli | Command-line interface | |
@agentkitai/agentlens-dashboard | React web dashboard (bundled with server) | private |
| 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 |
Both commands support --format json for machine-readable output. See agentlens health --help for all options.
Requirements: Node.js ≥ 20.0.0 · pnpm ≥ 10.0.0
We welcome contributions! See CONTRIBUTING.md for setup instructions, coding standards, and the PR process.
| Project | Description | |
|---|---|---|
| AgentLens | Observability & tamper-evident audit trail for AI agents | ⬅️ you are here |
| AgentGate | Human-in-the-loop approval gateway + reactive guardrails | |
| Lore | Cross-agent memory and lesson sharing | |
| AgentEval | Testing & evaluation framework | |
| FormBridge | Agent-human mixed-mode forms |