Observed since 20 Oct, 22:34 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
agentlens-monitor
LLM observability, quality scoring, hallucination detection, cost tracking, agent run debugging, and drop-in LangChain + LlamaIndex callbacks — in 2 lines of code.
Drop-in observability for LLM applications. Automatic quality scoring, hallucination detection, cost tracking, and agent run debugging — with 2 lines of code.
pip install agentlens-monitor
import agentlens
agentlens.init(api_url="https://www.agentlens.one/ingest")
agentlens.patch_openai() # auto-track all OpenAI calls
agentlens.patch_anthropic() # auto-track all Anthropic calls
That's it. Your existing code is unchanged. Every chat.completions.create() and messages.create() is now automatically tracked.
Drop-in callback handler for RAG pipelines built with LlamaIndex — every query, retrieval, LLM call, and agent step shows up as a span.
import llm_observe
from llm_observe.integrations.llama_index import AgentLensLlamaIndexHandler
from llama_index.core import Settings
from llama_index.core.callbacks import CallbackManager
llm_observe.init(api_url="https://www.agentlens.one/ingest")
Settings.callback_manager = CallbackManager([AgentLensLlamaIndexHandler()])
# Any LlamaIndex query is now traced automatically
Requires llama-index-core installed.
Drop-in callback handler — attach it once and every chain, LLM call, tool, and retriever shows up as a span in the AgentLens trace view.
import llm_observe
from llm_observe.integrations.langchain import AgentLensCallbackHandler
llm_observe.init(api_url="https://www.agentlens.one/ingest")
handler = AgentLensCallbackHandler(trace_name="my_qa_chain")
# Works with any LangChain runnable, chain, or agent
chain.invoke({"input": "..."}, config={"callbacks": [handler]})
What gets captured per run:
Requires langchain-core (or the full langchain package) installed.
Trace multi-step agent runs to see every step, find where things break, and measure cost per span:
from agentlens import trace_agent
with trace_agent("research_agent", input="Research renewable energy trends") as trace:
with trace.span("web_search", span_type="retrieval") as s:
results = search("renewable energy 2024")
s.set_output(results)
with trace.span("llm_summarize", span_type="llm", model="gpt-4o") as s:
summary = llm.summarize(results)
s.set_output(summary)
s.set_tokens(1200)
s.set_cost(0.009)
with trace.span("fact_check", span_type="tool") as s:
verified = fact_check(summary)
s.set_output(verified)
trace.set_output("Report complete")
Span types: llm · tool · retrieval · decision · custom
Each trace captures: total duration, tokens, cost, per-step timing, inputs/outputs, and errors.
Errors inside a with block are automatically caught and marked as failed.
| Field | Source |
|---|---|
| Input / Output | Message content |
| Model | response.model |
| Tokens | response.usage |
| Cost (USD) | Calculated from token counts |
| Quality Score | Heuristic evaluation or LLM judge |
| Hallucination flags | Automatic detection |
agentlens.track_llm_call(
input="What is the capital of France?",
output="Paris.",
prompt="You are a helpful assistant.",
model="gpt-4o",
metadata={"feature": "qa", "user_id": "u_123", "cost_usd": 0.0003},
)
agentlens.init(
api_url="https://www.agentlens.one/ingest",
api_key="your-secret", # optional bearer token
max_retries=3,
timeout=5.0,
enabled=True, # set False in tests
)
Pair with the self-hosted server for:
Live demo: www.agentlens.one
Self-host: github.com/Soufianeazz/llm-evaltrack
AgentLensLlamaIndexHandler for LlamaIndex — one callback captures queries, retrievals, LLM calls, agent steps, and function calls as spansAgentLensCallbackHandler for LangChain — one callback captures every chain, LLM call, tool call, and retriever call as a waterfall span treerun_id / parent_run_idlangchain-core isn't installedtrace_agent() context manager for agent run tracingspan() and trace.span() for individual stepsset_output(), set_tokens(), set_cost(), set_error()with blocksparent_span_idpatch_openai(), patch_anthropic(), track_llm_call()Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
httpxEnvironment{
"extras": "",
"marker": null,
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | httpx>=0.27 | runtime |
anthropicEnvironment{
"extras": "",
"marker": "extra == \"all\"",
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | anthropic>=0.40; extra == "all" | runtime |
langchain-coreEnvironment{
"extras": "",
"marker": "extra == \"all\"",
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | langchain-core>=0.1; extra == "all" | runtime |
llama-index-coreEnvironment{
"extras": "",
"marker": "extra == \"all\"",
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | llama-index-core>=0.10; extra == "all" | runtime |
openaiEnvironment{
"extras": "",
"marker": "extra == \"all\"",
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | openai>=1.0; extra == "all" | runtime |
anthropicEnvironment{
"extras": "",
"marker": "extra == \"anthropic\"",
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | anthropic>=0.40; extra == "anthropic" | runtime |
langchain-coreEnvironment{
"extras": "",
"marker": "extra == \"langchain\"",
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | langchain-core>=0.1; extra == "langchain" | runtime |
llama-index-coreEnvironment{
"extras": "",
"marker": "extra == \"llamaindex\"",
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | llama-index-core>=0.10; extra == "llamaindex" | runtime |
openaiEnvironment{
"extras": "",
"marker": "extra == \"openai\"",
"requires_python": ">=3.10",
"evaluation": "NOT_EVALUATED"
} | openai>=1.0; extra == "openai" | runtime |
bdist_wheel · 16.71 KB · Python py3
sdist · 1,168.32 KB · Python source
Observed since 20 Oct, 22:34 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:83f8e9795e93b567c32dbb2c64bd8acab0e22792549ddf6b523a71fa553a692e