atomiclens
OpenTelemetry-native observability for LLM agents. One init() call
auto-instruments your OpenAI, Anthropic, and Hugging Face calls and exports
priced, attributed spans (tokens, USD cost, latency, model) to any OTLP
endpoint, including the open-source Atomic Lens
backend and dashboard.
pip install atomiclens # core
pip install "atomiclens[openai]" # + OpenAI auto-instrumentation
pip install "atomiclens[all]" # OpenAI + Anthropic + Hugging Face
Quickstart
import atomiclens
atomiclens.init(service_name="my-agent", otlp_endpoint="http://localhost:4318")
# Every OpenAI / Anthropic / Hugging Face call is now traced with token
# counts and USD cost, with no other code change.
from openai import OpenAI
client = OpenAI()
client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hello"}],
)
Streaming calls are handled too: stream_options.include_usage is injected so
token usage and cost are captured even when you stream.
Attribution
Tag spans with the workflow, agent, user, and team they belong to so the dashboard can break cost down by any of them:
from atomiclens import workflow, agent, set_user, set_team
set_user("user_123")
set_team("growth")
with workflow("weekly-report"):
summarize() # spans inherit workflow="weekly-report"
@agent("researcher")
def research(topic): ... # spans inherit agent_name="researcher"
Configuration
init() reads sensible defaults from the environment so you can configure it
without touching code:
| Env var | Purpose |
|---|---|
ATOMICLENS_OTLP_ENDPOINT |
Where spans are exported (defaults to http://localhost:4318) |
ATOMICLENS_API_KEY |
Sent as the ingest key to a protected backend |
service_name is a required argument to init(). init() is idempotent, so
calling it more than once is safe (pass force=True to reconfigure).
Framework integrations
LangChain and LlamaIndex callback handlers are available as optional extras
(pip install "atomiclens[langchain]" / "atomiclens[llamaindex]").
License
Apache-2.0. Source and the full self-hostable backend + dashboard live at github.com/Worldwideblake/atomic-lens.
Metadata
Release files for atomiclens 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| atomiclens-0.1.0.tar.gz | 23.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| atomiclens-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 48.0 kB
Release files / atomiclens-0.1.0.tar.gz
| Download URL | atomiclens-0.1.0.tar.gz |
|---|---|
| Size | 23.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca21d8b7bba8d76e30d31f04b392415f01a0a4cf5a5c186e49cff7d7138342cc
|
|
BLAKE2b-256 checksum How to use checksums |
dd83bb868ee78b99cafcc539c005772d525e34b1c1ea7145b64aaa66d6d2407d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / atomiclens-0.1.0-py3-none-any.whl
| Download URL | atomiclens-0.1.0-py3-none-any.whl |
|---|---|
| Size | 24.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f1b278f5d1fa6cbd0ae81db646999a79fee4bf0e7992a340ddb9c27de7cdd80e
|
|
BLAKE2b-256 checksum How to use checksums |
38b3b9f34757fd59d737befdfca682a72ec0f89d09b0ad452ff98f09cf6dd947
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|