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.3.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.3.0.tar.gz.
File metadata
- Download URL: agentlens_observe-0.3.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 |
b6f17eedeb01065ff82eeb265da64b56aee502b8d14fc47d4b99d67d4e97d458
|
|
| MD5 |
50140c98c84fea6d131450f0981c2dad
|
|
| BLAKE2b-256 |
74db52b5472a1edb073f6cd7798bae674c3dea36130bb8d0f2e5cb2b680d1762
|
File details
Details for the file agentlens_observe-0.3.0-py3-none-any.whl.
File metadata
- Download URL: agentlens_observe-0.3.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 |
fdca9cda3067d2a0a486e0be533b4d69395568b155fa8b32f581ba551fca0bd6
|
|
| MD5 |
9735ef5800eb46cde66ea22ecf390253
|
|
| BLAKE2b-256 |
3b505dcf0e845038b18146f181af43f6004e4e6a767ef8f65fa47978b438951d
|