Debug AI agents visually — self-hosted, open-source observability SDK
Project description
agentlens-observe
Debug AI agents visually — Python SDK for AgentLens, the self-hosted AI agent observability platform.
Install
pip install agentlens-observe
Quick Start
import agentlens
agentlens.configure(server_url="http://localhost:8000")
@agentlens.trace(name="ResearchAgent")
def run_agent(query: str) -> str:
with agentlens.span("web_search", "tool_call") as s:
result = search(query)
s.set_output(result)
s.set_cost("gpt-4o", input_tokens=500, output_tokens=200)
return summarize(result)
run_agent("Latest AI research papers")
# → Traces stream to your AgentLens dashboard
Features
- 2-line integration —
@agentlens.tracedecorator +agentlens.span()context manager - Fire-and-forget — never blocks your agent (daemon thread transport)
- Async-safe — uses
contextvars.ContextVarfor trace propagation - Cost tracking — built-in pricing for 12+ models (GPT-4o, Claude, etc.)
- Framework integrations — LangChain, CrewAI
Framework Integrations
LangChain / LangGraph
from agentlens.integrations.langchain import AgentLensCallbackHandler
agent.run("task", callbacks=[AgentLensCallbackHandler()])
CrewAI
from agentlens.integrations.crewai import patch_crewai
patch_crewai() # Auto-instruments all Crew runs
License
MIT — see LICENSE
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
agentlens_observe-0.2.0.tar.gz
(19.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentlens_observe-0.2.0.tar.gz.
File metadata
- Download URL: agentlens_observe-0.2.0.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6547e84519a62fd05e415696fdac1cb40c393965bff62ff9bf0f730af92347e2
|
|
| MD5 |
f210518d34cb0f83c2c88837a083a4a8
|
|
| BLAKE2b-256 |
5fb83ef1624d9cbffb63a694607b1cbced74b658add950c0162647ff93cbf1eb
|
File details
Details for the file agentlens_observe-0.2.0-py3-none-any.whl.
File metadata
- Download URL: agentlens_observe-0.2.0-py3-none-any.whl
- Upload date:
- Size: 20.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
289f96d27d6febc12ee3565e96f43cfbab089da85a54c70f8aa47650438d45da
|
|
| MD5 |
5e2806cb83204204ad4d4547816bd228
|
|
| BLAKE2b-256 |
57485dcfc3c3c73d3d5b5fccf99d62d49b16ab049a65664a2cc071d95eabb8c2
|