The interactive debugger for LLM agents. Pause, inspect, and fork any agent mid-run.
0
stars
39
commits
Python
primary language
Sep 3, 2026
updated
_ _ _
| | | | | |
| | ___ _ __ ___ | |_ ___| |
| | / _ \ '_ \/ __| | __/ __| |
| |___| __/ | | \__ \ | |_\__ \_|
|______\___|_| |_|___/ \__|___(_)
State a hypothesis. Fork. Compare. Know if it actually worked.

State a hypothesis. Fork. Run
GET /diff. Getverdict: "improved"— with numbers.
A local-first debugger for LLM agents that turns vibes-based prompt iteration into a measurable experiment.
The standard loop today:
You burn 10 minutes per hypothesis and you have no record of why you made each change. agent-lens replaces this with:
notes: "shorter system prompt should reduce hallucination") and an expected outcome (expected_output: "concise").verdict: improved, regressed, or neither_pass — and a structural diff of every message, response, and metric.You're left with a versioned record of every hypothesis you tested. Future-you (or your teammate) can read your reasoning, not just see the final code.
pip install agentlens-tracer
import agent_lens
from openai import OpenAI
agent_lens.install() # auto-patch OpenAI + Anthropic + LangChain
agent_lens.dashboard.start() # localhost:7878
client = OpenAI()
@agent_lens.trace
def my_agent(query: str) -> str:
return client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": query}]
).choices[0].message.content
my_agent("Explain Python 3.12 typing improvements")
Dashboard opens. Every LLM call is traced. Pause, fork, diff — all from the browser or the API.
No other observability tool — Langfuse, LangSmith, Phoenix, AgentOps, Helicone — has any of these.
POST /runs/{run_id}/fork
{
"span_id": "abc123",
"edited_messages": [{"role": "system", "content": "Be concise."}],
"notes": "Hypothesis: removing role constraint will reduce verbosity",
"expected_output": "concise"
}
Records the why alongside the what. The note travels with the run forever.
GET /runs/{run_a}/diff/{run_b}
Returns:
{
"messages_diff": [{"role": "system", "a": "...", "b": "...", "changed": true}],
"metrics_delta": {
"latency_ms": {"a": 1200, "b": 800, "delta": -400, "pct_change": -33.3},
"total_tokens": {"a": 450, "b": 180, "delta": -270, "pct_change": -60.0},
"cost_usd": {"a": 0.0045, "b": 0.0018, "delta": -0.0027}
},
"response_diff": {"a": "Verbose answer...", "b": "Concise answer.", "changed": true},
"thinking_blocks": {"a": [], "b": ["Let me reason step by step..."]},
"assertion_result": {
"expected_output": "concise",
"passed_in_a": false,
"passed_in_b": true,
"verdict": "improved"
}
}
Hypothesis confirmed. With numbers. In one HTTP call.
GET /runs/{run_id}/lineage
Walks the full ancestry chain. Useful when you've forked five times trying to fix the same bug — see every hypothesis in chronological order.
POST /runs/{run_id}/note
{ "notes": "This was the run that finally worked. Reason: temperature=0.2." }
Build institutional knowledge into your trace database, not your Slack DMs.
[Agent running] → click Pause → agent blocks at next LLM call
↓
[Edit messages in dashboard]
↓
click Fork → new run diverges
↓
click Resume → original continues
↓
[Two runs, side by side. GET /diff to compare.]
No restarts. No re-running preceding steps. Programmatic too:
from agent_lens.control import ControlPlane
cp = ControlPlane.get_instance()
cp.pause(run_id)
new_run_id = cp.fork(
run_id=run_id,
span_id=span_id,
edited_messages=[{"role": "user", "content": "Different question"}],
notes="Trying with explicit instructions",
expected_output="step-by-step",
)
cp.resume(run_id)
You're not debugging a function — you're debugging a probabilistic system. Every prompt change is a hypothesis test: "this change should improve X without breaking Y." Today, you run that test by eyeballing two outputs in two terminal windows. agent-lens makes the test structural, repeatable, and recorded.
Vibes-based prompt engineering is debugging without the debugger. agent-lens is the debugger.
~/.agent-lens/runs.db. No Docker. No cloud. No tool API keys.@trace.thinking_blocks flow into your traces alongside the response.sk-* keys, AIza*, sk-ant-* — stripped before they hit SQLite.| Feature | agent-lens | Langfuse | LangSmith |
|---|---|---|---|
| Local-first (no cloud) | ✅ | Partial | ❌ |
| Pause live agent mid-run | ✅ | ❌ | ❌ |
| Fork from any LLM call | ✅ | ❌ | ❌ |
| Structural run diff | ✅ | ❌ | ❌ |
| Hypothesis + expected_output | ✅ | ❌ | ❌ |
| Fork lineage trace | ✅ | ❌ | ❌ |
| Real-time dashboard | ✅ | ✅ | ✅ |
| Multi-framework (OpenAI/Claude/LC) | ✅ | ✅ | Partial |
| Data stays on your machine | ✅ | ❌ | ❌ |
| Zero-infrastructure setup | ✅ | ❌ | ❌ |
| Secret redaction by default | ✅ | Partial | Partial |
| Anthropic extended thinking captured | ✅ | ❌ | ❌ |
Does it work without OpenAI or Anthropic?
Yes. Use @agent_lens.trace on any Python function. The SDK integrations are optional.
Does my data leave my machine?
No. All data is stored in ~/.agent-lens/runs.db. No telemetry, no callbacks, no network egress.
Is it production-safe? It's designed for development and debugging. The overhead is < 5ms per traced call on local hardware. The dashboard server binds to 127.0.0.1 only — it's not exposed to the network.
What happens when I restart the dashboard? Traces persist in SQLite. Reload the dashboard — your previous runs and forks are still there, with all their notes intact.
Can I share a trace with a colleague?
Yes: agent-lens export <run_id> --output trace.html generates a self-contained HTML file. Email it, drop it in Slack, archive it in your repo. No agent-lens install needed to view.
Does the run diff work between unrelated runs, or only fork pairs?
Any two runs. The endpoint is GET /runs/{a}/diff/{b} — useful for comparing the same prompt across model versions, or two production runs with different inputs.
See CONTRIBUTING.md. Bug reports, feature requests, and PRs all welcome.
MIT — see LICENSE.
38 commits
1 commits
Python
83.6%
JavaScript
7.3%
CSS
4.7%
Jupyter Notebook
2.9%
HTML
1.3%
The interactive debugger for LLM agents. Pause, inspect, and fork any agent mid-run.
0
stars
39
commits
Python
primary language
Sep 3, 2026
updated
_ _ _
| | | | | |
| | ___ _ __ ___ | |_ ___| |
| | / _ \ '_ \/ __| | __/ __| |
| |___| __/ | | \__ \ | |_\__ \_|
|______\___|_| |_|___/ \__|___(_)
State a hypothesis. Fork. Compare. Know if it actually worked.

State a hypothesis. Fork. Run
GET /diff. Getverdict: "improved"— with numbers.
A local-first debugger for LLM agents that turns vibes-based prompt iteration into a measurable experiment.
The standard loop today:
You burn 10 minutes per hypothesis and you have no record of why you made each change. agent-lens replaces this with:
notes: "shorter system prompt should reduce hallucination") and an expected outcome (expected_output: "concise").verdict: improved, regressed, or neither_pass — and a structural diff of every message, response, and metric.You're left with a versioned record of every hypothesis you tested. Future-you (or your teammate) can read your reasoning, not just see the final code.
pip install agentlens-tracer
import agent_lens
from openai import OpenAI
agent_lens.install() # auto-patch OpenAI + Anthropic + LangChain
agent_lens.dashboard.start() # localhost:7878
client = OpenAI()
@agent_lens.trace
def my_agent(query: str) -> str:
return client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": query}]
).choices[0].message.content
my_agent("Explain Python 3.12 typing improvements")
Dashboard opens. Every LLM call is traced. Pause, fork, diff — all from the browser or the API.
No other observability tool — Langfuse, LangSmith, Phoenix, AgentOps, Helicone — has any of these.
POST /runs/{run_id}/fork
{
"span_id": "abc123",
"edited_messages": [{"role": "system", "content": "Be concise."}],
"notes": "Hypothesis: removing role constraint will reduce verbosity",
"expected_output": "concise"
}
Records the why alongside the what. The note travels with the run forever.
GET /runs/{run_a}/diff/{run_b}
Returns:
{
"messages_diff": [{"role": "system", "a": "...", "b": "...", "changed": true}],
"metrics_delta": {
"latency_ms": {"a": 1200, "b": 800, "delta": -400, "pct_change": -33.3},
"total_tokens": {"a": 450, "b": 180, "delta": -270, "pct_change": -60.0},
"cost_usd": {"a": 0.0045, "b": 0.0018, "delta": -0.0027}
},
"response_diff": {"a": "Verbose answer...", "b": "Concise answer.", "changed": true},
"thinking_blocks": {"a": [], "b": ["Let me reason step by step..."]},
"assertion_result": {
"expected_output": "concise",
"passed_in_a": false,
"passed_in_b": true,
"verdict": "improved"
}
}
Hypothesis confirmed. With numbers. In one HTTP call.
GET /runs/{run_id}/lineage
Walks the full ancestry chain. Useful when you've forked five times trying to fix the same bug — see every hypothesis in chronological order.
POST /runs/{run_id}/note
{ "notes": "This was the run that finally worked. Reason: temperature=0.2." }
Build institutional knowledge into your trace database, not your Slack DMs.
[Agent running] → click Pause → agent blocks at next LLM call
↓
[Edit messages in dashboard]
↓
click Fork → new run diverges
↓
click Resume → original continues
↓
[Two runs, side by side. GET /diff to compare.]
No restarts. No re-running preceding steps. Programmatic too:
from agent_lens.control import ControlPlane
cp = ControlPlane.get_instance()
cp.pause(run_id)
new_run_id = cp.fork(
run_id=run_id,
span_id=span_id,
edited_messages=[{"role": "user", "content": "Different question"}],
notes="Trying with explicit instructions",
expected_output="step-by-step",
)
cp.resume(run_id)
You're not debugging a function — you're debugging a probabilistic system. Every prompt change is a hypothesis test: "this change should improve X without breaking Y." Today, you run that test by eyeballing two outputs in two terminal windows. agent-lens makes the test structural, repeatable, and recorded.
Vibes-based prompt engineering is debugging without the debugger. agent-lens is the debugger.
~/.agent-lens/runs.db. No Docker. No cloud. No tool API keys.@trace.thinking_blocks flow into your traces alongside the response.sk-* keys, AIza*, sk-ant-* — stripped before they hit SQLite.| Feature | agent-lens | Langfuse | LangSmith |
|---|---|---|---|
| Local-first (no cloud) | ✅ | Partial | ❌ |
| Pause live agent mid-run | ✅ | ❌ | ❌ |
| Fork from any LLM call | ✅ | ❌ | ❌ |
| Structural run diff | ✅ | ❌ | ❌ |
| Hypothesis + expected_output | ✅ | ❌ | ❌ |
| Fork lineage trace | ✅ | ❌ | ❌ |
| Real-time dashboard | ✅ | ✅ | ✅ |
| Multi-framework (OpenAI/Claude/LC) | ✅ | ✅ | Partial |
| Data stays on your machine | ✅ | ❌ | ❌ |
| Zero-infrastructure setup | ✅ | ❌ | ❌ |
| Secret redaction by default | ✅ | Partial | Partial |
| Anthropic extended thinking captured | ✅ | ❌ | ❌ |
Does it work without OpenAI or Anthropic?
Yes. Use @agent_lens.trace on any Python function. The SDK integrations are optional.
Does my data leave my machine?
No. All data is stored in ~/.agent-lens/runs.db. No telemetry, no callbacks, no network egress.
Is it production-safe? It's designed for development and debugging. The overhead is < 5ms per traced call on local hardware. The dashboard server binds to 127.0.0.1 only — it's not exposed to the network.
What happens when I restart the dashboard? Traces persist in SQLite. Reload the dashboard — your previous runs and forks are still there, with all their notes intact.
Can I share a trace with a colleague?
Yes: agent-lens export <run_id> --output trace.html generates a self-contained HTML file. Email it, drop it in Slack, archive it in your repo. No agent-lens install needed to view.
Does the run diff work between unrelated runs, or only fork pairs?
Any two runs. The endpoint is GET /runs/{a}/diff/{b} — useful for comparing the same prompt across model versions, or two production runs with different inputs.
See CONTRIBUTING.md. Bug reports, feature requests, and PRs all welcome.
MIT — see LICENSE.
38 commits
1 commits
Python
83.6%
JavaScript
7.3%
CSS
4.7%
Jupyter Notebook
2.9%
HTML
1.3%