Skip to main content

Local-first observability for AI agents. Lightweight SDK — trace LangChain, LangGraph, and any Python code.

Project description

AgentLens SDK

Local-first observability for AI agents. Lightweight Python SDK — trace LangChain, LangGraph, and any Python code.

Install

pip install agentlens

Quick Start

Option 1: Environment Variables (zero code changes, like LangSmith)

export AGENTLENS_ENABLED=true
export AGENTLENS_ENDPOINT=http://localhost:6832   # your AgentLens server
import agentlens  # auto-traces all LangChain/LangGraph calls

result = graph.invoke({"messages": [HumanMessage(content="Hello!")]})

Option 2: Explicit Callback

from agentlens import AgentLens

lens = AgentLens(server_url="http://localhost:6832")

result = graph.invoke(
    {"messages": [HumanMessage(content="Hello!")]},
    config={"callbacks": [lens.callback()]}
)

Option 3: Decorators & Context Managers

from agentlens import AgentLens

lens = AgentLens()

@lens.observe(name="search", kind="tool")
def search(query: str):
    return results

with lens.trace("My Pipeline") as t:
    result = search("hello")
    t.outputs = {"result": result}

Configuration

Env Variable Description Default
AGENTLENS_ENABLED Enable tracing false
AGENTLENS_ENDPOINT Server URL http://localhost:6832
AGENTLENS_PROJECT Project name default
AGENTLENS_TAGS Comma-separated tags
AGENTLENS_AUTO_TRACE Auto-attach to LangChain true when enabled

Server

The SDK sends traces to an AgentLens server. See agentlens-server for setup.

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

traceagent-0.1.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

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

traceagent-0.1.0-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for traceagent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1e26b471a1f7f31c24fdb389d48522c037651b4b7b11f23e61f14f04b72bed15
MD5 0e1af6157a69fba321a620b6e01a0bc8
BLAKE2b-256 65106da982350a042ed3a6e19197deadf10f0431688d2e74bccf8e013814128d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: traceagent-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for traceagent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 14aa7020ad1059d13a795e55a89ff3da3127a29d4c353a2ef0d83b92e9255b3f
MD5 fdd473c413ebbb6c3c1efc246685c85f
BLAKE2b-256 96aa478ae48d0d3cd8c8c245bc3565daec3b8b3fabdd3d0a3ef430ed9701c0d0

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