easyobs-agent
Lightweight LLM/Agent observability SDK built on OpenTelemetry.
Install easyobs-agent in your agent service to send spans to the EasyObs console with minimal boilerplate.
Installation
pip install easyobs-agent
This installs all required dependencies including langchain-core, so LangChain auto-tracing works out of the box.
Quick Start
from easyobs_agent import init, traced, record_llm
# 1. Connect to EasyObs server
init(
"http://127.0.0.1:8787",
token="eobs_your_ingest_token",
service="my-agent",
)
# 2. Decorate functions with @traced
@traced
def answer(question: str) -> str:
result = call_llm(question)
# 3. Record LLM metadata
record_llm(model="gpt-4o-mini", tokens_in=120, tokens_out=80)
return result
Features
| Feature | Description |
|---|---|
init() |
Configure OTLP/HTTP exporter and connect to EasyObs |
@traced |
Auto-create OTel span per function call (sync/async) |
span_block() |
Context manager for child spans |
span_tag() |
Attach attributes to the current span |
record_llm() |
Record LLM call metadata (model, tokens, cost) |
record_retrieval() |
Record RAG/retrieval results |
record_tool() |
Record tool invocations |
record_session() |
Attach session/user/request IDs |
EasyObsCallbackHandler |
LangChain callback handler (auto-tracing) |
Auto LangChain Tracing
from easyobs_agent import init
# auto=True enables both capture_io and auto_langchain
init(
"http://127.0.0.1:8787",
token="eobs_…",
service="rag-bot",
auto=True,
)
# All LangChain invocations are automatically captured — no callbacks needed
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="gpt-4o-mini")
llm.invoke("Hello") # span created automatically
Advanced Usage
Selective I/O Capture
@traced(capture=True) # force capture for this function only
def sensitive_fn(query: str) -> str: ...
@traced(capture=False) # opt-out regardless of global setting
def secret_fn(api_key: str) -> str: ...
Manual Span Blocks
from easyobs_agent import span_block, record_retrieval
with span_block("search", kind="retrieve") as span:
docs = vector_store.search(query)
record_retrieval(query=query, docs=docs)
Requirements
- Python >= 3.9
- OpenTelemetry SDK >= 1.28.0
- langchain-core >= 0.3.0
License
MIT
Metadata
Release files for easyobs-agent 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 | |
|---|---|---|---|
| easyobs_agent-0.1.0.tar.gz | 14.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| easyobs_agent-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.8 kB
Release files / easyobs_agent-0.1.0.tar.gz
| Download URL | easyobs_agent-0.1.0.tar.gz |
|---|---|
| Size | 14.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
306000f9419006efc3969bcd1992e62f16c00eee68dcad956eac2b499864c0e1
|
|
BLAKE2b-256 checksum How to use checksums |
e55b02c5a48a4e980f3374d203695b49328144980c6db6b24ad40c9beee4cb7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / easyobs_agent-0.1.0-py3-none-any.whl
| Download URL | easyobs_agent-0.1.0-py3-none-any.whl |
|---|---|
| Size | 16.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f521f0d4382c8d8eeb1d19897bffa89e90fef4730c252a2b610b311d2b649008
|
|
BLAKE2b-256 checksum How to use checksums |
3153d17bc562da114edc12fb3aa73d872c10db015be1c2eec91d86a872feb5e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|