Python SDK for Lantern agent observability
Project description
lantern-ai
Python SDK for Lantern -- agent observability for the enterprise.
Quick Start
pip install lantern-ai
from lantern_ai import LanternTracer, LanternExporter
tracer = LanternTracer(
service_name="my-agent",
agent_name="support-triage",
environment="production",
exporter=LanternExporter(
endpoint="https://ingest.openlanternai.com",
api_key="lnt_your_api_key",
),
)
Auto-Instrumentation
from anthropic import Anthropic
from lantern_ai import wrap_anthropic_client
client = Anthropic()
wrap_anthropic_client(client, tracer)
# All messages.create() calls are now traced automatically
Manual Tracing
trace = tracer.start_trace(agent_name="my-agent")
with tracer.start_span(trace.id, type="llm_call", model="claude-sonnet-4-5-20251001") as span:
span.set_input(messages=[{"role": "user", "content": "Hello"}])
# ... do work ...
span.set_output(content="Hi there!")
span.set_tokens(input_tokens=10, output_tokens=5)
tracer.end_trace(trace.id)
Console Exporter (Development)
from lantern_ai import LanternTracer, ConsoleExporter
tracer = LanternTracer(
service_name="my-agent",
agent_name="support-triage",
exporter=ConsoleExporter(verbose=True),
)
OpenAI Auto-Instrumentation
from openai import OpenAI
from lantern_ai import wrap_openai_client
client = OpenAI()
wrap_openai_client(client, tracer)
# All chat.completions.create() calls are now traced automatically
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lantern_ai-0.1.2.tar.gz
(55.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lantern_ai-0.1.2.tar.gz.
File metadata
- Download URL: lantern_ai-0.1.2.tar.gz
- Upload date:
- Size: 55.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb43896c2b0d5f484e761af213225faff4345cd8eca7f232de0561832ee099c9
|
|
| MD5 |
7d9f8415373271ff1762df7dab9b2d27
|
|
| BLAKE2b-256 |
9100b752f2ec797c52ffe251dd263651b95964c2ea1e976f1bbf2b81aed3aa76
|
File details
Details for the file lantern_ai-0.1.2-py3-none-any.whl.
File metadata
- Download URL: lantern_ai-0.1.2-py3-none-any.whl
- Upload date:
- Size: 22.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ff0f7ea6e87f2c3ba5b9bf26256316fd70b115d61521eaf4b490edbc487edb5
|
|
| MD5 |
7dad4f6e29f4f352b50eb5c8635addc2
|
|
| BLAKE2b-256 |
bd30d2fb2f81c0a84744ef37698cf16049a1c01d6d347d4ba672dbb6a0258a7d
|