Observed since 20 Oct, 22:34 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
See what your agents think. Open-source AI Agent observability platform.
See what your agents think.
Every AI agent is a black box. You send a prompt, wait, and get a result — but you have no idea what happened in between. Which tools did it call? How many tokens did it burn? Why did it make that decision?
AgentLens opens the box. It's an open-source observability toolkit that traces every step of your AI agent's execution — LLM calls, tool invocations, decision branches — and shows them in a real-time debug panel. For developers debugging agents, and for end users who need to trust them.
Building AI agents is hard. Debugging them is harder.
Existing tools like Langfuse track LLM calls, but agents are more than LLM calls — they're chains of decisions, tool uses, and branching logic. You need visibility into the full picture.
3 lines of code. Full visibility.
import agentlens
agentlens.init(auto_instrument=["openai"])
# That's it. Every OpenAI call is now traced.
Then open the debug panel:
agentlens serve
# → http://localhost:7600
You'll see every agent run as an interactive execution tree — nested spans, token counts, latencies, inputs/outputs, errors — all in real time.
Trace your agent's full execution chain with decorators:
@agentlens.agent(name="research_agent")
def research(topic: str) -> str:
queries = generate_queries(topic) # traced
results = search(queries) # traced
return summarize(results) # traced
@agentlens.tool(name="search")
def search(queries: list) -> list:
...
@agentlens.llm_call(name="summarize", model="gpt-4o")
def summarize(results: list) -> str:
...
The debug panel gives you:
Your users shouldn't have to blindly trust your agent. Embed transparency directly into your app with @agentlens/widget:
import { AgentLensProvider, StatusStream, ThinkingView, ConfirmDialog } from '@agentlens/widget';
function App() {
return (
<AgentLensProvider endpoint="ws://localhost:7600/ws/traces">
<ThinkingView collapsed={false} />
<StatusStream maxItems={5} showTimestamp />
<ConfirmDialog allowReason />
</AgentLensProvider>
);
}
| Component | What it does |
|---|---|
<StatusStream /> | Real-time feed showing what the agent is doing right now |
<ThinkingView /> | Step-by-step breakdown of the agent's reasoning process |
<ConfirmDialog /> | Pause execution for human approval on critical operations |
Some operations are too important to run on autopilot. Mark them with requires_confirm=True and the agent pauses until a human approves:
@agentlens.tool(name="deploy", requires_confirm=True)
def deploy(env: str) -> dict:
return {"status": "deployed", "env": env}
@agentlens.tool(name="apply_fix", requires_confirm=True)
def apply_fix(file: str, line: int, fix: str) -> dict:
return {"status": "applied", "file": file}
When the agent hits a confirmed step, the <ConfirmDialog> widget pops up in the user's browser. Execution resumes only after approval.
Your Python Agent
│
├── agentlens.init() # One-line setup
├── @agent / @tool / @llm_call # Decorator-based tracing
└── OpenAI auto-instrument # Zero-code tracing
│
▼
In-Process Collector (async)
│
▼
SQLite (~/.agentlens/traces.db) # Zero infrastructure
│
▼
FastAPI Server (localhost:7600)
├── REST API → /api/v1/traces
├── WebSocket → /ws/traces (real-time push)
├── Debug Panel → React SPA
└── Widget SDK → @agentlens/widget (npm)
Everything runs locally. No cloud. No accounts. No data leaves your machine.
agentlens.init(auto_instrument=["openai"])
@agentlens.trace(name="research_agent")
def research(topic: str) -> str:
queries = generate_search_queries(topic) # GPT-4o-mini
findings = [analyze(q) for q in queries] # GPT-4o-mini × 3
return synthesize(findings) # GPT-4o
@agentlens.agent(name="daily_briefing_agent")
def daily_briefing(email: str, city: str, interests: list) -> str:
weather = fetch_weather(city)
news = [fetch_news(topic) for topic in interests]
send_email(to=email, subject="Daily Briefing", body=compose(weather, news))
@agentlens.agent(name="code_review_agent")
def review_and_fix(repo: str) -> str:
issues = analyze_codebase(repo)
for issue in issues:
apply_fix(issue) # ← requires_confirm=True, pauses here
if run_tests()["failed"] == 0:
deploy("staging") # ← requires_confirm=True, pauses here
See full examples in examples/.
agentlens.init(auto_instrument=["openai"]) # Initialize
@agentlens.trace(name="my_trace") # Top-level trace
@agentlens.agent(name="my_agent") # Agent span
@agentlens.tool(name="my_tool") # Tool span
@agentlens.llm_call(name="call", model="gpt-4o") # LLM call span
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/traces | List traces (limit, offset, status) |
| GET | /api/v1/traces/{id} | Get trace with full span tree |
| GET | /api/v1/traces/{id}/stats | Trace statistics (tokens, cost, duration) |
| DELETE | /api/v1/traces/{id} | Delete a trace |
Connect to ws://localhost:7600/ws/traces for real-time events:
span_start — New span beganspan_end — Span completed (status, duration, tokens)trace_end — Trace completedpip install agentlens
import agentlens
agentlens.init(auto_instrument=["openai"])
# All OpenAI calls are now traced
agentlens serve
# Open http://localhost:7600
# Clone and install
git clone https://github.com/TF-Wilbur/agentlens.git
cd agentlens
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
# Run tests (111 tests, 88% coverage)
pytest
# Frontend debug panel
cd frontend && npm install && npm run dev
# Widget library
cd widget && npm install && npm run build
| AgentLens | Langfuse | LangSmith | |
|---|---|---|---|
| Traces full agent logic | Yes | LLM calls only | LangChain only |
| End-user widgets | Yes | No | No |
| Human-in-the-loop | Built-in | No | No |
| Self-hosted | Local-first | Docker required | Cloud only |
| Framework lock-in | None | None | LangChain |
| Setup | 3 lines | Docker + config | Account + API key |
MIT
看见你的 Agent 在想什么。
每个 AI Agent 都是一个黑盒。你发了一个 prompt,等了一会儿,拿到结果——但中间发生了什么,你一无所知。它调了哪些工具?烧了多少 token?为什么做了那个决定?
AgentLens 打开这个黑盒。它是一个开源的 AI Agent 可观测性工具,追踪 Agent 执行的每一步——LLM 调用、工具调用、决策分支——并在实时调试面板中展示。既帮开发者调试 Agent,也帮终端用户信任 Agent。
构建 AI Agent 很难,调试它更难。
现有工具如 Langfuse 追踪 LLM 调用,但 Agent 不只是 LLM 调用——它是决策、工具使用和分支逻辑的链条。你需要看到全貌。
3 行代码,完整可见。
import agentlens
agentlens.init(auto_instrument=["openai"])
# 搞定。所有 OpenAI 调用自动被追踪。
然后打开调试面板:
agentlens serve
# → http://localhost:7600
你会看到每次 Agent 运行的交互式执行树——嵌套的 span、token 计数、延迟、输入/输出、错误——全部实时展示。
用装饰器追踪 Agent 的完整执行链路:
@agentlens.agent(name="research_agent")
def research(topic: str) -> str:
queries = generate_queries(topic) # 被追踪
results = search(queries) # 被追踪
return summarize(results) # 被追踪
调试面板提供:
你的用户不应该盲目信任 Agent。用 @agentlens/widget 把透明度直接嵌入你的应用:
import { AgentLensProvider, StatusStream, ThinkingView, ConfirmDialog } from '@agentlens/widget';
function App() {
return (
<AgentLensProvider endpoint="ws://localhost:7600/ws/traces">
<ThinkingView collapsed={false} />
<StatusStream maxItems={5} showTimestamp />
<ConfirmDialog allowReason />
</AgentLensProvider>
);
}
| 组件 | 功能 |
|---|---|
<StatusStream /> | 实时状态流,展示 Agent 当前在做什么 |
<ThinkingView /> | Agent 思考过程的逐步展示 |
<ConfirmDialog /> | 关键操作暂停,等待人类审批 |
有些操作不能让 Agent 自动执行。标记 requires_confirm=True,Agent 会暂停等待人类批准:
@agentlens.tool(name="deploy", requires_confirm=True)
def deploy(env: str) -> dict:
return {"status": "deployed", "env": env}
当 Agent 执行到确认步骤时,<ConfirmDialog> 组件会在用户浏览器中弹出,只有批准后才继续执行。
| AgentLens | Langfuse | LangSmith | |
|---|---|---|---|
| 追踪完整 Agent 逻辑 | 是 | 仅 LLM 调用 | 仅 LangChain |
| 终端用户组件 | 有 | 无 | 无 |
| 人机协作 | 内置 | 无 | 无 |
| 部署方式 | 本地优先 | 需要 Docker | 仅云端 |
| 框架绑定 | 无 | 无 | LangChain |
| 接入成本 | 3 行代码 | Docker + 配置 | 注册 + API Key |
pip install agentlens
import agentlens
agentlens.init(auto_instrument=["openai"])
# 所有 OpenAI 调用自动被追踪
agentlens serve
# 打开 http://localhost:7600
一切在本地运行。无需云服务、无需注册、数据不离开你的机器。
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.0 | 31 Mar 2026 | 14 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 22:34 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:bdd00d5bb8901994ed263e79e697a65b292ff84e367fa731b94b79c66d5e7e3f