🔎 agentlens
Local-first observability + eval for AI agents.
Capture every step your agent takes — thoughts, tool calls, tokens, latency, errors — automatically detect when it gets stuck in a loop, and render the whole run to a self-contained HTML report. No backend, no account, no cloud. The core is stdlib-only.
Working name. Easy to rename.
Site: a static landing page + docs live in site/ — open
site/index.html in a browser (no build step).
Why
Most agent tools either (a) only score the final answer, missing mistakes that
happen mid-run, or (b) require a hosted dashboard (Postgres + ClickHouse, an
account, a cloud). agentlens is the opposite: one trace object, many
lenses, running entirely on your laptop.
Install (dev)
pip install -e .
Quick start
from agentlens_eval import Tracer, detect_loops
from agentlens_eval.report import generate_html
tracer = Tracer("my-agent")
with tracer.step("user wants the weather") as step:
step.tool_call("get_weather", {"city": "NYC"},
result="72F", tokens=120, latency_ms=800)
warnings = detect_loops(tracer.trace)
generate_html(tracer.trace, "report.html", warnings=warnings, open_browser=True)
Or just run the demo:
python example.py # writes report.html
What's in the box (v0.3)
- Tracing —
Tracer/Step/Trace; latency timed automatically. - Loop detection — consecutive and frequent repeated tool calls.
- HTML trace report — timeline, per-step tool calls, totals, loop warnings.
- Eval layer — cheap, deterministic metrics (
Contains,Regex,Equals,ToolWasCalled,MaxSteps,MaxTokens,NoErrors,NoLoops) plus anEval/Caserunner that produces apass_rateyou can gate CI on, and an HTML eval report with per-case pass/fail. - LLM-as-judge — opt-in
LLMJudge("criteria")for grading open-ended outputs with Claude. It's the only metric that costs tokens, so the rest of your suite stays cheap and deterministic.
from agentlens_eval import Eval, Case, metrics
report = Eval("my-agent", my_agent).run([
Case("weather in NYC", [metrics.Contains("72"), metrics.ToolWasCalled("get_weather")]),
])
report.summary()
assert report.pass_rate == 1.0 # CI gate
See example_eval.py for a full dataset.
pytest integration
Run your evals as normal tests — one pass/fail row per case:
from agentlens_eval import Case, metrics
from agentlens_eval.testing import parametrize, check
DATASET = [Case("weather in NYC", [metrics.Contains("72")], name="weather")]
@parametrize(DATASET)
def test_agent(case):
check(my_agent, case).assert_passed()
pytest -v # tests/test_agent_eval.py::test_agent[weather] PASSED
Or gate a whole run: Eval(...).run(dataset).assert_passed(min_pass_rate=0.9).
Roadmap
The whole design is layers over the same Trace:
- More agent checks — premature termination, plan drift, expected-trajectory match.
- Dev UX — JSON export + run-to-run regression diff, framework adapters (raw
callable, Anthropic, OpenAI, LangChain),
agentlens.wrap(client)one-line auto-capture. - Packaging — publish to PyPI as
pip install agentlens-eval(the bareagentlensname is taken, so the distribution isagentlens-evalwhile the import staysagentlens_eval).
License
MIT
Metadata
Release files for agentlens-eval 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| agentlens_eval-0.3.0.tar.gz | 37.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agentlens_eval-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 52.9 kB
Release files / agentlens_eval-0.3.0.tar.gz
| Download URL | agentlens_eval-0.3.0.tar.gz |
|---|---|
| Size | 37.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0abb3a8ba380a7d19b931815a4419f10f73da6639ade8e61fddb8e515c505b85
|
|
BLAKE2b-256 checksum How to use checksums |
a48ada3e19ddd2d903dc4e39de82b9097dc1ccfefe61488594c020542cc551a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.0
|
Release files / agentlens_eval-0.3.0-py3-none-any.whl
| Download URL | agentlens_eval-0.3.0-py3-none-any.whl |
|---|---|
| Size | 15.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cbc7678fee447a84e0484191a8de0ff9622ed893319c4967d50dd8253e756988
|
|
BLAKE2b-256 checksum How to use checksums |
15ece3a5ca306a1161022537957d208b764ad2b7660eb8feeadddb1c1a279217
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.0
|
Security for agentlens-eval 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.