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.3.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.3.tar.gz.
File metadata
- Download URL: lantern_ai-0.1.3.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 |
d5aa38ca62af355770028cf639b7cc374d9eadc26254d60a8b76ef2997437238
|
|
| MD5 |
c25f37d2b31a0d26cfe90cb0d7f3b685
|
|
| BLAKE2b-256 |
59c5704cd8b6c238fefe601a3f2670f84b7283da7308e87b4c22ade4ea7db994
|
File details
Details for the file lantern_ai-0.1.3-py3-none-any.whl.
File metadata
- Download URL: lantern_ai-0.1.3-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 |
a333be5b086912af3c06f94dc4bea4d3e8d80ca38499245119f4ab20b122f273
|
|
| MD5 |
0bed19b6e7e945e14f927368199c0a40
|
|
| BLAKE2b-256 |
7e1b5785132f384165392b0da8fc2428eb67d85ab526e11848d89812d32af56d
|