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.6.0.tar.gz (19.3 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.6.0-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agentlens_observe-0.6.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

Hashes for agentlens_observe-0.6.0.tar.gz
Algorithm Hash digest
SHA256 2b79abbc7def6de188a27332c102f1e373f03ae003db3ca5644d6c05e07a0ad9
MD5 70dead42474fc74aca9c626dd71345b1
BLAKE2b-256 472c63c6165480a074253db61bf4c718b5a3aa343537a5743327a58935e7e59b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for agentlens_observe-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9c8c4982f478fe346ffe91dc3446f43949096f0e1af2ec92f9231beabb5616df
MD5 183b2e282017a3a4879ee610d184901f
BLAKE2b-256 3647419a559d07d3d7f9a7fa3863f23f57102145f1b4603201fa1024d9c9746a

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