Skip to main content

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.trace decorator + agentlens.span() context manager
  • Fire-and-forget — never blocks your agent (daemon thread transport)
  • Async-safe — uses contextvars.ContextVar for 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.1.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentlens_observe-0.1.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file agentlens_observe-0.1.0.tar.gz.

File metadata

  • Download URL: agentlens_observe-0.1.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for agentlens_observe-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b73aba523a1f04977bd841c2db673d7dc83dae9ef3241b877ca94af4c392dcb6
MD5 520b8f386c64481e2d085a68fe20372c
BLAKE2b-256 df6090ba96c529586290648a2b5b383159025e2c34cc1b3eb7dbded4a8cfff45

See more details on using hashes here.

File details

Details for the file agentlens_observe-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agentlens_observe-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e9c00dbff9fc12df01498a07c184c5e023f11a655148f7808ce0309e469f0f83
MD5 ec716a6c463a43905b3df91cd6720da8
BLAKE2b-256 d06410b35b3ab9dfc5fc978807061a87b922c96a5b6f6654cbb9648fdaa1d4d1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page