Skip to main content

Python SDK for tracing LLM and agent applications with LogNerve

Project description

LogNerve Python SDK

Small Python SDK for tracing agentic and LLM applications with LogNerve.

pip install lognerve-py
import lognerve

lognerve.initialize(
    api_key="lnv_sk_example",
    domain="api.lognerve.ai",
    project_name="agent-examples",
    service_name="vanilla-tool-loop",
    exporter="otlp-http",
    redact_pii=True,
)

@lognerve.observe(name="workflow", type="agent")
def run_workflow(goal: str) -> str:
    return "done"

run_workflow("test tracing")

The root package intentionally exposes only lognerve.initialize, lognerve.observe, lognerve.usingAttributes, lognerve.flush, and lognerve.shutdown.

When neither otlp_endpoint nor domain is set, the SDK defaults to https://lognerve.ai/api/v1/traces. Use domain to customize (e.g. https://eu.lognerve.ai/api/v1/traces). Explicit otlp_endpoint always takes precedence.

Set LOGNERVE_REDACT_PII=true or pass redact_pii=True to redact common PII locally before span export. Default local redaction covers emails, phone numbers, credit cards, SSNs, IPv4 addresses, API keys, and bearer tokens. You can customize it with redact_pii={"entities": ["email", "api_key"], "patterns": [{"pattern": "customer-[0-9]+"}]}.

SOC 2, encryption at rest, server-side intelligent PII detection, and on-prem alerting are backend/product controls. The SDK control implemented here is local regex redaction before export.

When api_key or LOGNERVE_API_KEY is set, OTLP requests include Authorization: Bearer <api_key>. That generated authorization header takes precedence over otlp_headers={"Authorization": ...} or LOGNERVE_OTLP_HEADERS; custom non-authorization headers still pass through.

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

lognerve_py-0.1.3.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

lognerve_py-0.1.3-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file lognerve_py-0.1.3.tar.gz.

File metadata

  • Download URL: lognerve_py-0.1.3.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for lognerve_py-0.1.3.tar.gz
Algorithm Hash digest
SHA256 3cf511937e3a237c0ee91d8352a3df3b4fb60c02589c2964851bb303a3f990be
MD5 a221088019937ba14f5f0ac157d55af6
BLAKE2b-256 734ec67978c7ca27cda851db6169d873fff194c8aec9efec35eff0c039d5c915

See more details on using hashes here.

File details

Details for the file lognerve_py-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: lognerve_py-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for lognerve_py-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a9f189c03971bafa8900dc32d2edad660e22197518b0578a99bb3123e5b0d825
MD5 78ac0a4a2f23d10077d8ad18d50c9141
BLAKE2b-256 9c97c542dae861d2d2895e1112de868d8f191d75019fac5b12ef8d3b3862994c

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