Trace every LLM call.
One line of code.
Drop in @farzanhossans/agentlens. OpenAI, Anthropic, Gemini, Cohere, Mistral — every call traced automatically.
Costs, errors, session replay included. No client wrappers, no code changes inside your call sites.
MIT licensed · Self-host in 2 minutes · No vendor lock-in
AI agents fail silently.
You deserve to know why.
Your agent returned the wrong answer. You have no idea which LLM call went wrong.
Your OpenAI bill hit $2,000. You can't explain which agent or feature caused it.
A bug in production. You can't reproduce it because you have no trace of what the model saw.
5 agents, 3 models, streaming everywhere. Something broke. Good luck finding which call.
Two ways to integrate.
Start with one line.
The universal SDK covers every major provider in one line. Drop down to manual tracing when you need custom span hierarchies.
Universal SDK — one line
Drop in @farzanhossans/agentlens. Every call to OpenAI, Anthropic, Gemini, Cohere, and Mistral is traced automatically — including streaming.
import { AgentLens } from '@farzanhossans/agentlens'
AgentLens.init({
apiKey: 'proj_xxx',
projectId: '<your-project-uuid>',
endpoint: 'https://your-agentlens.com/v1/spans',
})
// done. every LLM call is traced.
Manual — full control
Wrap any code in AgentLens.trace() for custom spans, metadata, and parent/child hierarchies.
AgentLens.trace('classify', (span) => {
span.setMetadata('user', id)
// your LLM calls here
})
Everything you need to
debug AI agents.
Universal SDK
One line traces every provider — OpenAI, Anthropic, Gemini, Cohere, Mistral. Network-layer interception works with axios, got, node-fetch, or any client.
Trace Viewer
Full input/output timeline with parent/child span hierarchy. See exactly what the model received and returned.
Cost Analytics
Token usage and dollar cost by model, agent, and date. Instant aggregations across millions of spans. Monthly budget tracking.
Smart Alerts
Error rate, cost spike, P95 latency, failure count. Real-time metric evaluation. Notify via Slack, email, or webhook.
Live Feed
Watch agent calls in real-time via WebSocket. See traces as they happen in production.
Session Replay
Step through any past agent run. Group traces by session to see multi-turn conversations.
PII Scrubbing
Emails, API keys, SSNs, credit cards auto-masked before data leaves your infrastructure. GDPR ready.
Streaming-safe
SSE streams are tapped via ReadableStream.tee() — the bytes you read are byte-identical to the original. Zero latency added.
Trace Grouping
Group multiple LLM calls into one trace with optional headers. See parent/child span hierarchies for multi-step agent runs.
Error Clustering
Similar failures auto-grouped with count badges and affected models. Spot patterns instantly instead of scrolling through logs.
Self-Hostable
One docker compose command. Your data stays on your servers. No third-party accounts required.
Your data. Your servers.
2 minutes to deploy.
- Full stack in one
docker composecommand - No Vercel, no Cloudflare, no third-party accounts
- PostgreSQL, Redis, Elasticsearch — search, analytics, and auto-cleanup built in
- MIT licensed — free forever, no usage limits
- Custom domains and SSL with any reverse proxy
# Clone and configure git clone https://github.com/farzanhossan/agentlens cd agentlens/infra cp .env.prod.example .env # Generate secrets openssl rand -hex 32 # paste as JWT_SECRET openssl rand -hex 32 # paste as HMAC_SECRET # Start everything docker compose -f docker-compose.prod.yml up -d --build # Dashboard http://localhost:4021 # API http://localhost:4020
Why developers choose AgentLens.
| Feature | AgentLens | LangSmith | Langfuse | Helicone |
|---|---|---|---|---|
| Universal SDK — one line, every provider | ✅ | ❌ LangChain only | ⚠️ Per-provider | ❌ Proxy only |
| Any language / framework | ✅ | ❌ LangChain only | ⚠️ | ✅ |
| PII scrubbing built-in | ✅ | ❌ | ❌ | ❌ |
| Session replay | ✅ | ✅ | ✅ | ❌ |
| Self-host (open source) | ✅ MIT | ❌ | ✅ | ❌ |
| Trace grouping (multi-call) | ✅ | ✅ | ✅ | ❌ |
| Real-time live feed | ✅ | ❌ | ❌ | ❌ |
| Free tier | Unlimited (self-host) | 5k traces | 50k events | 10k requests |
Free forever. Self-hosted.
- Unlimited traces
- Unlimited projects
- All features included
- Your infrastructure
- MIT license
Start debugging your AI agents today.
Deploy in 2 minutes. Free forever. No vendor lock-in.
MIT licensed · Docker only · No third-party accounts needed