Skip to main content

Python SDK for LangObs — observability for AI agents

Project description

langobs-sdk

Python SDK for LangObs — real-time observability and debugging for AI agents.

Install

pip install langobs-sdk

With framework extras:

pip install "langobs-sdk[openai]"
pip install "langobs-sdk[anthropic]"
pip install "langobs-sdk[langchain]"
pip install "langobs-sdk[all]"

Prerequisites

Start the LangObs server first:

pip install langobs-server
langobs-server
# Server running at http://localhost:8766

Then open the dashboard at http://localhost:5173.

Usage

Option 1: Auto-instrument (recommended)

from langobs_sdk import auto_instrument

auto_instrument()  # patches OpenAI + Anthropic clients automatically

# All subsequent OpenAI/Anthropic calls are traced — no other changes needed
import openai
client = openai.AsyncOpenAI()
response = await client.chat.completions.create(...)

Option 2: @trace decorator

from langobs_sdk import init, trace

init(server_url="ws://localhost:8766/ws")

@trace(name="my_agent")
async def my_agent(query: str) -> str:
    result = await call_llm(query)
    return result

Option 3: Manual spans

from langobs_sdk import get_tracer

async def my_agent(query: str) -> str:
    with get_tracer().span("my_agent") as span:
        span.set_attribute("query", query)
        result = await call_llm(query)
        span.set_output(result)
        return result

Framework Integrations

LangChain

from langobs_sdk.interceptors.langchain_interceptor import LangObsCallbackHandler

handler = LangObsCallbackHandler()
chain = my_chain.with_config(callbacks=[handler])

CrewAI

from langobs_sdk import auto_instrument
auto_instrument()  # CrewAI is auto-detected

AutoGen

from langobs_sdk import auto_instrument
auto_instrument()  # AutoGen ConversableAgent is auto-detected

Configuration

from langobs_sdk import init

init(
    server_url="ws://localhost:8766/ws",   # LangObs server WebSocket URL
    http_url="http://localhost:8766",       # LangObs server HTTP URL
    session_name="my-agent-v2",            # Optional: name shown in dashboard
)

Design Principles

  • Never raises exceptions — all SDK operations are silent on failure. Your agent always runs.
  • Non-blocking — async, buffered, batch-sent. Adds <5ms overhead per traced call.
  • Auto session management — creates a session on first event, closes it on process exit.
  • Sensitive data redaction — fields named api_key, token, password, secret, authorization are automatically replaced with [REDACTED].
  • Graceful degradation — if the server isn't running, events are silently dropped.

License

MIT

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

langobs_sdk-0.2.0.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

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

langobs_sdk-0.2.0-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file langobs_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: langobs_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.5

File hashes

Hashes for langobs_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a80c629af102d960341345d066985cc401812ccc650e52e3c8009263ba5c173b
MD5 a00540ccc87aac21b81fa602c66b60a7
BLAKE2b-256 5be8b09dd29b7667c13641bf9b556239cdeaf8c942b415ef3c8d459450b12bcd

See more details on using hashes here.

File details

Details for the file langobs_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: langobs_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.5

File hashes

Hashes for langobs_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8beffbce964631da27c91bea060c6b175b54caa67e4222d1ebce6e3cd717a34b
MD5 e087cd026067b7f46437734c0332a7bb
BLAKE2b-256 b6252f906e54dc0aedf1fa2d77866ee12928cd26528008820a959e7d844c76d8

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